Skip to content

Commit

Permalink
Change curandGenerateNormal definition to avoid problems whem compili…
Browse files Browse the repository at this point in the history
…ng in double
  • Loading branch information
PabloPalaciosAlonso committed Jul 11, 2023
1 parent e9b38a8 commit 1476947
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/Integrator/BDHI/BDHI_Cholesky.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions src/Integrator/BDHI/BDHI_Lanczos.cu
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ namespace uammd{
thrust::device_vector<real> 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{
Expand Down Expand Up @@ -172,7 +172,7 @@ namespace uammd{
Lanczos_ns::Dotctor<real3> 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<real3> 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);
Expand Down
10 changes: 5 additions & 5 deletions src/Integrator/BDHI/FIB/FIB.cu
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ namespace uammd{
thrust::device_vector<real> 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<System::CRITICAL>("[BDHI::FIB] Thrust could not allocate necessary arrays at initialization with error: %s", e.what());
Expand Down Expand Up @@ -871,7 +871,7 @@ namespace uammd{
sys->log<System::DEBUG2>("[BDHI::FIB] Random advection");
if(temperature!=real(0.0)){
sys->log<System::DEBUG2>("[BDHI::FIB] Generate random numbers");
CurandSafeCall(curandGenerateNormal(curng,
CurandSafeCall(curandgeneratenormal(curng,
thrust::raw_pointer_cast(random.data()),
random.size(),
0.0, 1.0));
Expand Down Expand Up @@ -906,7 +906,7 @@ namespace uammd{
sys->log<System::DEBUG2>("[BDHI::FIB] Random advection");
if(temperature!=real(0.0)){
sys->log<System::DEBUG2>("[BDHI::FIB] Generate random numbers");
CurandSafeCall(curandGenerateNormal(curng,
CurandSafeCall(curandgeneratenormal(curng,
thrust::raw_pointer_cast(random.data()),
random.size(),
0.0, 1.0));
Expand All @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions src/Integrator/Hydro/ICM.cu
Original file line number Diff line number Diff line change
Expand Up @@ -935,8 +935,8 @@ namespace uammd{
thrust::device_vector<real> 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(){
Expand Down Expand Up @@ -993,7 +993,7 @@ namespace uammd{
if(temperature!=real(0.0)){
CurandSafeCall(curandSetStream(curng, st));
sys->log<System::DEBUG2>("[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());
Expand Down
5 changes: 0 additions & 5 deletions src/Integrator/VerletNVE.cu
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@

#include"VerletNVE.cuh"


#ifndef SINGLE_PRECISION
#define curandGenerateNormal curandGenerateNormalDouble
#endif

namespace uammd{

VerletNVE::VerletNVE(shared_ptr<ParticleGroup> pg, VerletNVE::Parameters par):
Expand Down

0 comments on commit 1476947

Please sign in to comment.