facebookarchive / caffe2

Caffe2 is a lightweight, modular, and scalable deep learning framework.
https://caffe2.ai
Apache License 2.0
8.42k stars 1.94k forks source link

difference between macro USE_METAL, CAFFE2_USE_MPSCNN & CAFFE2_MOBILE #1638

Open xhsoldier opened 6 years ago

xhsoldier commented 6 years ago

For iOS system, do I need to enable all these macros? USE_METAL, CAFFE2_USE_MPSCNN CAFFE2_MOBILE

pietern commented 6 years ago

@bwasti Do you know this?

jerryzh168 commented 6 years ago

USE_METAL is deprecated. If you just use CPU, you can enable CAFFE2_MOBILE. If you want to use iOS GPU, you should enable both CAFFE2_MOBILE and CAFFE2_USE_MPSCNN.

xhsoldier commented 6 years ago

i enable the both CAFFE2_MOBILE and CAFFE2_USE_MPSCNN. then compile with a error: caffe2/caffe2/mobile/contrib/ios/mpscnn/mpscnn.mm:24:10: fatal error: 'caffe2/mobile/fb/aloha/headers.h' file not found

include "caffe2/mobile/fb/aloha/headers.h"

sasikiran commented 6 years ago

@jerryzh168 I couldn't get the master branch compile with flags CAFFE2_USE_MPSCNN and CAFFE2_MOBILE. It only seems to accept USE_METAL flag though.

jerryzh168 commented 6 years ago

There are problems with header files. We're looking into it, will give an update when it is resolved.

On Jan 3, 2018, 2:01 AM -0800, Sasi kiran Malladi notifications@github.com, wrote:

@jerryzh168 I couldn't get the master branch compile with flags CAFFE2_USE_MPSCNN and CAFFE2_MOBILE. It only seems to accept USE_METAL flag though. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Yangqing commented 6 years ago

Should be fixed in #1690 now - feel free to reopen if it does not work.

xhsoldier commented 6 years ago

the libcaffe2.a was succussfully built. But when I use the lib, I got a error:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_MPSCNNSoftMax", referenced from:
      objc-class-ref in libcaffe2.a(mpscnn.mm.o)
  "_OBJC_CLASS_$_MPSCNNPoolingMax", referenced from:
      objc-class-ref in libcaffe2.a(mpscnn.mm.o)
  "_OBJC_CLASS_$_MPSCNNPoolingAverage", referenced from:
      objc-class-ref in libcaffe2.a(mpscnn.mm.o)
  "_OBJC_CLASS_$_MPSCNNNeuronTanH", referenced from:
      objc-class-ref in libcaffe2.a(mpscnn.mm.o)
  "caffe2::utils::ComputeAllAnchors(caffe2::Tensor<caffe2::CPUContext> const&, int, int, float)", referenced from:
      caffe2::(anonymous namespace)::MPSCNNGenerateProposalsCPPOp::RunOnDevice() in libcaffe2.a(mpscnn.mm.o)
  "_OBJC_CLASS_$_MPSCNNConvolutionDescriptor", referenced from:
      objc-class-ref in libcaffe2.a(mpscnn.mm.o)
  "_OBJC_CLASS_$_MPSCNNNeuronSigmoid", referenced from:
      objc-class-ref in libcaffe2.a(mpscnn.mm.o)
  "_OBJC_CLASS_$_MPSCNNConvolution", referenced from:
      objc-class-ref in libcaffe2.a(mpscnn.mm.o)
  "_OBJC_CLASS_$_MPSCNNNeuronReLU", referenced from:
      objc-class-ref in libcaffe2.a(mpscnn.mm.o)
  "_OBJC_CLASS_$_MPSImage", referenced from:
      objc-class-ref in libcaffe2.a(mpscnn.mm.o)
  "_OBJC_CLASS_$_MPSCNNDepthWiseConvolutionDescriptor", referenced from:
      objc-class-ref in libcaffe2.a(mpscnn.mm.o)
  "_OBJC_CLASS_$_MPSCNNConvolutionTranspose", referenced from:
      objc-class-ref in libcaffe2.a(mpscnn.mm.o)
  "_OBJC_CLASS_$_MPSImageDescriptor", referenced from:
      objc-class-ref in libcaffe2.a(mpscnn.mm.o)
  "_OBJC_CLASS_$_MPSTemporaryImage", referenced from:
      objc-class-ref in libcaffe2.a(mpscnn.mm.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)