From a2b3a9529e802dc5ffa61e4f76d956a7d1ae74a7 Mon Sep 17 00:00:00 2001 From: JianxiaoYang Date: Wed, 1 Nov 2023 20:15:32 -0700 Subject: [PATCH] separate OpenCL code and CUDA code in 'BaseGpuModelSpecifics.hpp'; remove BH dependency for current codebase (without OpenCL) --- DESCRIPTION | 1 - src/cyclops/engine/BaseGpuModelSpecifics.hpp | 12 +++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a7439318..ed2c8bf6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -41,7 +41,6 @@ Imports: survival, bit64 LinkingTo: Rcpp, - BH (>= 1.51.0), RcppEigen (>= 0.3.2), RcppParallel Suggests: diff --git a/src/cyclops/engine/BaseGpuModelSpecifics.hpp b/src/cyclops/engine/BaseGpuModelSpecifics.hpp index 1a0f7693..84c3b186 100644 --- a/src/cyclops/engine/BaseGpuModelSpecifics.hpp +++ b/src/cyclops/engine/BaseGpuModelSpecifics.hpp @@ -5,14 +5,21 @@ #ifndef BASEGPUMODELSPECIFICS_HPP #define BASEGPUMODELSPECIFICS_HPP +#ifdef HAVE_OPENCL #include +#endif // HAVE_OPENCL + +#ifdef HAVE_CUDA #include +#endif //HAVE_CUDA #include "ModelSpecifics.hpp" namespace bsccs { +#ifdef HAVE_OPENCL namespace compute = boost::compute; +#endif // HAVE_OPENCL namespace detail { @@ -24,6 +31,7 @@ namespace bsccs { static const int maxBlockSize = 256; }; // namespace constant +#ifdef HAVE_OPENCL template DeviceVec allocateAndCopyToDevice(const HostVec& hostVec, const compute::context& context, compute::command_queue& queue) { DeviceVec deviceVec(hostVec.size(), context); @@ -36,6 +44,7 @@ namespace bsccs { deviceVec.resize(hostVec.size()); compute::copy(std::begin(hostVec), std::end(hostVec), std::begin(deviceVec), queue); } +#endif // HAVE_OPENCL template void compare(const HostVec& host, const DeviceVec& device, const std::string& error, double tolerance = 1E-10) { @@ -69,6 +78,7 @@ namespace bsccs { SourceCode(std::string body, std::string name) : body(body), name(name) { } }; +#ifdef HAVE_OPENCL template class AllGpuColumns { public: @@ -466,6 +476,6 @@ namespace bsccs { int multiprocessors = device.get_info(CL_DEVICE_MAX_COMPUTE_UNITS)*4/5; }; - +#endif // HAVE_OPENCL } #endif //BASEGPUMODELSPECIFICS_HPP