Skip to content

llv22/caffe2_cv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

caffe2_cv

CV(CNN, GAN) based on caffe2, thanks to FengChao's https://zhuanlan.zhihu.com/hsmyy

1. Prepare pytorch/caffe2 on mac

  • Source code preparation
git clone  --recursive https://github.com/pytorch/
git submodule update --init --recursive
git submodule update —remote

caffe2 is in the subfolder pytorch/caffe2

  • Compilation preparation
  1. AVX native support for speed-up
    Reference: facebookarchive/caffe2#1789
    Open CMakeLists.txt, for line 113 change as follow
option(USE_NATIVE_ARCH "Use -march=native" ON)
  1. CUDA libary linkage
    Reference: https://discuss.pytorch.org/u/llv22/activity
    Open setup.py, adding as follow
 main_libraries += ['cudart', 'nvToolsExt', 'nvrtc', 'cuda']
export CMAKE_PREFIX_PATH=/Users/llv23/miniconda3
MACOSX_DEPLOYMENT_TARGET=10.13 CC=clang CXX=clang++ python setup.py install
  1. otool link check
otool -L <path to caffe2_pybind11_state_gpu.cpython-36m-darwin.so>
  1. otool link refinement (For my case, 9.1->9.2)
install_name_tool -change @rpath/libcufft.9.1.dylib @rpath/libcufft.9.2.dylib <path to caffe2_pybind11_state_gpu.cpython-36m-darwin.so>
install_name_tool -change  @rpath/libcurand.9.1.dylib  @rpath/libcurand.9.2.dylib <path to caffe2_pybind11_state_gpu.cpython-36m-darwin.so>
install_name_tool -change @rpath/libnvrtc.9.1.dylib  @rpath/libnvrtc.9.2.dylib <path to caffe2_pybind11_state_gpu.cpython-36m-darwin.so>
install_name_tool -change @rpath/libcublas.9.1.dylib  @rpath/libcublas.9.2.dylib <path to caffe2_pybind11_state_gpu.cpython-36m-darwin.so>
cd caffe2/python/examples

Download https://caffe2.ai/static/datasets/shakespeare.txt to that folder

  • CPU testing
python char_rnn.py --train_data shakespeare.txt
  • GPU testing
python char_rnn.py --train_data shakespeare.txt --gpu

2. Pytorch/Caffe2 version

  • 2018-08-04: 0.5.0a (Current version)

About

CV(CNN, GAN) based on caffe2, thanks to FengChao's https://zhuanlan.zhihu.com/hsmyy

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published