Skip to content

Commit f2fe68b

Browse files
author
Martin D. Weinberg
committed
Merge branch 'devel' of github.com:EXP-code/EXP into devel
2 parents 6d3fa49 + e85ac14 commit f2fe68b

4 files changed

Lines changed: 19 additions & 23 deletions

File tree

include/cudaParticle.cuH

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,12 @@ extern __host__
9090
std::ostream& operator<< (std::ostream& os, const cudaParticle& p);
9191

9292
//! Functor for extracting level info from cudaParticle structures
93+
#if CUDART_VERSION < 12040
9394
struct cuPartToLevel :
9495
public thrust::unary_function<cudaParticle, unsigned int>
96+
#else
97+
struct cuPartToLevel
98+
#endif
9599
{
96100
int _t;
97101

@@ -106,8 +110,12 @@ struct cuPartToLevel :
106110
};
107111

108112
//! Functor for extracting change level info from cudaParticle structures
113+
#if CUDART_VERSION < 12040
109114
struct cuPartToChange :
110115
public thrust::unary_function<cudaParticle, thrust::pair<int, int>>
116+
#else
117+
struct cuPartToChange
118+
#endif
111119
{
112120
__host__ __device__
113121
thrust::pair<int, int> operator()(const cudaParticle& p) const

src/user/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if(ENABLE_CUDA)
3131
# UserLogPot.cc UserMNdisk.cc UserMW.cc UserTest.cc UserTestCuda.cc
3232
# PROPERTIES LANGUAGE CUDA)
3333
set(cudatest_SRC UserTestCuda.cc cudaUserTest.cu)
34-
list(APPEND barSRC cudaUserBar.cu)
34+
list(APPEND bar_SRC cudaUserBar.cu)
3535
endif()
3636

3737
foreach(mlib ${USER_MODULES})

src/user/UserBar.H

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class UserBar : public ExternalForce
2424
{
2525
private:
2626

27-
string angm_name, ctr_name;
27+
std::string angm_name, ctr_name;
2828
Component *c0, *c1;
2929

3030
void determine_acceleration_and_potential(void);

src/user/cudaUserBar.cu

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <cudaReduce.cuH>
55

66
#include <Component.H>
7-
#include "UserSat.H"
7+
#include "UserBar.H"
88

99
// Global device symbols for CUDA kernel
1010
//
@@ -55,13 +55,13 @@ userBarForceKernel(dArray<cudaParticle> P, dArray<int> I,
5555
cuFP_t pp = (xx*xx - yy*yy)*cos2p + 2.0*xx*yy*sin2p;
5656

5757
if (userBarSoft) {
58-
fac = 1.0 + rr/b5;
58+
fac = 1.0 + rr/userBarB5;
5959
ffac = -userBarAmp / pow(fac, 6.0);
60-
nn = pp / (b5*rr);
60+
nn = pp / (userBarB5*rr);
6161
} else {
62-
fac = 1.0 + pow(rr/b5, 5.0);
62+
fac = 1.0 + pow(rr/userBarB5, 5.0);
6363
ffac = -userBarAmp / (fac*fac);
64-
nn = pp * pow(rr/b5, 3.0)/ (b5*b5);
64+
nn = pp * pow(rr/userBarB5, 3.0)/ (userBarB5*userBarB5);
6565
}
6666

6767
// Add acceleration
@@ -80,14 +80,13 @@ userBarForceKernel(dArray<cudaParticle> P, dArray<int> I,
8080

8181

8282
__global__
83-
void testConstantsUserSat(cuFP_t tnow)
83+
void testConstantsUserBar(cuFP_t tnow)
8484
{
8585
printf("-------------------------\n");
86-
printf("---UserSat constants-----\n");
86+
printf("---UserBar constants-----\n");
8787
printf("-------------------------\n");
8888
printf(" Time = %e\n", tnow );
8989
printf(" Amp = %e\n", userBarAmp );
90-
printf(" Amp = %e\n", userBarNumFac );
9190
printf(" b5 = %e\n", userBarB5 );
9291
printf(" Center = %e, %e, %e\n",
9392
userBarCen[0], userBarCen[1], userBarCen[2] );
@@ -96,26 +95,17 @@ void testConstantsUserSat(cuFP_t tnow)
9695
printf("-------------------------\n");
9796
}
9897

99-
void UserBar::determine_acceration_and_potential_cuda()
98+
void UserBar::determine_acceleration_and_potential_cuda()
10099
{
101100
// Sanity check
102101
//
103102
int nbodies = cC->Number();
104103
if (nbodies != static_cast<int>(cC->Particles().size())) {
105-
std::cerr << "UserSat: ooops! number=" << nbodies
104+
std::cerr << "UserBar: ooops! number=" << nbodies
106105
<< " but particle size=" << cC->Particles().size() << endl;
107106
nbodies = static_cast<int>(cC->Particles().size());
108107
}
109108

110-
if (nbodies==0) { // Return if there are no particles
111-
if (verbose) {
112-
cout << "Process " << myid << ": in UserBar, nbodies=0"
113-
<< " for Component <" << cC->name << "> at T=" << tnow
114-
<< endl;
115-
}
116-
return;
117-
}
118-
119109
double amp = afac * numfac * amplitude/fabs(amplitude)
120110
* 0.5*(1.0 + erf( (tnow - Ton )/DeltaT ))
121111
* 0.5*(1.0 - erf( (tnow - Toff)/DeltaT )) ;
@@ -134,8 +124,6 @@ void UserBar::determine_acceration_and_potential_cuda()
134124
cuFP_t ctr[3], dtmp;
135125
for (int k=0; k<3; k++) ctr[k] = cn[k];
136126

137-
cuFP_t dtmp;
138-
139127
cuda_safe_call(cudaMemcpyToSymbol(userBarAmp, &(dtmp=amp), sizeof(cuFP_t),
140128
size_t(0), cudaMemcpyHostToDevice),
141129
__FILE__, __LINE__, "Error copying userBarAmp");

0 commit comments

Comments
 (0)