Split tests to cpu and cuda

This commit is contained in:
2024-09-07 21:24:34 +02:00
parent f8220f0ec1
commit 591507ed21
16 changed files with 29 additions and 10 deletions

View File

@@ -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

View File

@@ -2,8 +2,6 @@
#include <algorithm>
#include "cuda_helper.cuh"
using namespace CUDANet;
void Module::addLayer(const std::string& name, Layers::SequentialLayer* layer) {

View File

@@ -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
)
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)