Skip to content

Commit 18419b3

Browse files
committed
[Project] Cmake flags fixes && Fix run only fallback tests for CI
1 parent 44fa2e0 commit 18419b3

File tree

6 files changed

+47
-4
lines changed

6 files changed

+47
-4
lines changed

.github/workflows/ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ jobs:
5959

6060
- name: Run unit-tests (sequential backend)
6161
working-directory: ${{ env.build_dir }}
62-
run: bash scripts/tests_run_all.sh
62+
run: bash scripts/tests_run_fallback.sh
6363
shell: bash

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@ set(CUBOOL_VERSION_MAJOR 1)
1414
set(CUBOOL_VERSION_MINOR 0)
1515
set(CUBOOL_VERSION_SUB 0)
1616

17+
set(CUBOOL_DEBUG OFF)
18+
set(CUBOOL_RELEASE OFF)
19+
20+
if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
21+
message(STATUS "Build cubool in release mode")
22+
set(CUBOOL_RELEASE ON)
23+
elseif(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
24+
message(STATUS "Build cubool in debug mode")
25+
set(CUBOOL_DEBUG ON)
26+
else()
27+
message(STATUS "Build cubool in release mode (default: was not specified)")
28+
set(CUBOOL_RELEASE ON)
29+
endif()
30+
1731
# Configure cuda dependencies
1832
if (CUBOOL_WITH_CUDA)
1933
message(STATUS "Add cub as cuda utility")

cubool/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ target_compile_definitions(cubool PRIVATE CUBOOL_VERSION_SUB=${CUBOOL_VERSION_SU
120120

121121
target_compile_features(cubool PUBLIC cxx_std_14)
122122

123+
target_compile_options(cubool PRIVATE $<$<COMPILE_LANGUAGE:CXX>: -Wall -Werror>)
124+
target_compile_options(cubool PRIVATE $<$<AND:$<BOOL:CUBOOL_RELEASE>,$<COMPILE_LANGUAGE:CXX>>: -O2>)
125+
target_compile_options(cubool PRIVATE $<$<AND:$<BOOL:CUBOOL_DEBUG>,$<COMPILE_LANGUAGE:CXX>>: -O0>)
126+
123127
set_target_properties(cubool PROPERTIES CXX_STANDARD 17)
124128
set_target_properties(cubool PROPERTIES CXX_STANDARD_REQUIRED ON)
125129

@@ -129,6 +133,20 @@ if (CUBOOL_WITH_CUDA)
129133
set_target_properties(cubool PROPERTIES CUDA_STANDARD_REQUIRED ON)
130134
set_target_properties(cubool PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
131135

136+
# Settings: https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
137+
target_compile_options(cubool PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:
138+
-arch=sm_50
139+
-gencode=arch=compute_50,code=sm_50
140+
-gencode=arch=compute_52,code=sm_52
141+
-gencode=arch=compute_60,code=sm_60
142+
-gencode=arch=compute_61,code=sm_61
143+
-gencode=arch=compute_70,code=sm_70
144+
-gencode=arch=compute_75,code=sm_75
145+
-gencode=arch=compute_75,code=compute_75>)
146+
147+
target_compile_options(cubool PRIVATE $<$<AND:$<BOOL:CUBOOL_RELEASE>,$<COMPILE_LANGUAGE:CUDA>>: -Xptxas -O2>)
148+
target_compile_options(cubool PRIVATE $<$<AND:$<BOOL:CUBOOL_DEBUG>,$<COMPILE_LANGUAGE:CUDA>>: -Xptxas -O0>)
149+
132150
target_compile_definitions(cubool PRIVATE CUBOOL_WITH_CUDA)
133151
target_link_libraries(cubool PRIVATE nsparse_um)
134152
endif()

cubool/sources/sequential/sq_matrix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ namespace cubool {
173173

174174
CHECK_RAISE_ERROR(other != nullptr, InvalidArgument, "Provided matrix does not belongs to sequential matrix class");
175175

176-
auto M = other->getNrows();
177-
auto N = 1;
176+
index M = other->getNrows();
177+
index N = 1;
178178

179179
assert(M == this->getNrows());
180180
assert(N == this->getNcols());

deps/nsparse-um/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ project(nsparse_um LANGUAGES CXX CUDA)
44
add_library(nsparse_um INTERFACE)
55
target_include_directories(nsparse_um INTERFACE include/)
66
target_link_libraries(nsparse_um INTERFACE cub)
7-
target_compile_options(nsparse_um INTERFACE $<$<COMPILE_LANGUAGE:CUDA>: --expt-relaxed-constexpr --expt-extended-lambda -Xptxas -O3>)
7+
target_compile_options(nsparse_um INTERFACE $<$<COMPILE_LANGUAGE:CUDA>: --expt-relaxed-constexpr --expt-extended-lambda>)
88

99
if (CUBOOL_BUILD_TESTS)
1010
add_subdirectory(test)

scripts/test_run_fallback.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Runs all tests executables
2+
# Invoke this script within build directory
3+
./cubool/tests/test_library_api
4+
./cubool/tests/test_matrix_misc
5+
./cubool/tests/test_matrix_ewiseadd --gtest_filter=*.*Fallback
6+
./cubool/tests/test_matrix_extract_sub_matrix --gtest_filter=*.*Fallback
7+
./cubool/tests/test_matrix_kronecker --gtest_filter=*.*Fallback
8+
./cubool/tests/test_matrix_mxm --gtest_filter=*.*Fallback
9+
./cubool/tests/test_matrix_reduce --gtest_filter=*.*Fallback
10+
./cubool/tests/test_matrix_setup --gtest_filter=*.*Fallback
11+
./cubool/tests/test_matrix_transpose --gtest_filter=*.*Fallback

0 commit comments

Comments
 (0)