From 13241c7dcbd6f45bb2093d1e64f5c7964a18d067 Mon Sep 17 00:00:00 2001 From: Bruce J Palmer Date: Fri, 1 Dec 2023 09:56:11 -0800 Subject: [PATCH] Fixed up some problems so that code compiles on GPUs. --- src/chemistry/bmx_chem_K.H | 8 ++++---- src/des/bmx_pc.cpp | 4 ++-- src/des/bmx_pc_fusion.cpp | 2 ++ src/des/bmx_split_particles.cpp | 3 +-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/chemistry/bmx_chem_K.H b/src/chemistry/bmx_chem_K.H index 5982464..df6641a 100644 --- a/src/chemistry/bmx_chem_K.H +++ b/src/chemistry/bmx_chem_K.H @@ -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]); @@ -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 + } } /** @@ -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, @@ -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], diff --git a/src/des/bmx_pc.cpp b/src/des/bmx_pc.cpp index b50b152..53987fd 100644 --- a/src/des/bmx_pc.cpp +++ b/src/des/bmx_pc.cpp @@ -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); }); @@ -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)); }); diff --git a/src/des/bmx_pc_fusion.cpp b/src/des/bmx_pc_fusion.cpp index b08d23c..305624e 100644 --- a/src/des/bmx_pc_fusion.cpp +++ b/src/des/bmx_pc_fusion.cpp @@ -425,8 +425,10 @@ void BMXParticleContainer::EvaluateInteriorFusion (const Vector 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"<