Skip to content

Commit 58fd76b

Browse files
committed
[FIX] compatibility with compiling on AMD Instinct MI300A APU
1 parent 4a8b8a2 commit 58fd76b

9 files changed

Lines changed: 45 additions & 45 deletions

File tree

src/dataBlock/dataBlockHost.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ DataBlockHost::DataBlockHost(DataBlock& datain) {
2121

2222
// Create mirrors (should be mirror_view)
2323
for(int dir = 0 ; dir < 3 ; dir++) {
24-
x[dir] = Kokkos::create_mirror_view(data->x[dir]);
25-
xr[dir] = Kokkos::create_mirror_view(data->xr[dir]);
26-
xl[dir] = Kokkos::create_mirror_view(data->xl[dir]);
27-
dx[dir] = Kokkos::create_mirror_view(data->dx[dir]);
28-
A[dir] = Kokkos::create_mirror_view(data->A[dir]);
24+
x[dir] = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->x[dir]);
25+
xr[dir] = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->xr[dir]);
26+
xl[dir] = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->xl[dir]);
27+
dx[dir] = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->dx[dir]);
28+
A[dir] = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->A[dir]);
2929
}
3030

3131
np_tot = data->np_tot;
@@ -47,30 +47,30 @@ DataBlockHost::DataBlockHost(DataBlock& datain) {
4747

4848
// TO BE COMPLETED...
4949

50-
dV = Kokkos::create_mirror_view(data->dV);
51-
Vc = Kokkos::create_mirror_view(data->hydro->Vc);
52-
Uc = Kokkos::create_mirror_view(data->hydro->Uc);
53-
InvDt = Kokkos::create_mirror_view(data->hydro->InvDt);
50+
dV = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->dV);
51+
Vc = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->hydro->Vc);
52+
Uc = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->hydro->Uc);
53+
InvDt = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->hydro->InvDt);
5454

5555
#if MHD == YES
56-
Vs = Kokkos::create_mirror_view(data->hydro->Vs);
56+
Vs = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->hydro->Vs);
5757
this->haveCurrent = data->hydro->haveCurrent;
5858
if(data->hydro->haveCurrent) {
59-
J = Kokkos::create_mirror_view(data->hydro->J);
59+
J = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->hydro->J);
6060
}
6161
#ifdef EVOLVE_VECTOR_POTENTIAL
62-
Ve = Kokkos::create_mirror_view(data->hydro->Ve);
62+
Ve = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->hydro->Ve);
6363
#endif
6464

65-
D_EXPAND( Ex3 = Kokkos::create_mirror_view(data->hydro->emf->ez); ,
65+
D_EXPAND( Ex3 = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->hydro->emf->ez); ,
6666
,
67-
Ex1 = Kokkos::create_mirror_view(data->hydro->emf->ex);
68-
Ex2 = Kokkos::create_mirror_view(data->hydro->emf->ey); )
67+
Ex1 = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->hydro->emf->ex);
68+
Ex2 = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->hydro->emf->ey); )
6969
#endif
7070
if(haveDust) {
7171
dustVc = std::vector<IdefixHostArray4D<real>>(data->dust.size());
7272
for(int i = 0 ; i < data->dust.size() ; i++) {
73-
dustVc[i] = Kokkos::create_mirror_view(data->dust[i]->Vc);
73+
dustVc[i] = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->dust[i]->Vc);
7474
}
7575
}
7676

@@ -80,7 +80,7 @@ DataBlockHost::DataBlockHost(DataBlock& datain) {
8080
this->coarseningDirection = data->coarseningDirection;
8181
for(int dir = 0 ; dir < 3 ; dir++) {
8282
if(coarseningDirection[dir]) {
83-
coarseningLevel[dir] = Kokkos::create_mirror_view(data->coarseningLevel[dir]);
83+
coarseningLevel[dir] = Kokkos::create_mirror_view(Kokkos::HostSpace(), data->coarseningLevel[dir]);
8484
}
8585
}
8686
}

src/dataBlock/dumpToFile.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ 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(this->hydro->FluxRiemann);
48+
//IdefixArray4D<real>::HostMirror locFlux = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->hydro->FluxRiemann);
4949
//Kokkos::deep_copy(locFlux, this->FluxRiemann);
5050
#if MHD == YES
5151

5252

5353
IdefixArray4D<real>::HostMirror locJ;
5454
if(hydro->haveCurrent) {
55-
locJ = Kokkos::create_mirror_view(this->hydro->J);
55+
locJ = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->hydro->J);
5656
Kokkos::deep_copy(locJ, this->hydro->J);
5757
}
5858
#endif
@@ -120,7 +120,7 @@ void DataBlock::DumpToFile(std::string filebase) {
120120
// Write Vs
121121
#if MHD == YES
122122
// Write Vs
123-
IdefixArray4D<real>::HostMirror locVs = Kokkos::create_mirror_view(this->hydro->Vs);
123+
IdefixArray4D<real>::HostMirror locVs = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->hydro->Vs);
124124
Kokkos::deep_copy(locVs,this->hydro->Vs);
125125
dims[0] = this->np_tot[IDIR]+IOFFSET;
126126
dims[1] = this->np_tot[JDIR]+JOFFSET;
@@ -137,7 +137,7 @@ void DataBlock::DumpToFile(std::string filebase) {
137137
dims[2] = this->np_tot[KDIR];
138138

139139
std::snprintf(fieldName,NAMESIZE,"Ex3");
140-
IdefixArray3D<real>::HostMirror locE = Kokkos::create_mirror_view(this->hydro->emf->ez);
140+
IdefixArray3D<real>::HostMirror locE = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->hydro->emf->ez);
141141
Kokkos::deep_copy(locE,this->hydro->emf->ez);
142142
WriteVariable(fileHdl, 3, dims, fieldName, locE.data());
143143

@@ -152,7 +152,7 @@ void DataBlock::DumpToFile(std::string filebase) {
152152

153153

154154
if(hydro->haveCurrent) {
155-
IdefixArray4D<real>::HostMirror locJ = Kokkos::create_mirror_view(this->hydro->J);
155+
IdefixArray4D<real>::HostMirror locJ = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->hydro->J);
156156
Kokkos::deep_copy(locJ,this->hydro->J);
157157
dims[0] = this->np_tot[IDIR];
158158
dims[1] = this->np_tot[JDIR];

src/fluid/checkNan.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ int Fluid<Phys>::CheckNan() {
6767

6868
DataBlockHost dataHost(*data);
6969

70-
IdefixHostArray4D<real> VcHost = Kokkos::create_mirror_view(this->Vc);
70+
IdefixHostArray4D<real> VcHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->Vc);
7171
Kokkos::deep_copy(VcHost,Vc);
7272

7373
int nerrormax=10;
@@ -95,7 +95,7 @@ int Fluid<Phys>::CheckNan() {
9595
}
9696

9797
if constexpr(Phys::mhd) {
98-
IdefixHostArray4D<real> VsHost = Kokkos::create_mirror_view(this->Vs);
98+
IdefixHostArray4D<real> VsHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->Vs);
9999
Kokkos::deep_copy(VsHost,Vs);
100100
for(int k = data->beg[KDIR] ; k < data->end[KDIR]+KOFFSET ; k++) {
101101
for(int j = data->beg[JDIR] ; j < data->end[JDIR]+JOFFSET ; j++) {

src/global.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ template<typename T>
3939
IdefixArray1D<T> ConvertVectorToIdefixArray(std::vector<T> &inputVector) {
4040
IdefixArray1D<T> outArr = IdefixArray1D<T>("Vector",inputVector.size());
4141
IdefixHostArray1D<T> outArrHost;
42-
outArrHost = Kokkos::create_mirror_view(outArr);
42+
outArrHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), outArr);
4343
for(int i = 0; i < inputVector.size() ; i++) {
4444
outArrHost(i) = inputVector[i];
4545
}

src/grid.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class SubGrid {
8181
parentGrid(grid), type(type), direction(d) {
8282
idfx::pushRegion("SubGrid::SubGrid()");
8383
// Find the index of the current subgrid.
84-
auto x = Kokkos::create_mirror_view(parentGrid->x[direction]);
84+
auto x = Kokkos::create_mirror_view(Kokkos::HostSpace(), parentGrid->x[direction]);
8585
Kokkos::deep_copy(x,parentGrid->x[direction]);
8686
int iref = -1;
8787
for(int i = 0 ; i < x.extent(0) - 1 ; i++) {

src/gridHost.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ GridHost::GridHost(Grid &grid) {
3232

3333
// Create mirrors on host
3434
for(int dir = 0 ; dir < 3 ; dir++) {
35-
x[dir] = Kokkos::create_mirror_view(grid.x[dir]);
36-
xr[dir] = Kokkos::create_mirror_view(grid.xr[dir]);
37-
xl[dir] = Kokkos::create_mirror_view(grid.xl[dir]);
38-
dx[dir] = Kokkos::create_mirror_view(grid.dx[dir]);
35+
x[dir] = Kokkos::create_mirror_view(Kokkos::HostSpace(), grid.x[dir]);
36+
xr[dir] = Kokkos::create_mirror_view(Kokkos::HostSpace(), grid.xr[dir]);
37+
xl[dir] = Kokkos::create_mirror_view(Kokkos::HostSpace(), grid.xl[dir]);
38+
dx[dir] = Kokkos::create_mirror_view(Kokkos::HostSpace(), grid.dx[dir]);
3939
}
4040

4141
idfx::popRegion();

src/output/dump.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ class DumpField {
8888
h4Darray, var, Kokkos::ALL, Kokkos::ALL, Kokkos::ALL);
8989
return(arr3D);
9090
} else if(arrayType==Device3D) {
91-
IdefixHostArray3D<real> arr3D = Kokkos::create_mirror(d3Darray);
91+
IdefixHostArray3D<real> arr3D = Kokkos::create_mirror(Kokkos::HostSpace(), d3Darray);
9292
Kokkos::deep_copy(arr3D,d3Darray);
9393
return(arr3D);
9494
} else if(arrayType==Device4D) {
9595
IdefixArray3D<real> arrDev3D = Kokkos::subview(
9696
d4Darray, var, Kokkos::ALL, Kokkos::ALL, Kokkos::ALL);
97-
IdefixHostArray3D<real> arr3D = Kokkos::create_mirror(arrDev3D);
97+
IdefixHostArray3D<real> arr3D = Kokkos::create_mirror(Kokkos::HostSpace(), arrDev3D);
9898
Kokkos::deep_copy(arr3D,arrDev3D);
9999
return(arr3D);
100100
} else {

src/output/scalarField.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ScalarField {
3333
h4Darray, var, Kokkos::ALL, Kokkos::ALL, Kokkos::ALL);
3434
return(arr3D);
3535
} else if(type==Device3D) {
36-
IdefixHostArray3D<real> arr3D = Kokkos::create_mirror(d3Darray);
36+
IdefixHostArray3D<real> arr3D = Kokkos::create_mirror(Kokkos::HostSpace(), d3Darray);
3737
Kokkos::deep_copy(arr3D,d3Darray);
3838
return(arr3D);
3939
} else if(type==Device4D) {

src/utils/lookupTable.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ LookupTable<kDim>::LookupTable(std::vector<std::string> filenames,
183183
this->offsetDev = IdefixArray1D<int> ("Table_offset", kDim);
184184
this->dataDev = IdefixArray1D<real> ("Table_data", dataVector.size());
185185

186-
this->xinHost = Kokkos::create_mirror_view(this->xinDev);
187-
this->dimensionsHost = Kokkos::create_mirror_view(this->dimensionsDev);
188-
this->offsetHost = Kokkos::create_mirror_view(this->offsetDev);
189-
this->dataHost = Kokkos::create_mirror_view(this->dataDev);
186+
this->xinHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->xinDev);
187+
this->dimensionsHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->dimensionsDev);
188+
this->offsetHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->offsetDev);
189+
this->dataHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->dataDev);
190190

191191
// Copy data in memory
192192
for(uint64_t i = 0 ; i < dataVector.size() ; i++) {
@@ -346,10 +346,10 @@ LookupTable<kDim>::LookupTable(std::string filename, char delimiter, bool errOOB
346346
this->offsetDev = IdefixArray1D<int> ("Table_offset", kDim);
347347
this->dataDev = IdefixArray1D<real> ("Table_data", size[0]*size[1]);
348348

349-
this->xinHost = Kokkos::create_mirror_view(this->xinDev);
350-
this->dimensionsHost = Kokkos::create_mirror_view(this->dimensionsDev);
351-
this->offsetHost = Kokkos::create_mirror_view(this->offsetDev);
352-
this->dataHost = Kokkos::create_mirror_view(this->dataDev);
349+
this->xinHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->xinDev);
350+
this->dimensionsHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->dimensionsDev);
351+
this->offsetHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->offsetDev);
352+
this->dataHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->dataDev);
353353

354354
// Fill the arrays with the std::vector content
355355
if(idfx::prank == 0) {
@@ -458,10 +458,10 @@ LookupTable<kDim>::LookupTable(Kokkos::View<T, Args...> array,
458458
this->offsetDev = IdefixArray1D<int> ("Table_offset", kDim);
459459
this->dataDev = IdefixArray1D<real> ("Table_data", sizeTotal);
460460

461-
this->xinHost = Kokkos::create_mirror_view(this->xinDev);
462-
this->dimensionsHost = Kokkos::create_mirror_view(this->dimensionsDev);
463-
this->offsetHost = Kokkos::create_mirror_view(this->offsetDev);
464-
this->dataHost = Kokkos::create_mirror_view(this->dataDev);
461+
this->xinHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->xinDev);
462+
this->dimensionsHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->dimensionsDev);
463+
this->offsetHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->offsetDev);
464+
this->dataHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), this->dataDev);
465465

466466
// Copy data in memory
467467
for(uint64_t n = 0 ; n < sizeTotal ; n++) {

0 commit comments

Comments
 (0)