Skip to content

Commit 4b37d42

Browse files
committed
replace HostMirror deprecation in kokkos5
1 parent 4f7c657 commit 4b37d42

5 files changed

Lines changed: 26 additions & 26 deletions

File tree

doc/source/programmingguide.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -355,31 +355,31 @@ fills the following arrays (essentially grid information) with data from its par
355355

356356
.. code-block:: c++
357357

358-
IdefixArray1D<real>::HostMirror x[3]; // geometrical central points
359-
IdefixArray1D<real>::HostMirror xr[3]; // cell right interface
360-
IdefixArray1D<real>::HostMirror xl[3]; // cell left interface
361-
IdefixArray1D<real>::HostMirror dx[3]; // cell width
358+
IdefixArray1D<real>::host_mirror_type x[3]; // geometrical central points
359+
IdefixArray1D<real>::host_mirror_type xr[3]; // cell right interface
360+
IdefixArray1D<real>::host_mirror_type xl[3]; // cell left interface
361+
IdefixArray1D<real>::host_mirror_type dx[3]; // cell width
362362

363-
IdefixArray3D<real>::HostMirror dV; // cell volume
364-
IdefixArray3D<real>::HostMirror A[3]; // cell right interface area
363+
IdefixArray3D<real>::host_mirror_type dV; // cell volume
364+
IdefixArray3D<real>::host_mirror_type A[3]; // cell right interface area
365365

366366

367367
Note however that the physics arrays are not automatically synchronized when ``DataBlockHost`` is
368368
created, that is:
369369

370370
.. code-block:: c++
371371

372-
IdefixArray4D<real>::HostMirror Vc; // Main cell-centered primitive variables index
373-
IdefixArray4D<real>::HostMirror Vs; // Main face-centered primitive variables index
374-
IdefixArray4D<real>::HostMirror J; // Current (only when haveCurrent is enabled)
375-
IdefixArray4D<real>::HostMirror Uc; // Main cell-centered conservative variables
376-
IdefixArray3D<real>::HostMirror InvDt;
372+
IdefixArray4D<real>::host_mirror_type Vc; // Main cell-centered primitive variables index
373+
IdefixArray4D<real>::host_mirror_type Vs; // Main face-centered primitive variables index
374+
IdefixArray4D<real>::host_mirror_type J; // Current (only when haveCurrent is enabled)
375+
IdefixArray4D<real>::host_mirror_type Uc; // Main cell-centered conservative variables
376+
IdefixArray3D<real>::host_mirror_type InvDt;
377377

378-
IdefixArray3D<real>::HostMirror Ex1; // x1 electric field
379-
IdefixArray3D<real>::HostMirror Ex2; // x2 electric field
380-
IdefixArray3D<real>::HostMirror Ex3; // x3 electric field
378+
IdefixArray3D<real>::host_mirror_type Ex1; // x1 electric field
379+
IdefixArray3D<real>::host_mirror_type Ex2; // x2 electric field
380+
IdefixArray3D<real>::host_mirror_type Ex3; // x3 electric field
381381

382-
need to be synchronized *manually*. These IdefixArrays are all defined as ``HostMirror``, implying that they are accessible
382+
need to be synchronized *manually*. These IdefixArrays are all defined as ``host_mirror_type``, implying that they are accessible
383383
from the host only. If modifications are performed on the arrays of the
384384
parent ``DataBlock``, one can call ``DataBlockHost::SyncFromDevice()`` to refresh the host arrays,
385385
and inversely one can call ``DataBlockHost::SyncToDevice()`` to send data from ``DataBlockHost``

src/dataBlock/dumpToFile.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ void DataBlock::DumpToFile(std::string filebase) {
4545

4646

4747
// TODO(lesurg) Make datablock a friend of hydro to get the Riemann flux?
48-
//IdefixArray4D<real>::HostMirror locFlux = Kokkos::create_mirror_view(Kokkos::HostSpace(),
48+
//IdefixArray4D<real>::host_mirror_type locFlux = Kokkos::create_mirror_view(Kokkos::HostSpace(),
4949
// this->hydro->FluxRiemann);
5050
//Kokkos::deep_copy(locFlux, this->FluxRiemann);
5151
#if MHD == YES
5252

5353

54-
IdefixArray4D<real>::HostMirror locJ;
54+
IdefixArray4D<real>::host_mirror_type locJ;
5555
if(hydro->haveCurrent) {
5656
locJ = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->hydro->J);
5757
Kokkos::deep_copy(locJ, this->hydro->J);
@@ -82,7 +82,7 @@ void DataBlock::DumpToFile(std::string filebase) {
8282
fwrite (header, sizeof(char), HEADERSIZE, fileHdl);
8383

8484
// Write Vc
85-
IdefixArray4D<real>::HostMirror locVc = Kokkos::create_mirror_view(this->hydro->Vc);
85+
IdefixArray4D<real>::host_mirror_type locVc = Kokkos::create_mirror_view(this->hydro->Vc);
8686
Kokkos::deep_copy(locVc,this->hydro->Vc);
8787
dims[0] = this->np_tot[IDIR];
8888
dims[1] = this->np_tot[JDIR];
@@ -94,7 +94,7 @@ void DataBlock::DumpToFile(std::string filebase) {
9494
WriteVariable(fileHdl, 4, dims, fieldName, locVc.data());
9595

9696
if (this->gravity->haveSelfGravityPotential) {
97-
IdefixArray3D<real>::HostMirror locPot = Kokkos::create_mirror_view(this->gravity->phiP);
97+
IdefixArray3D<real>::host_mirror_type locPot = Kokkos::create_mirror_view(this->gravity->phiP);
9898
Kokkos::deep_copy(locPot, this->gravity->phiP);
9999

100100
dims[3] = 1;
@@ -121,7 +121,7 @@ void DataBlock::DumpToFile(std::string filebase) {
121121
// Write Vs
122122
#if MHD == YES
123123
// Write Vs
124-
IdefixArray4D<real>::HostMirror locVs = Kokkos::create_mirror_view(Kokkos::HostSpace(),
124+
IdefixArray4D<real>::host_mirror_type locVs = Kokkos::create_mirror_view(Kokkos::HostSpace(),
125125
this->hydro->Vs);
126126
Kokkos::deep_copy(locVs,this->hydro->Vs);
127127
dims[0] = this->np_tot[IDIR]+IOFFSET;
@@ -139,7 +139,7 @@ void DataBlock::DumpToFile(std::string filebase) {
139139
dims[2] = this->np_tot[KDIR];
140140

141141
std::snprintf(fieldName,NAMESIZE,"Ex3");
142-
IdefixArray3D<real>::HostMirror locE = Kokkos::create_mirror_view(Kokkos::HostSpace(),
142+
IdefixArray3D<real>::host_mirror_type locE = Kokkos::create_mirror_view(Kokkos::HostSpace(),
143143
this->hydro->emf->ez);
144144
Kokkos::deep_copy(locE,this->hydro->emf->ez);
145145
WriteVariable(fileHdl, 3, dims, fieldName, locE.data());
@@ -155,7 +155,7 @@ void DataBlock::DumpToFile(std::string filebase) {
155155

156156

157157
if(hydro->haveCurrent) {
158-
IdefixArray4D<real>::HostMirror locJ = Kokkos::create_mirror_view(Kokkos::HostSpace(),
158+
IdefixArray4D<real>::host_mirror_type locJ = Kokkos::create_mirror_view(Kokkos::HostSpace(),
159159
this->hydro->J);
160160
Kokkos::deep_copy(locJ,this->hydro->J);
161161
dims[0] = this->np_tot[IDIR];

src/fluid/boundary/axis.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Axis::Axis(Boundary<Phys> *boundary) {
126126

127127
// Init the symmetry array (used to flip the signs of arrays accross the axis)
128128
symmetryVc = IdefixArray1D<int>("Axis:SymmetryVc",nVar);
129-
IdefixArray1D<int>::HostMirror symmetryVcHost = Kokkos::create_mirror_view(symmetryVc);
129+
IdefixArray1D<int>::host_mirror_type symmetryVcHost = Kokkos::create_mirror_view(symmetryVc);
130130
// Init the array
131131
for (int nv = 0; nv < nVar; nv++) {
132132
symmetryVcHost(nv) = 1;
@@ -143,7 +143,7 @@ Axis::Axis(Boundary<Phys> *boundary) {
143143

144144
if constexpr(Phys::mhd) {
145145
symmetryVs = IdefixArray1D<int>("Axis:SymmetryVs",DIMENSIONS);
146-
IdefixArray1D<int>::HostMirror symmetryVsHost = Kokkos::create_mirror_view(symmetryVs);
146+
IdefixArray1D<int>::host_mirror_type symmetryVsHost = Kokkos::create_mirror_view(symmetryVs);
147147
// Init the array
148148
for(int nv = 0; nv < DIMENSIONS; nv++) {
149149
symmetryVsHost(nv) = 1;

src/gravity/laplacian.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void Laplacian::InitInternalGrid() {
170170
});
171171

172172
// Check that all is well
173-
IdefixArray1D<real>::HostMirror xH = Kokkos::create_mirror_view(x1l);
173+
IdefixArray1D<real>::host_mirror_type xH = Kokkos::create_mirror_view(x1l);
174174
Kokkos::deep_copy(xH, x1l);
175175

176176
if(xH(0)<0.0) {

src/mpi/mpi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void Mpi::CheckConfig() {
131131

132132
// Run-time check that we can do a reduce on device arrays
133133
IdefixArray1D<int64_t> src("MPIChecksrc",1);
134-
IdefixArray1D<int64_t>::HostMirror srcHost = Kokkos::create_mirror_view(src);
134+
IdefixArray1D<int64_t>::host_mirror_type srcHost = Kokkos::create_mirror_view(src);
135135

136136
if(idfx::prank == 0) {
137137
srcHost(0) = 0;

0 commit comments

Comments
 (0)