Skip to content

Commit 8ac77be

Browse files
committed
[Project] Try-fix build-flags
1 parent 18419b3 commit 8ac77be

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ set(CUBOOL_VERSION_SUB 0)
1717
set(CUBOOL_DEBUG OFF)
1818
set(CUBOOL_RELEASE OFF)
1919

20-
if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
20+
if (${CMAKE_BUILD_TYPE} MATCHES Release)
2121
message(STATUS "Build cubool in release mode")
2222
set(CUBOOL_RELEASE ON)
23-
elseif(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
23+
elseif (${CMAKE_BUILD_TYPE} MATCHES Debug)
2424
message(STATUS "Build cubool in debug mode")
2525
set(CUBOOL_DEBUG ON)
2626
else()
2727
message(STATUS "Build cubool in release mode (default: was not specified)")
2828
set(CUBOOL_RELEASE ON)
29+
set(CMAKE_BUILD_TYPE Release)
2930
endif()
3031

3132
# Configure cuda dependencies

cubool/CMakeLists.txt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
project(cubool-cpp LANGUAGES CXX)
2+
13
if (CUBOOL_WITH_CUDA)
24
# If Cuda backend is compiled, we must tell cmake, that we will use Cuda
3-
project(cubool-cpp LANGUAGES CXX CUDA)
4-
else()
5-
# Otherwise only C++
6-
project(cubool-cpp LANGUAGES CXX)
5+
enable_language(CUDA)
76
endif()
87

98
# Notify user about selected backend options
@@ -120,9 +119,9 @@ target_compile_definitions(cubool PRIVATE CUBOOL_VERSION_SUB=${CUBOOL_VERSION_SU
120119

121120
target_compile_features(cubool PUBLIC cxx_std_14)
122121

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>)
122+
target_compile_options(cubool PRIVATE $<$<COMPILE_LANGUAGE:CXX>: -Wall>)
123+
target_compile_options(cubool PRIVATE $<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:CXX>>: -O2>)
124+
target_compile_options(cubool PRIVATE $<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:CXX>>: -O0>)
126125

127126
set_target_properties(cubool PROPERTIES CXX_STANDARD 17)
128127
set_target_properties(cubool PROPERTIES CXX_STANDARD_REQUIRED ON)
@@ -135,7 +134,7 @@ if (CUBOOL_WITH_CUDA)
135134

136135
# Settings: https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
137136
target_compile_options(cubool PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:
138-
-arch=sm_50
137+
-arch=sm_30
139138
-gencode=arch=compute_50,code=sm_50
140139
-gencode=arch=compute_52,code=sm_52
141140
-gencode=arch=compute_60,code=sm_60
@@ -144,8 +143,8 @@ if (CUBOOL_WITH_CUDA)
144143
-gencode=arch=compute_75,code=sm_75
145144
-gencode=arch=compute_75,code=compute_75>)
146145

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>)
146+
target_compile_options(cubool PRIVATE $<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:CUDA>>: -Xptxas -O2>)
147+
target_compile_options(cubool PRIVATE $<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:CUDA>>: -Xptxas -O0>)
149148

150149
target_compile_definitions(cubool PRIVATE CUBOOL_WITH_CUDA)
151150
target_link_libraries(cubool PRIVATE nsparse_um)

cubool/sources/sequential/sq_matrix.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ namespace cubool {
253253
auto M = a->getNrows();
254254
auto N = a->getNcols();
255255

256-
assert(M== this->getNrows());
257-
assert(N== this->getNcols());
258-
assert(M== b->getNrows());
259-
assert(N== b->getNcols());
256+
assert(M == this->getNrows());
257+
assert(N == this->getNcols());
258+
assert(M == b->getNrows());
259+
assert(N == b->getNcols());
260260

261261
CsrData out;
262262
out.nrows = this->getNrows();

deps/nsparse-um/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ target_include_directories(nsparse_um INTERFACE include/)
66
target_link_libraries(nsparse_um INTERFACE cub)
77
target_compile_options(nsparse_um INTERFACE $<$<COMPILE_LANGUAGE:CUDA>: --expt-relaxed-constexpr --expt-extended-lambda>)
88

9-
if (CUBOOL_BUILD_TESTS)
9+
if (CUBOOL_BUILD_NSPARSE_TESTS)
1010
add_subdirectory(test)
1111
endif()

deps/nsparse-um/test/src/nsparse_test.cu

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <gtest/gtest.h>
2-
#include <cub/cub.cuh>
32
#include <nsparse/detail/masked_mult.cuh>
43
#include <nsparse/masked_spgemm.h>
54
#include <nsparse/spgemm.h>
@@ -280,4 +279,4 @@ TEST_F(NsparseCountNonZeroTest, countNzGeneratedGlobalHashTable) {
280279
size_t c = 5000;
281280

282281
eval(matrix_generator(a, c, 0.5), matrix_generator(a, b, 0.5), matrix_generator(b, c, 0.5));
283-
}
282+
}

0 commit comments

Comments
 (0)