From 400fa464d54e669da0853565c909e726c4707a69 Mon Sep 17 00:00:00 2001 From: gineshidalgo99 Date: Wed, 3 May 2017 17:16:15 -0400 Subject: [PATCH] Added c++11 flag to Caffe + edited Caffe installation doc --- 3rdparty/caffe/Makefile | 7 ++++++- 3rdparty/caffe/install_caffe.sh | 4 ++-- README.md | 10 ++++++++++ doc/installation.md | 9 +-------- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/3rdparty/caffe/Makefile b/3rdparty/caffe/Makefile index 4d324160..8674f3a7 100644 --- a/3rdparty/caffe/Makefile +++ b/3rdparty/caffe/Makefile @@ -40,6 +40,9 @@ DYNAMIC_NAME_SHORT := lib$(LIBRARY_NAME).so DYNAMIC_VERSIONED_NAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_MINOR).$(DYNAMIC_VERSION_REVISION) DYNAMIC_NAME := $(LIB_BUILD_DIR)/$(DYNAMIC_VERSIONED_NAME_SHORT) COMMON_FLAGS += -DCAFFE_VERSION=$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_MINOR).$(DYNAMIC_VERSION_REVISION) +# OpenPose: added C++11 flag to avoid crashing in some old GCC compilers +COMMON_FLAGS += -std=c++11 +# OpenPose: end modified ############################## # Get all source files @@ -319,7 +322,9 @@ ifeq ($(DEBUG), 1) COMMON_FLAGS += -DDEBUG -g -O0 NVCCFLAGS += -G else - COMMON_FLAGS += -DNDEBUG -O2 + # OpenPose: modified `-O2` by `-O3` + COMMON_FLAGS += -DNDEBUG -O3 + # OpenPose: end modified endif # cuDNN acceleration configuration. diff --git a/3rdparty/caffe/install_caffe.sh b/3rdparty/caffe/install_caffe.sh index d95b0cb2..994d4688 100755 --- a/3rdparty/caffe/install_caffe.sh +++ b/3rdparty/caffe/install_caffe.sh @@ -71,9 +71,9 @@ else cp Makefile.config.Ubuntu16.example Makefile.config fi # make all -j$NUM_CORES -make distribute -j$NUM_CORES +make all -j$NUM_CORES && make distribute -j$NUM_CORES # make test -j$NUM_CORES -# make runtest -j$NUM_CORES # This command crashes due to the new added layers +# make runtest -j$NUM_CORES exitIfError echo "------------------------- Caffe Compiled -------------------------" echo "" diff --git a/README.md b/README.md index 85e34530..01a1a70e 100644 --- a/README.md +++ b/README.md @@ -182,6 +182,16 @@ Just comment on GibHub or make a pull request! We will answer you back as soon a +## Custom Caffe +We only modified some Caffe compilation flags and minor details. You can use use your own Caffe distribution, these are the files we added and modified: + +1. Added files: `install_caffe.sh`; as well as `Makefile.config.Ubuntu14.example`, `Makefile.config.Ubuntu16.example`, `Makefile.config.Ubuntu14_cuda_7.example` and `Makefile.config.Ubuntu16_cuda_7.example` (extracted from `Makefile.config.example`). Basically, you must enable cuDNN. +2. Edited file: Makefile. Search for "# OpenPose: " to find the edited code. We basically added the C++11 flag to avoid issues in some old computers. +3. Optional - deleted Caffe file: `Makefile.config.example`. +4. Finally, run `make all && make distribute` in your Caffe version and modify the Caffe directory variable in our Makefile config file: `./Makefile.config.UbuntuX.example` (where X is 14 or 16 depending on your Ubuntu version), set the `CAFFE_DIR` parameter to the path where both the `include` and `lib` Caffe folders are located. + + + ## Citation Please cite the paper in your publications if it helps your research: diff --git a/doc/installation.md b/doc/installation.md index 39478264..5810caa3 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -28,7 +28,7 @@ cp Makefile.config.Ubuntu14.example Makefile.config # Ubuntu 14, cuda 8 cp Makefile.config.Ubuntu16_cuda_7.example Makefile.config # Ubuntu 16, cuda 7 cp Makefile.config.Ubuntu16.example Makefile.config # Ubuntu 16, cuda 8 # Compile Caffe -make distribute -j${number_of_cpus} +make all -j${number_of_cpus} && make distribute -j${number_of_cpus} ### Install OpenPose ### cd ../../models/ @@ -49,10 +49,3 @@ Note: These steps only need to be performed once. If you are interested in makin make clean make all -j$(NUM_CORES) ``` - -## Custom Caffe -We slightly modified some Caffe compilation flags and minor details. In case you want to use your own Caffe distribution, these are the files we added and modified: - -1. Added files: `install_caffe_and_openpose.sh`; as well as `Makefile.config.Ubuntu14.example`, `Makefile.config.Ubuntu16.example`, `Makefile.config.Ubuntu14_cuda_7.example` and `Makefile.config.Ubuntu16_cuda_7.example` (extracted from `Makefile.config.example`). -2. Optional - deleted Caffe files and folders (only to save space): `Makefile.config.example`, `data/`, `examples/` (editing the Makefile distribute section to avoid using this folder) and `models/`. -3. Finally, run `make distribute` in your Caffe version and modify the Caffe directory variable in our Makefile config file: `./Makefile.config.UbuntuX.example` (where X is 14 or 16 depending on your Ubuntu version), set the `CAFFE_DIR` parameter to the path where both the `include` and `lib` Caffe folders are located. -- GitLab