Maratyszcza / NNPACK

Acceleration package for neural networks on multi-core CPUs
BSD 2-Clause "Simplified" License
1.68k stars 316 forks source link

Cross-compilation for IOS #134

Closed IvyDev0 closed 6 years ago

IvyDev0 commented 6 years ago

I built NNPACK on macOS, and I followed the 'Development builds' in readme. I found that in the 'convolution-inference.cc' we need to make some changes, otherwise we would get fatal error: 'malloc.h' file not found.

  1. change include file 'malloc.h' into 'stdlib.h'
  2. change memalign into posix_memalign at the following two places:
//transformedKernel = memalign(64, transformedKernelSize);
posix_memalign((void **)&transformedKernel, 64, transformedKernelSize);

//workspaceBuffer = memalign(64, workspaceSize);
posix_memalign((void **)&workspaceBuffer, 64, workspaceSize);

Also, the 'Cross-compilation' part in the readme.md does not mention IOS, so does it mean that we don't need extra configuration argument when cross-compiling NNPACK for IOS?

IvyDev0 commented 6 years ago

I just tried to develop on IOS, but I cannot built an NNPACK lib fits arm64 of IOS. I then read the code in https://github.com/Maratyszcza/confu, and it seems like there's no IOS support.

Maratyszcza commented 6 years ago

You can't build NNPACK for iOS using confu, you need to use CMake with ios-cmake