mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-05 17:34:21 +00:00
Split tests to cpu and cuda
This commit is contained in:
@@ -17,8 +17,12 @@ endif()
|
||||
if(USE_CUDA)
|
||||
enable_language(CUDA)
|
||||
add_definitions(-DUSE_CUDA)
|
||||
message(STATUS "Building library with CUDA support")
|
||||
else()
|
||||
message(STATUS "Building library without CUDA support")
|
||||
endif()
|
||||
|
||||
|
||||
file(GLOB_RECURSE CPU_SOURCES
|
||||
src/layers/*.cpp
|
||||
src/model/*.cpp
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "cuda_helper.cuh"
|
||||
|
||||
using namespace CUDANet;
|
||||
|
||||
void Module::addLayer(const std::string& name, Layers::SequentialLayer* layer) {
|
||||
|
||||
@@ -1,17 +1,34 @@
|
||||
find_package(GTest REQUIRED)
|
||||
include_directories(${GTEST_INCLUDE_DIRS})
|
||||
|
||||
file(GLOB_RECURSE TEST_SOURCES
|
||||
*.cu
|
||||
kernels/*.cu
|
||||
layers/*.cu
|
||||
file(GLOB COMMON_TEST_SOURCES
|
||||
common/*.hpp
|
||||
model/*.cpp
|
||||
)
|
||||
|
||||
add_executable(test_main
|
||||
EXCLUDE_FROM_ALL
|
||||
${TEST_SOURCES}
|
||||
)
|
||||
if(USE_CUDA)
|
||||
file(GLOB TEST_SOURCES
|
||||
cuda/*.cu
|
||||
cuda/kernels/*.cu
|
||||
cuda/layers/*.cu
|
||||
cuda/utils/*.cu
|
||||
)
|
||||
add_executable(test_main
|
||||
EXCLUDE_FROM_ALL
|
||||
${COMMON_TEST_SOURCES}
|
||||
${TEST_SOURCES}
|
||||
)
|
||||
set_target_properties(test_main PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|
||||
else()
|
||||
file(GLOB TEST_SOURCES
|
||||
cpu/*.cpp
|
||||
)
|
||||
add_executable(test_main
|
||||
EXCLUDE_FROM_ALL
|
||||
${COMMON_TEST_SOURCES}
|
||||
${TEST_SOURCES}
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(test_main ${GTEST_BOTH_LIBRARIES} CUDANet)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user