Skip to content

Commit e922fc4

Browse files
committed
[Code] Extern C logic fixes for C compiler
1 parent 85401cd commit e922fc4

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

cubool/include/cubool/cubool.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@
3232
#endif
3333

3434
// Preserve C names in shared library
35-
#define CUBOOL_EXPORT extern "C"
35+
#ifdef __cplusplus
36+
#define CUBOOL_EXPORT extern "C"
37+
#else
38+
#define CUBOOL_EXPORT
39+
#endif
3640

3741
// Exporting/importing symbols for Microsoft Visual Studio
3842
#if (_MSC_VER && !__INTEL_COMPILER)

cubool/sources/cuda/matrix_csr.cu

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
#include <cuda/matrix_csr.hpp>
2626
#include <core/error.hpp>
27-
#include <utils/exclusive_scan.hpp>
2827
#include <utils/timer.hpp>
2928
#include <algorithm>
3029

@@ -96,7 +95,7 @@ namespace cubool {
9695
return mMatrixImpl.m_vals == 0;
9796
}
9897

99-
void MatrixCsr::transferToDevice(const std::vector<index> &rowOffsets, const std::vector<index> &colIndices) {
98+
void MatrixCsr::transferToDevice(const std::vector<index> &rowOffsets, const std::vector<index> &colIndices) const {
10099
// Create device buffers and copy data from the cpu side
101100
thrust::device_vector<index, DeviceAlloc<index>> rowsDeviceVec(rowOffsets.size());
102101
thrust::device_vector<index, DeviceAlloc<index>> colsDeviceVec(colIndices.size());

cubool/sources/cuda/matrix_csr.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ namespace cubool {
6565
void clearAndResizeStorageToDim() const;
6666
bool isStorageEmpty() const;
6767
bool isMatrixEmpty() const;
68-
void transferToDevice(const std::vector<index> &rowOffsets, const std::vector<index> &colIndices);
68+
void transferToDevice(const std::vector<index> &rowOffsets, const std::vector<index> &colIndices) const;
6969
void transferFromDevice(std::vector<index> &rowOffsets, std::vector<index> &colIndices) const;
7070

7171
// Uses nsparse csr matrix implementation as a backend

0 commit comments

Comments
 (0)