Skip to content

Commit

Permalink
Add config for USE_CUDA.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Jul 25, 2018
1 parent 6c8ff4e commit c61e8da
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ ADD_LIBRARY(cpuh2o4gpu STATIC ${CPU_SOURCES} $<TARGET_OBJECTS:commonh2o4gpu>)
TARGET_LINK_LIBRARIES(cpuh2o4gpu ${BLAS_LIBRARIES})
#============= BUILD CPU LIBRARY

if (USE_CUDA)
set(HG_USE_CUDA 1)
else()
set(HG_USE_CUDA 0)
endif(USE_CUDA)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/src/common)

if(USE_CUDA)
FIND_PACKAGE(CUDA 8.0 REQUIRED)
FIND_PACKAGE(NVML REQUIRED)
Expand Down
1 change: 1 addition & 0 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/utils.h.in ${CMAKE_CURRENT_SOURCE_DIR}/utils.h)
2 changes: 1 addition & 1 deletion src/common/utils.h → src/common/utils.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "cblas/cblas.h"

#define USE_CUDA() 1
#define USE_CUDA() @HG_USE_CUDA@

template<typename T>
void self_dot(std::vector<T> array_in, int n, int dim,
Expand Down

0 comments on commit c61e8da

Please sign in to comment.