Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions alpine/ExamplesWithoutPicManager/ChargedParticles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,18 @@ using FFTSolver_t = ConditionalType<Dim == 2 || Dim == 3,
ippl::FFTPeriodicPoissonSolver<VField_t<T, Dim>, Field_t<Dim>>>;

template <typename T = double, unsigned Dim = 3>
using FFTTruncatedGreenSolver_t = ConditionalType<Dim == 3, ippl::FFTTruncatedGreenPeriodicPoissonSolver<VField_t<T, Dim>, Field_t<Dim>>>;
using FFTTruncatedGreenSolver_t =
ConditionalType<Dim == 3,
ippl::FFTTruncatedGreenPeriodicPoissonSolver<VField_t<T, Dim>, Field_t<Dim>>>;

template <typename T = double, unsigned Dim = 3>
using OpenSolver_t =
ConditionalType<Dim == 3, ippl::FFTOpenPoissonSolver<VField_t<T, Dim>, Field_t<Dim>>>;

template <typename T = double, unsigned Dim = 3>
using Solver_t = VariantFromConditionalTypes<CGSolver_t<T, Dim>, FFTSolver_t<T, Dim>,
FFTTruncatedGreenSolver_t<T, Dim>, OpenSolver_t<T, Dim>>;
using Solver_t =
VariantFromConditionalTypes<CGSolver_t<T, Dim>, FFTSolver_t<T, Dim>,
FFTTruncatedGreenSolver_t<T, Dim>, OpenSolver_t<T, Dim>>;

const double pi = Kokkos::numbers::pi_v<double>;

Expand Down Expand Up @@ -652,13 +655,13 @@ class ChargedParticles : public ippl::ParticleBase<PLayout> {
ippl::Comm->barrier();
}

typename VField_t<T, Dim>::HostMirror getEMirror() const {
typename VField_t<T, Dim>::host_mirror_type getEMirror() const {
auto Eview = E_m.getHostMirror();
updateEMirror(Eview);
return Eview;
}

void updateEMirror(typename VField_t<T, Dim>::HostMirror& mirror) const {
void updateEMirror(typename VField_t<T, Dim>::host_mirror_type& mirror) const {
Kokkos::deep_copy(mirror, E_m.getView());
}

Expand Down Expand Up @@ -770,8 +773,10 @@ class ChargedParticles : public ippl::ParticleBase<PLayout> {
}

void dumpParticleData() {
typename ParticleAttrib<Vector_t<T, Dim>>::HostMirror R_host = this->R.getHostMirror();
typename ParticleAttrib<Vector_t<T, Dim>>::HostMirror P_host = this->P.getHostMirror();
typename ParticleAttrib<Vector_t<T, Dim>>::host_mirror_type R_host =
this->R.getHostMirror();
typename ParticleAttrib<Vector_t<T, Dim>>::host_mirror_type P_host =
this->P.getHostMirror();
Kokkos::deep_copy(R_host, this->R.getView());
Kokkos::deep_copy(P_host, P.getView());
std::stringstream pname;
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/BasicsFFT.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ field_type_complex fieldOutput(meshOutput, layoutOutput);

// Fill Field fieldInput with random numbers
typename field_type_real::view_type& view = fieldInput.getView();
typename field_type_real::HostMirror fieldInput_host = fieldInput.getHostMirror();
typename field_type_real::host_mirror_type fieldInput_host = fieldInput.getHostMirror();

const int nghost = fieldInput.getNghost();
std::mt19937_64 eng(42 + ippl::Comm->rank());
Expand Down
4 changes: 2 additions & 2 deletions src/Field/BareField.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace ippl {
using view_type = typename detail::ViewType<T, Dim, ViewArgs...>::view_type;
typedef typename view_type::memory_space memory_space;
typedef typename view_type::execution_space execution_space;
using HostMirror = typename view_type::host_mirror_type;
using host_mirror_type = typename view_type::host_mirror_type;
template <class... PolicyArgs>
using policy_type = typename RangePolicy<Dim, PolicyArgs...>::policy_type;

Expand Down Expand Up @@ -170,7 +170,7 @@ namespace ippl {

const view_type& getView() const { return dview_m; }

HostMirror getHostMirror() const { return Kokkos::create_mirror(dview_m); }
host_mirror_type getHostMirror() const { return Kokkos::create_mirror(dview_m); }

/*!
* Generate the range policy for iterating over the field,
Expand Down
8 changes: 4 additions & 4 deletions src/Particle/ParticleAttrib.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace ippl {

using view_type = typename detail::ViewType<T, 1, Properties...>::view_type;

using HostMirror = typename view_type::host_mirror_type;
using host_mirror_type = typename view_type::host_mirror_type;

using memory_space = typename view_type::memory_space;
using execution_space = typename view_type::execution_space;
Expand Down Expand Up @@ -87,7 +87,7 @@ namespace ippl {
void realloc(size_type n) { Kokkos::realloc(dview_m, n); }

void print() {
HostMirror hview = Kokkos::create_mirror_view(dview_m);
host_mirror_type hview = Kokkos::create_mirror_view(dview_m);
Kokkos::deep_copy(hview, dview_m);
for (size_type i = 0; i < *(this->localNum_mp); ++i) {
std::cout << hview(i) << std::endl;
Expand All @@ -100,8 +100,8 @@ namespace ippl {

const view_type& getView() const { return dview_m; }

HostMirror getHostMirror() const { return Kokkos::create_mirror(dview_m); }
host_mirror_type getHostMirror() const { return Kokkos::create_mirror(dview_m); }

void set_name(const std::string& name_) override {
size_t len = name_.size();
if (len >= detail::ATTRIB_NAME_MAX_LEN) {
Expand Down
2 changes: 1 addition & 1 deletion src/Utility/ViewUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ namespace ippl {
void write(const typename ViewType<T, Dim, Properties...>::view_type& view,
std::ostream& out = std::cout) {
using view_type = typename ViewType<T, Dim, Properties...>::view_type;
typename view_type::HostMirror hview = Kokkos::create_mirror_view(view);
typename view_type::host_mirror_type hview = Kokkos::create_mirror_view(view);
Kokkos::deep_copy(hview, view);

nestedViewLoop(
Expand Down
4 changes: 2 additions & 2 deletions test/FFT/TestCos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ int main(int argc, char* argv[]) {

fft = std::make_unique<FFT_type>(layout, fftParams);

typename field_type::view_type& view = field.getView();
typename field_type::HostMirror field_host = field.getHostMirror();
typename field_type::view_type& view = field.getView();
typename field_type::host_mirror_type field_host = field.getHostMirror();

const int nghost = field.getNghost();
std::mt19937_64 eng(42 + ippl::Comm->rank());
Expand Down
4 changes: 2 additions & 2 deletions test/FFT/TestCos1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ int main(int argc, char* argv[]) {

fft = std::make_unique<FFT_type>(layout, fftParams);

typename field_type::view_type& view = field.getView();
typename field_type::HostMirror field_host = field.getHostMirror();
typename field_type::view_type& view = field.getView();
typename field_type::host_mirror_type field_host = field.getHostMirror();

const int nghost = field.getNghost();
std::mt19937_64 eng(42 + ippl::Comm->rank());
Expand Down
4 changes: 2 additions & 2 deletions test/FFT/TestFFTCC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ int main(int argc, char* argv[]) {

fft = std::make_unique<FFT_type>(layout, fftParams);

typename field_type::view_type& view = field.getView();
typename field_type::HostMirror field_host = field.getHostMirror();
typename field_type::view_type& view = field.getView();
typename field_type::host_mirror_type field_host = field.getHostMirror();

const int nghost = field.getNghost();
std::mt19937_64 engReal(42 + ippl::Comm->rank());
Expand Down
4 changes: 2 additions & 2 deletions test/FFT/TestFFTRC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ int main(int argc, char* argv[]) {

fft = std::make_unique<FFT_type>(layoutInput, layoutOutput, fftParams);

typename field_type_real::view_type& view = fieldInput.getView();
typename field_type_real::HostMirror fieldInput_host = fieldInput.getHostMirror();
typename field_type_real::view_type& view = fieldInput.getView();
typename field_type_real::host_mirror_type fieldInput_host = fieldInput.getHostMirror();

const int nghost = fieldInput.getNghost();
std::mt19937_64 eng(42 + ippl::Comm->rank());
Expand Down
4 changes: 2 additions & 2 deletions test/FFT/TestSine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ int main(int argc, char* argv[]) {

fft = std::make_unique<FFT_type>(layout, fftParams);

typename field_type::view_type& view = field.getView();
typename field_type::HostMirror field_host = field.getHostMirror();
typename field_type::view_type& view = field.getView();
typename field_type::host_mirror_type field_host = field.getHostMirror();

const int nghost = field.getNghost();
std::mt19937_64 eng(42 + ippl::Comm->rank());
Expand Down
12 changes: 4 additions & 8 deletions test/kokkos/TestVectorField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,12 @@ int main(int argc, char* argv[]) {
vector_field_type vfield("vfield", length);

Kokkos::parallel_for(
"assign", length, KOKKOS_LAMBDA(const int i) {
vfield(i) = {1.0, 2.0, 3.0};
});
"assign", length, KOKKOS_LAMBDA(const int i) { vfield(i) = {1.0, 2.0, 3.0}; });

vector_field_type wfield("wfield", length);

Kokkos::parallel_for(
"assign", length, KOKKOS_LAMBDA(const int i) {
wfield(i) = {4.0, -5.0, 6.0};
});
"assign", length, KOKKOS_LAMBDA(const int i) { wfield(i) = {4.0, -5.0, 6.0}; });

vector_field_type vvfield("vvfield", length);
Kokkos::parallel_for(
Expand All @@ -215,7 +211,7 @@ int main(int argc, char* argv[]) {

Kokkos::fence();

vector_field_type::HostMirror host_view = Kokkos::create_mirror_view(vvfield);
vector_field_type::host_mirror_type host_view = Kokkos::create_mirror_view(vvfield);
Kokkos::deep_copy(host_view, vvfield);

for (int i = 0; i < length; ++i) {
Expand All @@ -232,7 +228,7 @@ int main(int argc, char* argv[]) {

Kokkos::fence();

scalar_field_type::HostMirror host_sview = Kokkos::create_mirror_view(sfield);
scalar_field_type::host_mirror_type host_sview = Kokkos::create_mirror_view(sfield);
Kokkos::deep_copy(host_sview, sfield);

for (int i = 0; i < length; ++i) {
Expand Down
12 changes: 4 additions & 8 deletions test/kokkos/TestVectorField2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ int main(int argc, char* argv[]) {
vector_field_type vfield("vfield", length);

Kokkos::parallel_for(
"assign", length, KOKKOS_LAMBDA(const int i) {
vfield(i) = {1.0, 2.0, 3.0};
});
"assign", length, KOKKOS_LAMBDA(const int i) { vfield(i) = {1.0, 2.0, 3.0}; });

vector_field_type wfield("wfield", length);

Kokkos::parallel_for(
"assign", length, KOKKOS_LAMBDA(const int i) {
wfield(i) = {4.0, -5.0, 6.0};
});
"assign", length, KOKKOS_LAMBDA(const int i) { wfield(i) = {4.0, -5.0, 6.0}; });

vector_field_type vvfield("vvfield", length);
Kokkos::parallel_for(
Expand All @@ -36,7 +32,7 @@ int main(int argc, char* argv[]) {

Kokkos::fence();

vector_field_type::HostMirror host_view = Kokkos::create_mirror_view(vvfield);
vector_field_type::host_mirror_type host_view = Kokkos::create_mirror_view(vvfield);
Kokkos::deep_copy(host_view, vvfield);

for (int i = 0; i < length; ++i) {
Expand All @@ -53,7 +49,7 @@ int main(int argc, char* argv[]) {

Kokkos::fence();

scalar_field_type::HostMirror host_sview = Kokkos::create_mirror_view(sfield);
scalar_field_type::host_mirror_type host_sview = Kokkos::create_mirror_view(sfield);
Kokkos::deep_copy(host_sview, sfield);

for (int i = 0; i < length; ++i) {
Expand Down
14 changes: 6 additions & 8 deletions test/kokkos/TestVectorField3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ int main(int argc, char* argv[]) {
using mdrange_t = Kokkos::MDRangePolicy<Kokkos::Rank<2>>;

Kokkos::parallel_for(
"assign", mdrange_t({0, 0}, {length, length}), KOKKOS_LAMBDA(const int i, const int j) {
vfield(i, j) = {1.0, 2.0, 3.0};
});
"assign", mdrange_t({0, 0}, {length, length}),
KOKKOS_LAMBDA(const int i, const int j) { vfield(i, j) = {1.0, 2.0, 3.0}; });

vector_field_type wfield("wfield", length, length);

Kokkos::parallel_for(
"assign", mdrange_t({0, 0}, {length, length}), KOKKOS_LAMBDA(const int i, const int j) {
wfield(i, j) = {4.0, -5.0, 6.0};
});
"assign", mdrange_t({0, 0}, {length, length}),
KOKKOS_LAMBDA(const int i, const int j) { wfield(i, j) = {4.0, -5.0, 6.0}; });

vector_field_type vvfield("vvfield", length, length);
Kokkos::parallel_for(
Expand All @@ -39,7 +37,7 @@ int main(int argc, char* argv[]) {

Kokkos::fence();

vector_field_type::HostMirror host_view = Kokkos::create_mirror_view(vvfield);
vector_field_type::host_mirror_type host_view = Kokkos::create_mirror_view(vvfield);
Kokkos::deep_copy(host_view, vvfield);

for (int i = 0; i < length; ++i) {
Expand All @@ -60,7 +58,7 @@ int main(int argc, char* argv[]) {

Kokkos::fence();

scalar_field_type::HostMirror host_sview = Kokkos::create_mirror_view(sfield);
scalar_field_type::host_mirror_type host_sview = Kokkos::create_mirror_view(sfield);
Kokkos::deep_copy(host_sview, sfield);

for (int i = 0; i < length; ++i) {
Expand Down
4 changes: 2 additions & 2 deletions test/kokkos/TestVectorField4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int main(int argc, char* argv[]) {

Kokkos::fence();

vector_field_type::HostMirror host_view = Kokkos::create_mirror_view(vvfield);
vector_field_type::host_mirror_type host_view = Kokkos::create_mirror_view(vvfield);
Kokkos::deep_copy(host_view, vvfield);

for (int i = 0; i < length; ++i) {
Expand All @@ -67,7 +67,7 @@ int main(int argc, char* argv[]) {

Kokkos::fence();

scalar_field_type::HostMirror host_sview = Kokkos::create_mirror_view(sfield);
scalar_field_type::host_mirror_type host_sview = Kokkos::create_mirror_view(sfield);
Kokkos::deep_copy(host_sview, sfield);

for (int i = 0; i < length; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion test/particle/PICnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class ChargedParticles : public ippl::ParticleBase<PLayout> {
// 0 -> gridpoints
void initPositions(FieldLayout_t& fl, Vector_t& hr, unsigned int nloc, int tag = 2) {
Inform m("initPositions ");
typename ippl::ParticleBase<PLayout>::particle_position_type::HostMirror R_host =
typename ippl::ParticleBase<PLayout>::particle_position_type::host_mirror_type R_host =
this->R.getHostMirror();

std::mt19937_64 eng[Dim];
Expand Down
10 changes: 6 additions & 4 deletions test/particle/TestGather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ int main(int argc, char* argv[]) {
std::mt19937_64 eng;
std::uniform_real_distribution<double> unif(0, 1);

typename bunch_type::particle_position_type::HostMirror R_host = bunch.R.getHostMirror();
typename bunch_type::charge_container_type::HostMirror Q_host = bunch.Q.getHostMirror();
typename bunch_type::particle_position_type::host_mirror_type R_host =
bunch.R.getHostMirror();
typename bunch_type::charge_container_type::host_mirror_type Q_host =
bunch.Q.getHostMirror();
for (int i = 0; i < n; ++i) {
ippl::Vector<double, 3> r = {unif(eng), unif(eng), unif(eng)};
R_host(i) = r;
Expand All @@ -72,11 +74,11 @@ int main(int argc, char* argv[]) {

msg << "Testing addToAttribute=false. Expected output: 1" << endl;
gather(bunch.Q, field, bunch.R);

// Should printout 1.0 for each particle
bunch.Q.print();

ippl::Comm->barrier(); // so output of 1 and 2 is separated
ippl::Comm->barrier(); // so output of 1 and 2 is separated

msg << "Testing addToAttribute=true. Expected output: 2" << endl;
gather(bunch.Q, field, bunch.R, true);
Expand Down
Loading