Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add with_gpu to manually build with/out gpu #61

Merged
merged 4 commits into from
Jan 4, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ include_directories(include)
FIND_PACKAGE(CUDA 6.5)
MESSAGE(STATUS "cuda found ${CUDA_FOUND}")

option(WITH_GPU "compile warp-ctc with cuda." ${CUDA_FOUND})
option(WITH_OMP "compile warp-ctc with openmp." ON)

if(NOT WITH_OMP)
add_definitions(-DCTC_DISABLE_OMP)
endif()

# need to be at least 30 or __shfl_down in reduce wont compile
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode arch=compute_30,code=sm_30 -O2")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode arch=compute_35,code=sm_35")
Expand Down Expand Up @@ -53,7 +60,7 @@ ELSE()
ENDIF()


IF (CUDA_FOUND)
IF (WITH_GPU)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a check when WITH_GPU=True and CUDA is not found? @gangliao

MESSAGE(STATUS "Building shared library with GPU support")

Expand All @@ -70,9 +77,11 @@ IF (CUDA_FOUND)
TARGET_LINK_LIBRARIES(test_gpu warpctc ${CUDA_curand_LIBRARY})

INSTALL(TARGETS warpctc
RUNTIME DESTINATION "${CMAKE_BINARY_DIR}"
LIBRARY DESTINATION "${CMAKE_BINARY_DIR}"
ARCHIVE DESTINATION "${CMAKE_BINARY_DIR}")
RUNTIME DESTINATION "bin"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib")

INSTALL(FILES include/ctc.h DESTINATION "include")

IF (Torch_FOUND)
MESSAGE(STATUS "Building Torch Bindings with GPU support")
Expand Down Expand Up @@ -112,9 +121,11 @@ ELSE()
SET_TARGET_PROPERTIES(test_cpu PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11")

INSTALL(TARGETS warpctc
RUNTIME DESTINATION "${CMAKE_BINARY_DIR}"
LIBRARY DESTINATION "${CMAKE_BINARY_DIR}"
ARCHIVE DESTINATION "${CMAKE_BINARY_DIR}")
RUNTIME DESTINATION "bin"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib")

INSTALL(FILES include/ctc.h DESTINATION "include")

IF (Torch_FOUND)
MESSAGE(STATUS "Building Torch Bindings with no GPU support")
Expand Down