Skip to content

Commit

Permalink
fixup: device_type -> memory_space
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve committed Nov 8, 2023
1 parent 41e71bd commit 440a76d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/ParticleActions.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void ParticleActions::setParticles(Particles *P_)

// Stream
void ParticleActions::updatePos(\
Cabana::AoSoA<HACCabana::Particles::data_types, device_type, VECTOR_LENGTH> aosoa_device,\
Cabana::AoSoA<HACCabana::Particles::data_types, device_mem, VECTOR_LENGTH> aosoa_device,\
float prefactor)
{
auto position = Cabana::slice<HACCabana::Particles::Fields::Position>(aosoa_device, "position");
Expand All @@ -63,8 +63,8 @@ void ParticleActions::updatePos(\

// Kick
void ParticleActions::updateVel(\
Cabana::AoSoA<HACCabana::Particles::data_types, device_type, VECTOR_LENGTH> aosoa_device,\
Cabana::LinkedCellList<device_type> cell_list,\
Cabana::AoSoA<HACCabana::Particles::data_types, device_mem, VECTOR_LENGTH> aosoa_device,\
Cabana::LinkedCellList<device_mem> cell_list,\
const float c, const float rmax2, const float rsm2)
{
auto position = Cabana::slice<HACCabana::Particles::Fields::Position>(aosoa_device, "position");
Expand Down Expand Up @@ -140,7 +140,7 @@ void ParticleActions::subCycle(TimeStepper &ts, const int nsub, const float gpsc
const float cm_size, const float min_pos, const float max_pos)
{
// copy particles to GPU
Cabana::AoSoA<HACCabana::Particles::data_types, device_type, VECTOR_LENGTH> aosoa_device("aosoa_device", P->num_p);
Cabana::AoSoA<HACCabana::Particles::data_types, device_mem, VECTOR_LENGTH> aosoa_device("aosoa_device", P->num_p);
Cabana::deep_copy(aosoa_device, P->aosoa_host);

// create the cell list on the GPU
Expand All @@ -154,7 +154,7 @@ void ParticleActions::subCycle(TimeStepper &ts, const int nsub, const float gpsc
float grid_max[3] = {x_max, x_max, x_max};

auto position = Cabana::slice<HACCabana::Particles::Fields::Position>(aosoa_device, "position");
Cabana::LinkedCellList<device_type> cell_list(position, P->begin, P->end, grid_delta, grid_min, grid_max);
Cabana::LinkedCellList<device_mem> cell_list(position, P->begin, P->end, grid_delta, grid_min, grid_max);
Cabana::permute(cell_list, aosoa_device);
Kokkos::fence();

Expand Down
8 changes: 3 additions & 5 deletions src/ParticleActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,17 @@ namespace HACCabana
public:
using device_exec = Kokkos::DefaultExecutionSpace::execution_space;
using device_mem = Kokkos::DefaultExecutionSpace::memory_space;
using device_type = Kokkos::Device<device_exec, device_mem>;
//using device_scratch = Kokkos::ScratchMemorySpace<device_exec>;

ParticleActions();
ParticleActions(Particles *P_);
~ParticleActions();
void setParticles(Particles *P_);
void subCycle(TimeStepper &ts, const int nsub, const float gpscal, const float rmax2, const float rsm2,\
const float cm_size, const float min_pos, const float max_pos);
void updatePos(Cabana::AoSoA<HACCabana::Particles::data_types, device_type, VECTOR_LENGTH> aosoa_device,\
void updatePos(Cabana::AoSoA<HACCabana::Particles::data_types, device_mem, VECTOR_LENGTH> aosoa_device,\
float prefactor);
void updateVel(Cabana::AoSoA<HACCabana::Particles::data_types, device_type, VECTOR_LENGTH> aosoa_device,\
Cabana::LinkedCellList<device_type> cell_list,\
void updateVel(Cabana::AoSoA<HACCabana::Particles::data_types, device_mem, VECTOR_LENGTH> aosoa_device,\
Cabana::LinkedCellList<device_mem> cell_list,\
const float c, const float rmax2, const float rsm2);
};
}
Expand Down

0 comments on commit 440a76d

Please sign in to comment.