Skip to content

Commit c766897

Browse files
committed
[Code] Cuda flags fixes to pass mxm tests
1 parent 22aee64 commit c766897

File tree

4 files changed

+19
-31
lines changed

4 files changed

+19
-31
lines changed

cubool/CMakeLists.txt

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,13 @@ if (CUBOOL_WITH_CUDA)
140140

141141
# Settings: https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
142142
target_compile_options(cubool PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:
143-
-arch=sm_30
144-
-gencode=arch=compute_50,code=sm_50
145-
-gencode=arch=compute_52,code=sm_52
146-
-gencode=arch=compute_60,code=sm_60
147-
-gencode=arch=compute_61,code=sm_61
148-
-gencode=arch=compute_70,code=sm_70
149-
-gencode=arch=compute_75,code=sm_75
150-
-gencode=arch=compute_75,code=compute_75>)
151-
152-
target_compile_options(cubool PRIVATE $<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:CUDA>>: -Xptxas -O2>)
153-
target_compile_options(cubool PRIVATE $<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:CUDA>>: -Xptxas -O0>)
143+
-gencode=arch=compute_30,code=sm_30
144+
-gencode=arch=compute_35,code=sm_35
145+
-gencode=arch=compute_50,code=sm_50
146+
-gencode=arch=compute_52,code=sm_52
147+
-gencode=arch=compute_52,code=compute_52>)
148+
149+
target_compile_options(cubool PRIVATE $<$<COMPILE_LANGUAGE:CUDA>: -use_fast_math -Xptxas -O2>)
154150

155151
target_compile_definitions(cubool PRIVATE CUBOOL_WITH_CUDA)
156152
target_link_libraries(cubool PRIVATE nsparse_um)

cubool/utils/testing/matrix.hpp

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ namespace testing {
143143
if (cuBool_Matrix_Nvals(matrix, &extNvals) != CUBOOL_STATUS_SUCCESS)
144144
return false;
145145

146-
// if (extNvals != nvals)
147-
// return false;
146+
if (extNvals != nvals)
147+
return false;
148148

149149
std::vector<cuBool_Index> extRows(extNvals);
150150
std::vector<cuBool_Index> extCols(extNvals);
@@ -157,25 +157,12 @@ namespace testing {
157157

158158
for (cuBool_Index idx = 0; idx < extNvals; idx++) {
159159
extracted[idx] = Pair{extRows[idx], extCols[idx]};
160-
}
161-
162-
for (cuBool_Index idx = 0; idx < nvals; idx++) {
163-
reference[idx] = Pair{rowsIndex[idx], colsIndex[idx]};
160+
reference[idx] = Pair{rowsIndex[idx], colsIndex[idx]};
164161
}
165162

166163
std::sort(extracted.begin(), extracted.end(), PairCmp());
167164
std::sort(reference.begin(), reference.end(), PairCmp());
168165

169-
for (auto i = 0; i < nvals; i++ ) {
170-
std::cout << extracted[i].i << " " << extracted[i].j << " "
171-
<< reference[i].i << " " << reference[i].j << std::endl;
172-
173-
if (! (extracted[i] == reference[i])) {
174-
std::cout << "!!!!!" << std::endl;
175-
}
176-
}
177-
178-
179166
return extracted == reference;
180167
}
181168

cubool/utils/testing/matrox_printing.hpp renamed to cubool/utils/testing/matrix_printing.hpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,13 @@ namespace testing {
7272
}
7373
}
7474

75+
struct Print {
76+
cuBool_Matrix matrix;
77+
};
78+
7579
template <typename Stream>
76-
Stream& operator <<(Stream& stream, cuBool_Matrix matrix) {
80+
Stream& operator <<(Stream& stream, Print p) {
81+
cuBool_Matrix matrix = p.matrix;
7782
assert(matrix);
7883

7984
cuBool_Index nrows;
@@ -83,13 +88,13 @@ namespace testing {
8388
// Query matrix data
8489
cuBool_Matrix_Nrows(matrix, &nrows);
8590
cuBool_Matrix_Ncols(matrix, &ncols);
86-
cuBool_Matrix_Ncols(matrix, &nvals);
91+
cuBool_Matrix_Nvals(matrix, &nvals);
8792

8893
std::vector<cuBool_Index> rowIndex(nvals);
8994
std::vector<cuBool_Index> colIndex(nvals);
9095

9196
cuBool_Matrix_ExtractPairs(matrix, rowIndex.data(), colIndex.data(), &nvals);
92-
printMatrix(stream, rowIndex, colIndex, nrows, ncols, nvals);
97+
printMatrix(stream, rowIndex.data(), colIndex.data(), nrows, ncols, nvals);
9398

9499
return stream;
95100
}

cubool/utils/testing/testing.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <testing/pair.hpp>
3030
#include <testing/timer.hpp>
3131
#include <testing/matrix.hpp>
32-
#include <testing/matrox_printing.hpp>
32+
#include <testing/matrix_printing.hpp>
3333
#include <testing/matrix_generator.hpp>
3434
#include <testing/matrix_ewiseadd.hpp>
3535
#include <testing/matrix_mxm.hpp>

0 commit comments

Comments
 (0)