diff --git a/CMakeLists.txt b/CMakeLists.txt index e88b5e850..2d8ab9e0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ if(PSC_GPU STREQUAL "cuda") set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}") enable_language(CUDA) - find_package(Thrust 1.10.0 REQUIRED) + find_package(Thrust REQUIRED) thrust_create_target(Thrust) set(USE_CUDA ON) elseif(PSC_GPU STREQUAL "hip") diff --git a/src/libpsc/cuda/checks_cuda_impl.hxx b/src/libpsc/cuda/checks_cuda_impl.hxx index d27278506..f38bb98b9 100644 --- a/src/libpsc/cuda/checks_cuda_impl.hxx +++ b/src/libpsc/cuda/checks_cuda_impl.hxx @@ -5,4 +5,4 @@ template using ChecksCuda = - ChecksCommon>; + ChecksCommon>; diff --git a/src/libpsc/cuda/fields_item_moments_1st_cuda.hxx b/src/libpsc/cuda/fields_item_moments_1st_cuda.hxx index 4ef691f0b..1ddeb029f 100644 --- a/src/libpsc/cuda/fields_item_moments_1st_cuda.hxx +++ b/src/libpsc/cuda/fields_item_moments_1st_cuda.hxx @@ -17,6 +17,7 @@ class moment_rho_1st_nc_cuda { public: using dim_t = D; + static const centering::Centering CENTERING = centering::NC; static std::string name() { return "rho_1st_nc"; } static std::vector comp_names(const Grid_t::Kinds& kinds) @@ -42,6 +43,7 @@ class moment_n_1st_cc_cuda { public: using dim_t = D; + static const centering::Centering CENTERING = centering::CC; static std::string name() { return "n_1st_cc"; } static std::vector comp_names(const Grid_t::Kinds& kinds) @@ -67,6 +69,7 @@ class moments_1st_cc_cuda { public: using dim_t = D; + static const centering::Centering CENTERING = centering::CC; static std::string name() { return "all_1st_cc"; } static std::vector comp_names(const Grid_t::Kinds& kinds) diff --git a/src/libpsc/cuda/mparticles_cuda.hxx b/src/libpsc/cuda/mparticles_cuda.hxx index f784955db..dca3ee237 100644 --- a/src/libpsc/cuda/mparticles_cuda.hxx +++ b/src/libpsc/cuda/mparticles_cuda.hxx @@ -46,6 +46,7 @@ struct MparticlesCuda : MparticlesBase } int size() const override { return cmprts_->size(); } + int size(int p) const { return cmprts_->sizeByPatch()[p]; } std::vector sizeByPatch() const override { diff --git a/src/libpsc/cuda/psc_particles_cuda.cxx b/src/libpsc/cuda/psc_particles_cuda.cxx index 641189d9c..ecf8d4ed9 100644 --- a/src/libpsc/cuda/psc_particles_cuda.cxx +++ b/src/libpsc/cuda/psc_particles_cuda.cxx @@ -53,7 +53,7 @@ static void copy_to(MparticlesBase& mprts_base, for (auto prt : accessor[p]) { using real_t = typename MP::real_t; using Real3 = typename MP::Real3; - mprts_other[p].push_back({Real3(prt.x()), Real3(prt.u()), + mprts_other.push_back(p, {Real3(prt.x()), Real3(prt.u()), real_t(prt.qni_wni()), prt.kind(), prt.id(), prt.tag()}); } diff --git a/src/libpsc/psc_output_particles/output_particles_hdf5_impl.hxx b/src/libpsc/psc_output_particles/output_particles_hdf5_impl.hxx index a698a0b7d..a1b41cda8 100644 --- a/src/libpsc/psc_output_particles/output_particles_hdf5_impl.hxx +++ b/src/libpsc/psc_output_particles/output_particles_hdf5_impl.hxx @@ -612,7 +612,6 @@ struct OutputParticlesHdf5 void operator()(Mparticles& mprts, OutputParticlesWriterHDF5& writer) { const Grid_t& grid = mprts.grid(); - herr_t ierr; static int pr_A, pr_B, pr_C; if (!pr_A) { @@ -786,7 +785,8 @@ public: void perform_diagnostic(Mparticles& mprts) override { (*this)(mprts); } - void operator()(Mparticles& mprts) + template + void operator()(_Mparticles& mprts) { const auto& grid = mprts.grid(); @@ -794,8 +794,8 @@ public: return; } - detail::OutputParticlesHdf5 impl{grid, - params_}; + detail::OutputParticlesHdf5<_Mparticles, ParticleSelector> impl{grid, + params_}; impl(mprts, writer_); } diff --git a/src/libpsc/psc_push_particles/inc_curr.cxx b/src/libpsc/psc_push_particles/inc_curr.cxx index 781335e05..34d1f5d54 100644 --- a/src/libpsc/psc_push_particles/inc_curr.cxx +++ b/src/libpsc/psc_push_particles/inc_curr.cxx @@ -18,7 +18,7 @@ GT_INLINE void deposit(Curr& curr, const int _i[3], const real_t fnqs[3], { psc::CurrentDeposition1vb deposition{{fnqs[0], fnqs[1], fnqs[2]}}; - int i[3]; + Int3 i; for (int d = 0; d < 3; d++) { i[d] = _i[d] + off[d]; } diff --git a/src/psc_flatfoil_yz.cxx b/src/psc_flatfoil_yz.cxx index 34eb008d4..ab91ebeee 100644 --- a/src/psc_flatfoil_yz.cxx +++ b/src/psc_flatfoil_yz.cxx @@ -436,11 +436,11 @@ void run() // fix up renumbered particle kind auto& mp = mprts.template get_as(); for (int p = 0; p < mp.n_patches(); p++) { - for (int n = 0; n < mprts.size(p); n++) { - if (mprts.at(p, n).kind == 0) { - mprts.at(p, n).kind = MY_ION; - } else if (mprts.at(p, n).kind == 1) { - mprts.at(p, n).kind = MY_ELECTRON; + for (int n = 0; n < mp.size(p); n++) { + if (mp.at(p, n).kind == 0) { + mp.at(p, n).kind = MY_ION; + } else if (mp.at(p, n).kind == 1) { + mp.at(p, n).kind = MY_ELECTRON; } else { assert(0); }