Skip to content

Commit c61e8da

Browse files
committed
Add config for USE_CUDA.
1 parent 6c8ff4e commit c61e8da

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ ADD_LIBRARY(cpuh2o4gpu STATIC ${CPU_SOURCES} $<TARGET_OBJECTS:commonh2o4gpu>)
5959
TARGET_LINK_LIBRARIES(cpuh2o4gpu ${BLAS_LIBRARIES})
6060
#============= BUILD CPU LIBRARY
6161

62+
if (USE_CUDA)
63+
set(HG_USE_CUDA 1)
64+
else()
65+
set(HG_USE_CUDA 0)
66+
endif(USE_CUDA)
67+
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/src/common)
68+
6269
if(USE_CUDA)
6370
FIND_PACKAGE(CUDA 8.0 REQUIRED)
6471
FIND_PACKAGE(NVML REQUIRED)

src/common/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/utils.h.in ${CMAKE_CURRENT_SOURCE_DIR}/utils.h)

src/common/utils.h renamed to src/common/utils.h.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include "cblas/cblas.h"
1212

13-
#define USE_CUDA() 1
13+
#define USE_CUDA() @HG_USE_CUDA@
1414

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

0 commit comments

Comments
 (0)