Skip to content

Commit

Permalink
util/gpu_t.cuh: fix Windows compilation error.
Browse files Browse the repository at this point in the history
  • Loading branch information
dot-asm committed Jul 24, 2024
1 parent c05f291 commit b8d5a37
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions util/gpu_t.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ size_t ngpus();
const gpu_t& select_gpu(int id = 0);
const cudaDeviceProp& gpu_props(int id = 0);
const std::vector<const gpu_t*>& all_gpus();
extern "C" bool cuda_available();

class event_t {
cudaEvent_t event;
Expand Down Expand Up @@ -347,25 +346,24 @@ public:
inline T& operator[](size_t i) { return d_ptr[i]; }
};

extern "C" {
void drop_gpu_ptr_t(gpu_ptr_t<void>&);
#ifdef _WIN32
# define SPPARK_FFI extern "C" __declspec(dllexport)
#else
# define SPPARK_FFI extern "C" __attribute__((visibility("default")))
#endif

SPPARK_FFI bool cuda_available();
SPPARK_FFI void drop_gpu_ptr_t(gpu_ptr_t<void>&);

#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
#endif

gpu_ptr_t<void>::by_value clone_gpu_ptr_t(const gpu_ptr_t<void>&);
SPPARK_FFI gpu_ptr_t<void>::by_value clone_gpu_ptr_t(const gpu_ptr_t<void>&);

#ifdef __clang__
# pragma clang diagnostic pop
#endif
}

#ifdef _WIN32
# define SPPARK_FFI extern "C" __declspec(dllexport)
#else
# define SPPARK_FFI extern "C" __attribute__((visibility("default")))
#endif

#endif

0 comments on commit b8d5a37

Please sign in to comment.