Skip to content

Commit

Permalink
Renamed openpose_caffe as openpose in CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
gineshidalgo99 committed Jan 11, 2019
1 parent 03e0ce2 commit fc6d359
Show file tree
Hide file tree
Showing 25 changed files with 261 additions and 60 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ if (UNIX OR APPLE)

# One for Intel Branch and one for Master
if (USE_MKL)
ExternalProject_Add(openpose_caffe
ExternalProject_Add(openpose
SOURCE_DIR ${CAFFE_URL}
PREFIX ${CAFFE_PREFIX}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
Expand All @@ -720,7 +720,7 @@ if (UNIX OR APPLE)
-DUSE_OPENCV=OFF)
# -DOpenCV_DIR=${OpenCV_DIR})
else (USE_MKL)
ExternalProject_Add(openpose_caffe
ExternalProject_Add(openpose
SOURCE_DIR ${CAFFE_URL}
PREFIX ${CAFFE_PREFIX}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
Expand All @@ -739,10 +739,10 @@ if (UNIX OR APPLE)
# -DOpenCV_DIR=${OpenCV_DIR})
endif (USE_MKL)

ExternalProject_Get_Property(openpose_caffe install_dir)
ExternalProject_Get_Property(openpose install_dir)

if (NOT Caffe_FOUND)
add_custom_command(TARGET openpose_caffe
add_custom_command(TARGET openpose
POST_BUILD
COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR}
COMMAND $(MAKE)
Expand Down
44 changes: 32 additions & 12 deletions cmake/Cuda.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Copied from Caffe

# More info on available architectures vs. CUDA version:
# http://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/

if (CPU_ONLY)
return()
endif ()
Expand All @@ -17,11 +20,24 @@ macro(op_list_unique)
endmacro()

# This list will be used for CUDA_ARCH = All option
# Fermi (3.2 <= CUDA <= 8)
set(FERMI "20 21(20)")
# Kepler (CUDA >= 5)
set(KEPLER "30 35 37")
# Maxwell (CUDA >= 6)
set(MAXWELL "50 52 53")
# Pascal (CUDA >= 8)
set(PASCAL "60 61 62")
# Volta (CUDA >= 9)
set(VOLTA "70 71 72")
# Turing (CUDA >= 10)
set(TURING "75")
if (UNIX AND NOT APPLE)
set(Caffe_known_gpu_archs "30 35 50 52 60 61")
set(Caffe_known_gpu_archs "${KEPLER} ${MAXWELL} ${PASCAL} ${VOLTA} ${TURING}")
# set(Caffe_known_gpu_archs "${FERMI} ${KEPLER} ${MAXWELL} ${PASCAL} ${VOLTA} ${TURING}")
# set(Caffe_known_gpu_archs "20 21(20) 30 35 50 52 60 61")
elseif (WIN32)
set(Caffe_known_gpu_archs "30 35 50 52 60 61")
set(Caffe_known_gpu_archs "${KEPLER} ${MAXWELL} ${PASCAL} ${VOLTA} ${TURING}")
endif ()


Expand Down Expand Up @@ -77,8 +93,8 @@ endfunction()
# op_select_nvcc_arch_flags(out_variable)
function(op_select_nvcc_arch_flags out_variable)
# List of arch names
set(__archs_names "Kepler" "Maxwell" "Pascal" "All" "Manual")
# set(__archs_names "Fermi" "Kepler" "Maxwell" "Pascal" "All" "Manual")
set(__archs_names "Kepler (CUDA >= 5)" "Maxwell (CUDA >= 6)" "Pascal (CUDA >= 8)" "Volta (CUDA >= 9)" "Turing (CUDA >= 10)" "All" "Manual")
# set(__archs_names "Fermi (3.2 <= CUDA <= 8)" "Kepler (CUDA >= 5)" "Maxwell (CUDA >= 6)" "Pascal (CUDA >= 8)" "Volta (CUDA >= 9)" "Turing (CUDA >= 10)" "All" "Manual")
set(__archs_name_default "All")
if (NOT CMAKE_CROSSCOMPILING)
list(APPEND __archs_names "Auto")
Expand All @@ -105,14 +121,18 @@ function(op_select_nvcc_arch_flags out_variable)
unset(CUDA_ARCH_PTX CACHE)
endif ()

if (${CUDA_ARCH} STREQUAL "Fermi" AND NOT WIN32)
set(__cuda_arch_bin "20 21(20)")
elseif (${CUDA_ARCH} STREQUAL "Kepler")
set(__cuda_arch_bin "30 35")
elseif (${CUDA_ARCH} STREQUAL "Maxwell")
set(__cuda_arch_bin "50 52")
elseif (${CUDA_ARCH} STREQUAL "Pascal")
set(__cuda_arch_bin "60 61")
if (${CUDA_ARCH} STREQUAL "Fermi (3.2 <= CUDA <= 8)" AND NOT WIN32)
set(__cuda_arch_bin ${FERMI})
elseif (${CUDA_ARCH} STREQUAL "Kepler (CUDA >= 5)")
set(__cuda_arch_bin ${KEPLER})
elseif (${CUDA_ARCH} STREQUAL "Maxwell (CUDA >= 6)")
set(__cuda_arch_bin ${MAXWELL})
elseif (${CUDA_ARCH} STREQUAL "Pascal (CUDA >= 8)")
set(__cuda_arch_bin ${PASCAL})
elseif (${CUDA_ARCH} STREQUAL "Volta (CUDA >= 9)")
set(__cuda_arch_bin ${VOLTA})
elseif (${CUDA_ARCH} STREQUAL "Turing (CUDA >= 10)")
set(__cuda_arch_bin ${TURING})
elseif (${CUDA_ARCH} STREQUAL "All")
set(__cuda_arch_bin ${Caffe_known_gpu_archs})
elseif (${CUDA_ARCH} STREQUAL "Auto")
Expand Down
2 changes: 1 addition & 1 deletion doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Any problem installing OpenPose? Check [doc/faq.md](./faq.md) and/or post a GitH
3. Ubuntu only: Install `sudo apt-get install libviennacl-dev`. This comes packaged inside OpenPose for Windows.
4. AMD Drivers have not been tested on OSX. Please email us if you wish to test it. This has only been tested on Vega series cards.
6. Ubuntu - Other prerequisites:
- Caffe prerequisites: By default, OpenPose uses Caffe under the hood. If you have not used Caffe previously, install its dependencies by running `sudo bash ./3rdparty/scripts/ubuntu/install_ubuntu_deps_and_cuda.sh` (if Ubuntu 16 or 14 and for Graphic cards up to 10XX) or run `sudo bash ./3rdparty/scripts/ubuntu/install_ubuntu_deps.sh` after installing your desired CUDA and cuDNN versions.
- Caffe prerequisites: By default, OpenPose uses Caffe under the hood. If you have not used Caffe previously, install its dependencies by running `sudo bash ./scripts/ubuntu/install_ubuntu_deps_and_cuda.sh` (if Ubuntu 16 or 14 and for Graphic cards up to 10XX) or run `sudo bash ./scripts/ubuntu/install_ubuntu_deps.sh` after installing your desired CUDA and cuDNN versions.
- OpenCV must be already installed on your machine. It can be installed with `apt-get install libopencv-dev`. You can also use your own compiled OpenCV version.
7. Windows - **Caffe, OpenCV, and Caffe prerequisites**:
- CMake automatically downloads all the Windows DLLs. Alternatively, you might prefer to download them manually:
Expand Down
2 changes: 1 addition & 1 deletion examples/calibration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ foreach(EXAMPLE_FILE ${EXAMPLE_FILES})

message(STATUS "Adding Example ${EXE_NAME}")
add_executable(${EXE_NAME} ${EXAMPLE_FILE})
target_link_libraries(${EXE_NAME} openpose ${examples_3rdparty_libraries})
target_link_libraries(${EXE_NAME} openpose_src ${examples_3rdparty_libraries})

if (WIN32)
set_property(TARGET ${EXE_NAME} PROPERTY FOLDER "Examples")
Expand Down
2 changes: 1 addition & 1 deletion examples/openpose/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ foreach(EXAMPLE_FILE ${EXAMPLE_FILES})

message(STATUS "Adding Example ${EXE_NAME}")
add_executable(${EXE_NAME} ${EXAMPLE_FILE})
target_link_libraries(${EXE_NAME} openpose ${examples_3rdparty_libraries})
target_link_libraries(${EXE_NAME} openpose_src ${examples_3rdparty_libraries})

if (WIN32)
set_property(TARGET ${EXE_NAME} PROPERTY FOLDER "Examples")
Expand Down
2 changes: 1 addition & 1 deletion examples/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ foreach(EXAMPLE_FILE ${EXAMPLE_FILES})

message(STATUS "Adding Example ${EXE_NAME}")
add_executable(${EXE_NAME} ${EXAMPLE_FILE})
target_link_libraries(${EXE_NAME} openpose ${examples_3rdparty_libraries})
target_link_libraries(${EXE_NAME} openpose_src ${examples_3rdparty_libraries})

if (WIN32)
set_property(TARGET ${EXE_NAME} PROPERTY FOLDER "Examples/Tutorial/Tests")
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_add_module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ foreach(EXAMPLE_FILE ${EXAMPLE_FILES})

message(STATUS "Adding Example ${EXE_NAME}")
add_executable(${EXE_NAME} ${EXAMPLE_FILE})
target_link_libraries(${EXE_NAME} openpose ${examples_3rdparty_libraries})
target_link_libraries(${EXE_NAME} openpose_src ${examples_3rdparty_libraries})

if (WIN32)
set_property(TARGET ${EXE_NAME} PROPERTY FOLDER "Examples/Tutorial/AddModule")
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_api_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ foreach(EXAMPLE_FILE ${EXAMPLE_FILES})

message(STATUS "Adding Example ${EXE_NAME}")
add_executable(${EXE_NAME} ${EXAMPLE_FILE})
target_link_libraries(${EXE_NAME} openpose ${examples_3rdparty_libraries})
target_link_libraries(${EXE_NAME} openpose_src ${examples_3rdparty_libraries})

if (WIN32)
set_property(TARGET ${EXE_NAME} PROPERTY FOLDER "Examples/Tutorial/C++ API")
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_developer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ foreach(EXAMPLE_FILE ${EXAMPLE_FILES})

message(STATUS "Adding Example ${EXE_NAME}")
add_executable(${EXE_NAME} ${EXAMPLE_FILE})
target_link_libraries(${EXE_NAME} openpose ${examples_3rdparty_libraries})
target_link_libraries(${EXE_NAME} openpose_src ${examples_3rdparty_libraries})

if (WIN32)
set_property(TARGET ${EXE_NAME} PROPERTY FOLDER "Examples/Tutorial/Developer Examples")
Expand Down
2 changes: 1 addition & 1 deletion examples/user_code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ foreach(USER_CODE_FILE ${USER_CODE_FILES})

message(STATUS "Adding Example ${EXE_NAME}")
add_executable(${EXE_NAME} ${USER_CODE_FILE})
target_link_libraries(${EXE_NAME} openpose ${examples_3rdparty_libraries})
target_link_libraries(${EXE_NAME} openpose_src ${examples_3rdparty_libraries})

if (WIN32)
set_property(TARGET ${EXE_NAME} PROPERTY FOLDER "User Code")
Expand Down
2 changes: 1 addition & 1 deletion scripts/travis/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [[ $RUN_EXAMPLES == true ]] ; then
./build/examples/openpose/openpose.bin --net_resolution -1x32 --image_dir examples/media/ --write_json output/ --display 0 --render_pose 0
echo " "

echo "Tutorial Add Moduel: Example 1..."
echo "Tutorial Add Module: Example 1..."
./build/examples/tutorial_add_module/1_custom_post_processing.bin --net_resolution -1x32 --image_dir examples/media/ --write_json output/ --display 0 --render_pose 0
echo " "

Expand Down
2 changes: 2 additions & 0 deletions scripts/ubuntu/install_ubuntu_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ sudo apt-get --assume-yes install --no-install-recommends libboost-all-dev
# Remaining dependencies, 14.04
sudo apt-get --assume-yes install libgflags-dev libgoogle-glog-dev liblmdb-dev
# Python libs
sudo apt-get install python-setuptools python-dev build-essential
sudo easy_install pip
sudo -H pip install --upgrade numpy protobuf
# OpenCV 2.4 -> Added as option
# sudo apt-get --assume-yes install libopencv-dev
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ CUDA_DIR := /usr/local/cuda
# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# Architectures:
# http://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
Expand Down
92 changes: 92 additions & 0 deletions scripts/ubuntu_deprecated/Makefile.config.Ubuntu16_cuda10.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!

# CPU-only switch (comment to build without GPU support).
USE_CUDA := 1

# uncomment to disable IO dependencies and corresponding data layers
# USE_OPENCV := 0
# USE_LEVELDB := 0
# USE_LMDB := 0

# uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
# You should not set this flag if you will be reading LMDBs with any
# possibility of simultaneous read and write
# ALLOW_LMDB_NOLOCK := 1

# Uncomment if you're using OpenCV 3
# OPENCV_VERSION := 3

# To customize your choice of compiler, uncomment and set the following.
# N.B. the default for Linux is g++ and the default for OSX is clang++
# CUSTOM_CXX := g++

# CUDA directory contains bin/ and lib/ directories that we need.
CUDA_DIR := /usr/local/cuda
# On Ubuntu 14.04, if cuda tools are installed via
# "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
# CUDA_DIR := /usr

# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# Architectures:
# http://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_52,code=sm_52 \
-gencode arch=compute_60,code=sm_60 \
-gencode arch=compute_61,code=sm_61 \
-gencode arch=compute_62,code=sm_62 \
-gencode arch=compute_70,code=sm_70 \
-gencode arch=compute_71,code=sm_71 \
-gencode arch=compute_72,code=sm_72 \
-gencode arch=compute_75,code=sm_75 \
-gencode arch=compute_75,code=compute_75

# Uncomment to enable op::Profiler
# PROFILER_ENABLED := 1

# DEEP_NET choice:
# caffe for Caffe (default and only option so far)
DEEP_NET := caffe

# Caffe directory
CAFFE_DIR := 3rdparty/caffe/distribute

# Faster GUI display
# WITH_OPENCV_WITH_OPENGL := 1
# OpenPose 3-D Reconstruction
# WITH_3D_RENDERER := 1
# WITH_CERES := 1
# WITH_FLIR_CAMERA := 1
# Eigen directory (Ceres)
# WITH_EIGEN := 1
EIGEN_DIR := /usr/include/eigen3/
# Spinnaker directory
SPINNAKER_DIR := /usr/include/spinnaker

# Whatever else you find you need goes here.
INCLUDE_DIRS := /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial

# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
# INCLUDE_DIRS += $(shell brew --prefix)/include
# LIBRARY_DIRS += $(shell brew --prefix)/lib

# Uncomment to use `pkg-config` to specify OpenCV library paths.
# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
# USE_PKG_CONFIG := 1

BUILD_DIR := build
DISTRIBUTE_DIR := distribute

# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
# DEBUG := 1

# The ID of the GPU that 'make runtest' will use to run unit tests.
TEST_GPUID := 0

# enable pretty build (comment to see full commands)
Q ?= @
15 changes: 4 additions & 11 deletions scripts/ubuntu_deprecated/Makefile.config.Ubuntu16_cuda8.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,16 @@ CUDA_DIR := /usr/local/cuda
# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# Architectures:
# http://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_52,code=sm_52 \
-gencode arch=compute_60,code=sm_60 \
-gencode arch=compute_61,code=sm_61 \
-gencode arch=compute_61,code=compute_61
# Deprecated
# CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
# -gencode arch=compute_20,code=sm_21 \
# -gencode arch=compute_30,code=sm_30 \
# -gencode arch=compute_35,code=sm_35 \
# -gencode arch=compute_50,code=sm_50 \
# -gencode arch=compute_52,code=sm_52 \
# -gencode arch=compute_60,code=sm_60 \
# -gencode arch=compute_61,code=sm_61 \
# -gencode arch=compute_61,code=compute_61
-gencode arch=compute_62,code=sm_62 \
-gencode arch=compute_62,code=compute_62

# Uncomment to enable op::Profiler
# PROFILER_ENABLED := 1
Expand Down
Loading

0 comments on commit fc6d359

Please sign in to comment.