Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
  • Loading branch information
bensuperpc committed Dec 28, 2024
1 parent bcd6569 commit 7a3cbe4
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 346 deletions.
4 changes: 3 additions & 1 deletion source/GTASA_alternative_code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ project(
LANGUAGES CXX
)

find_package(OpenMP 2.0)
if(NOT OpenMP_FOUND)
find_package(OpenMP 2.0)
endif()

find_package(CUDAToolkit 11.0)

Expand Down
2 changes: 1 addition & 1 deletion source/GTASA_alternative_code/module/GTASAModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GTASAModule::GTASAModule(COMPUTE_TYPE type) : _type(type) {}
GTASAModule::~GTASAModule() {}

GTASAModule::COMPUTE_TYPE GTASAModule::stringToComputeType(std::string_view type) noexcept {
if (type == "STDTHREAD") {
if (type == "STDTHREAD" || type == "THREADPOOL") {
return COMPUTE_TYPE::STDTHREAD;
} else if (type == "OPENMP") {
return COMPUTE_TYPE::OPENMP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ if(CMAKE_CUDA_COMPILER)
enable_language(CUDA)
endif()

find_package(CUDAToolkit 11.0 REQUIRED)
if(NOT CUDAToolkit_FOUND)
find_package(CUDAToolkit 11.0 REQUIRED)
endif()

set(SRCS
kernel.cu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ project(
LANGUAGES C CXX
)

find_package(OpenCL 2.0 REQUIRED)
if(NOT OpenCL_FOUND)
find_package(OpenCL 2.0 REQUIRED)
endif()

set(SRCS
wrapper.cpp
Expand Down
25 changes: 18 additions & 7 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ function(test_bench_generator TEST_BENCH_NAME IS_TEST ADD_TO_TEST)
endfunction()

if(NOT WIN32)
if(NOT OpenMP_FOUND)
find_package(OpenMP 2.0)
endif()

add_subdirectory(../external/googletest external/googletest)
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_TESTING OFF)
Expand All @@ -70,14 +74,21 @@ if(NOT WIN32)
set(CMAKE_REQUIRED_FLAGS "" CACHE STRING "" FORCE)
add_subdirectory(../external/benchmark external/benchmark)

# Add tests
#test_bench_generator(find_string_inv_test true true)
#test_bench_generator(jamcrc_test true true)
test_bench_generator(gta_sa_test_cuda true true)
# Add tests
#test_bench_generator(find_string_inv_test true true)
#test_bench_generator(jamcrc_test true true)

test_bench_generator(gta_sa_test_threadpool true true)
if(OpenMP_FOUND)
test_bench_generator(gta_sa_test_openmp true true)
endif()
if(CUDAToolkit_FOUND)
test_bench_generator(gta_sa_test_cuda true true)
endif()

# Add bench
#test_bench_generator(find_string_inv_bench false false)
#test_bench_generator(jamcrc_bench false false)
# Add bench
#test_bench_generator(find_string_inv_bench false false)
#test_bench_generator(jamcrc_bench false false)

endif()

Expand Down
Loading

0 comments on commit 7a3cbe4

Please sign in to comment.