Skip to content

Commit

Permalink
Fixed up some problems so that code compiles on GPUs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruce J Palmer committed Dec 1, 2023
1 parent facc44a commit 13241c7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/chemistry/bmx_chem_K.H
Original file line number Diff line number Diff line change
Expand Up @@ -2225,11 +2225,11 @@ void xferMeshToParticleAndUpdateChem(Real grid_vol, Real npart,
p_vals[3] = p_vals[8];
p_vals[4] = p_vals[9];

#if 0
if (p_vals[1] > 1.0e-7) {
printf("UPDATE Concentration B: %e id: %d cpu: %d\n",p_vals[1],
cell_ipar[intIdx::id],cell_ipar[intIdx::cpu]);
}
#if 0
printf(" Final concentration increment for A: %16.8e\n",p_vals[6]);
printf(" Final concentration increment for B: %16.8e\n",p_vals[7]);
printf(" Final concentration increment for C: %16.8e\n",p_vals[8]);
Expand Down Expand Up @@ -2404,8 +2404,8 @@ applyIncrements(Real *par, int *ipar)
if (cnc[2] < 0.0) {
printf("Post xchng C1: %e pre xchng C0: %e\n",cnc[2],cC0);
}
}
#endif
}
}

/**
Expand All @@ -2421,7 +2421,7 @@ applyIncrements(Real *par, int *ipar)
* @param id1, cpu1, id2, cpu2, ID and cpu of new segments
* @param engine object for implementing random number generator
*/
AMREX_GPU_HOST_DEVICE AMREX_INLINE
AMREX_GPU_HOST_DEVICE AMREX_INLINE
void
setNewSegments(Real *pos_orig, Real *pos_new1, Real *pos_new2,
Real *par_orig, Real *par_new1, Real *par_new2,
Expand Down Expand Up @@ -2774,12 +2774,12 @@ setNewSegments(Real *pos_orig, Real *pos_new1, Real *pos_new2,
printf("After split old segment n_bnds: %d\n",ipar_orig[intIdx::n_bnds]);
printf("OLD id: %d cpu: %d nbnds: %d id1: %d cpu1: %d id2: %d cpu2: %d"
" id3: %d cpu3: %d id4: %d cpu4: %d\n",
#endif
ipar_orig[intIdx::id],ipar_orig[intIdx::cpu],ipar_orig[intIdx::n_bnds],
ipar_orig[intIdx::seg1_id1],ipar_orig[intIdx::seg1_id2],
ipar_orig[intIdx::seg2_id1],ipar_orig[intIdx::seg2_id2],
ipar_orig[intIdx::seg3_id1],ipar_orig[intIdx::seg3_id2],
ipar_orig[intIdx::seg4_id1],ipar_orig[intIdx::seg4_id2]);
#endif
#if 0
printf("Old seg id: %d cpu %d site1: %d id1: %d cpu1: %d site2: %d id2: %d cpu2: %d site3: %d id3: %d cpu3: %d\n",
ipar_orig[intIdx::id],ipar_orig[intIdx::cpu],
Expand Down
4 changes: 2 additions & 2 deletions src/des/bmx_pc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Real
BMXParticleContainer::computeParticleVolume () const
{
auto r = amrex::ReduceSum(*this, [=]
AMREX_GPU_HOST_DEVICE (const ParticleType& p) noexcept -> amrex::Real
AMREX_GPU_HOST_DEVICE (const ParticleType& p) // noexcept -> amrex::Real
{
return p.rdata(realIdx::vol);
});
Expand All @@ -109,7 +109,7 @@ Real
BMXParticleContainer::computeParticleContent (int comp) const
{
auto r = amrex::ReduceSum(*this, [=]
AMREX_GPU_HOST_DEVICE (const ParticleType& p) noexcept -> amrex::Real
AMREX_GPU_HOST_DEVICE (const ParticleType& p) // noexcept -> amrex::Real
{
return (p.rdata(realIdx::vol) * p.rdata(comp));
});
Expand Down
2 changes: 2 additions & 0 deletions src/des/bmx_pc_fusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,10 @@ void BMXParticleContainer::EvaluateInteriorFusion (const Vector<MultiFab*> cost,
} else if (do_split_p[pid] > 1) {
//TODO: Simultaneous fusion happened. We don't know how to
//handle this.
#ifndef AMREX_USE_GPU
std::cout<<"Simultaneous fusion event happened. We cannot"
" handle this situation"<<std::endl;
#endif
} else {
int *ipar_orig = &p_orig.idata(0);
ipar_orig[intIdx::split_flag] = 0;
Expand Down
3 changes: 1 addition & 2 deletions src/des/bmx_split_particles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ BMXParticleContainer::split_particles (Real /*time*/)
next_pid = ParticleType::NextID();
ParticleType::NextID(next_pid+num_split);
}
Real split_len = SPECIES::split_len;

// Fill new particle data. If particle pid is split, the new particle
// is at index np + poffsets[pid];
Expand Down Expand Up @@ -114,7 +115,6 @@ BMXParticleContainer::split_particles (Real /*time*/)
par_new, ipar_orig, ipar_new,
l_overlap, l_num_reals, l_num_ints, engine);
} else {
Real split_len = SPECIES::split_len;
setNewSegment(pos_orig, pos_new, par_orig,
par_new, ipar_orig, ipar_new,
l_num_reals, l_num_ints, split_len,
Expand Down Expand Up @@ -150,7 +150,6 @@ BMXParticleContainer::split_particles (Real /*time*/)
int *ipar_new1 = &p1.idata(0);
int *ipar_new2 = &p2.idata(0);

Real split_len = SPECIES::split_len;
setNewSegments(pos_orig, pos_new1, pos_new2,
par_orig, par_new1, par_new2,
ipar_orig, ipar_new1, ipar_new2,
Expand Down

0 comments on commit 13241c7

Please sign in to comment.