From cb73e0dabe5cb8aa55bb7cead720d9f51d4e5ac1 Mon Sep 17 00:00:00 2001
From: PabloIbannez
Date: Fri, 23 Jun 2023 14:37:33 +0200
Subject: [PATCH] Fixed compilation error with double mode
---
src/Integrator/BDHI/BDHI_Cholesky.cu | 4 ++--
src/Integrator/BDHI/BDHI_Lanczos.cu | 6 +++---
src/Integrator/BDHI/FIB/FIB.cu | 10 +++++-----
src/Integrator/Hydro/ICM.cu | 6 +++---
src/Integrator/VerletNVE.cu | 5 -----
src/utils/cuda_lib_defines.h | 3 ++-
6 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/src/Integrator/BDHI/BDHI_Cholesky.cu b/src/Integrator/BDHI/BDHI_Cholesky.cu
index 0a1836d8..298787b6 100644
--- a/src/Integrator/BDHI/BDHI_Cholesky.cu
+++ b/src/Integrator/BDHI/BDHI_Cholesky.cu
@@ -116,7 +116,7 @@ namespace uammd{
//Curand fill with gaussian numbers with mean 0 and var 1
/*This shit is obscure, curand will only work with an even number of elements*/
auto d_noise = thrust::raw_pointer_cast(noise.data());
- curandGenerateNormal(curng, d_noise, 3*numberParticles + ((3*numberParticles)%2), real(0.0), real(1.0));
+ curandgeneratenormal(curng, d_noise, 3*numberParticles + ((3*numberParticles)%2), real(0.0), real(1.0));
isMup2date = false;
}
@@ -219,7 +219,7 @@ namespace uammd{
3*numberParticles, d_M, 3*numberParticles, d_work, h_work_size, d_info));
curandSetStream(curng, st);
/*Gen new noise in BdW*/
- curandGenerateNormal(curng,
+ curandgeneratenormal(curng,
(real*) BdW,
3*numberParticles + ((3*numberParticles)%2),
real(0.0), real(1.0));
diff --git a/src/Integrator/BDHI/BDHI_Lanczos.cu b/src/Integrator/BDHI/BDHI_Lanczos.cu
index d9da96f8..72f865f5 100644
--- a/src/Integrator/BDHI/BDHI_Lanczos.cu
+++ b/src/Integrator/BDHI/BDHI_Lanczos.cu
@@ -49,8 +49,8 @@ namespace uammd{
thrust::device_vector noise(30000);
auto noise_ptr = thrust::raw_pointer_cast(noise.data());
//Warm cuRNG
- curandGenerateNormal(curng, noise_ptr, noise.size(), 0.0, 1.0);
- curandGenerateNormal(curng, noise_ptr, noise.size(), 0.0, 1.0);
+ curandgeneratenormal(curng, noise_ptr, noise.size(), 0.0, 1.0);
+ curandgeneratenormal(curng, noise_ptr, noise.size(), 0.0, 1.0);
}
namespace Lanczos_ns{
@@ -172,7 +172,7 @@ namespace uammd{
Lanczos_ns::Dotctor Mdot(rpy, this->hydrodynamicRadius, radius_ptr, nbody, st);
//Filling V instead of an external array (for v in sqrt(M)·v) is faster
uninitialized_cached_vector noise(numberParticles);
- curandGenerateNormal(curng, (real*)noise.data().get(),
+ curandgeneratenormal(curng, (real*)noise.data().get(),
3*numberParticles + (3*numberParticles)%2,
real(0.0), real(1.0));
//lanczosAlgorithm->solve(Mdot, (real*) BdW, noise, numberParticles, st);
diff --git a/src/Integrator/BDHI/FIB/FIB.cu b/src/Integrator/BDHI/FIB/FIB.cu
index d4830a1c..4a5ffaea 100644
--- a/src/Integrator/BDHI/FIB/FIB.cu
+++ b/src/Integrator/BDHI/FIB/FIB.cu
@@ -129,8 +129,8 @@ namespace uammd{
thrust::device_vector noise(30000);
auto noise_ptr = thrust::raw_pointer_cast(noise.data());
//Warm cuRNG
- CurandSafeCall(curandGenerateNormal(curng, noise_ptr, noise.size(), 0.0, 1.0));
- CurandSafeCall(curandGenerateNormal(curng, noise_ptr, noise.size(), 0.0, 1.0));
+ CurandSafeCall(curandgeneratenormal(curng, noise_ptr, noise.size(), 0.0, 1.0));
+ CurandSafeCall(curandgeneratenormal(curng, noise_ptr, noise.size(), 0.0, 1.0));
}
catch(thrust::system_error &e){
sys->log("[BDHI::FIB] Thrust could not allocate necessary arrays at initialization with error: %s", e.what());
@@ -871,7 +871,7 @@ namespace uammd{
sys->log("[BDHI::FIB] Random advection");
if(temperature!=real(0.0)){
sys->log("[BDHI::FIB] Generate random numbers");
- CurandSafeCall(curandGenerateNormal(curng,
+ CurandSafeCall(curandgeneratenormal(curng,
thrust::raw_pointer_cast(random.data()),
random.size(),
0.0, 1.0));
@@ -906,7 +906,7 @@ namespace uammd{
sys->log("[BDHI::FIB] Random advection");
if(temperature!=real(0.0)){
sys->log("[BDHI::FIB] Generate random numbers");
- CurandSafeCall(curandGenerateNormal(curng,
+ CurandSafeCall(curandgeneratenormal(curng,
thrust::raw_pointer_cast(random.data()),
random.size(),
0.0, 1.0));
@@ -932,7 +932,7 @@ namespace uammd{
double dV = grid.cellSize.x*grid.cellSize.y*grid.cellSize.z;
real noisePrefactor = sqrt(viscosity*temperature/(dt*dV));
if(temperature!=real(0.0))
- CurandSafeCall(curandGenerateNormal(curng,
+ CurandSafeCall(curandgeneratenormal(curng,
thrust::raw_pointer_cast(random.data()),
random.size(),
0.0, 1.0));
diff --git a/src/Integrator/Hydro/ICM.cu b/src/Integrator/Hydro/ICM.cu
index eb0f29f8..9047fc4f 100644
--- a/src/Integrator/Hydro/ICM.cu
+++ b/src/Integrator/Hydro/ICM.cu
@@ -935,8 +935,8 @@ namespace uammd{
thrust::device_vector noise(30000);
auto noise_ptr = thrust::raw_pointer_cast(noise.data());
//Warm cuRNG
- CurandSafeCall(curandGenerateNormal(curng, noise_ptr, noise.size(), 0.0, 1.0));
- CurandSafeCall(curandGenerateNormal(curng, noise_ptr, noise.size(), 0.0, 1.0));
+ CurandSafeCall(curandgeneratenormal(curng, noise_ptr, noise.size(), 0.0, 1.0));
+ CurandSafeCall(curandgeneratenormal(curng, noise_ptr, noise.size(), 0.0, 1.0));
}
//Sum S·F term using the current particle positions
void ICM::spreadParticleForces(){
@@ -993,7 +993,7 @@ namespace uammd{
if(temperature!=real(0.0)){
CurandSafeCall(curandSetStream(curng, st));
sys->log("[Hydro::ICM] Generate random numbers");
- CurandSafeCall(curandGenerateNormal(curng, thrust::raw_pointer_cast(random.data()), random.size(), 0.0, 1.0));
+ CurandSafeCall(curandgeneratenormal(curng, thrust::raw_pointer_cast(random.data()), random.size(), 0.0, 1.0));
}
real3* d_gridVels = (real3*)thrust::raw_pointer_cast(gridVels.data());
real3* d_cellAdvection = (real3*)thrust::raw_pointer_cast(cellAdvection.data());
diff --git a/src/Integrator/VerletNVE.cu b/src/Integrator/VerletNVE.cu
index 95adfb3a..8689e602 100644
--- a/src/Integrator/VerletNVE.cu
+++ b/src/Integrator/VerletNVE.cu
@@ -28,11 +28,6 @@
#include"VerletNVE.cuh"
-
-#ifndef SINGLE_PRECISION
-#define curandGenerateNormal curandGenerateNormalDouble
-#endif
-
namespace uammd{
VerletNVE::VerletNVE(shared_ptr pg, VerletNVE::Parameters par):
diff --git a/src/utils/cuda_lib_defines.h b/src/utils/cuda_lib_defines.h
index a429ca0b..4b79550c 100644
--- a/src/utils/cuda_lib_defines.h
+++ b/src/utils/cuda_lib_defines.h
@@ -8,6 +8,7 @@
#define cusolverDnpotrf cusolverDnSpotrf
#define cusolverDnpotrf_bufferSize cusolverDnSpotrf_bufferSize
#define cublastrmv cublasStrmv
+#define curandgeneratenormal curandGenerateNormal
#define cublassymv cublasSsymv
#define cublasgemv cublasSgemv
#define cublasnrm2 cublasSnrm2
@@ -23,7 +24,7 @@
#define cusolverDnpotrf cusolverDnDpotrf
#define cusolverDnpotrf_bufferSize cusolverDnDpotrf_bufferSize
#define cublastrmv cublasDtrmv
-#define curandGenerateNormal curandGenerateNormalDouble
+#define curandgeneratenormal curandGenerateNormalDouble
#define cublassymv cublasDsymv
#define cublasgemv cublasDgemv
#define cublasnrm2 cublasDnrm2