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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD 20)

set(Idefix_VERSION_MAJOR 2)
set(Idefix_VERSION_MINOR 2)
Expand Down
30 changes: 15 additions & 15 deletions doc/source/programmingguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -355,31 +355,31 @@ fills the following arrays (essentially grid information) with data from its par

.. code-block:: c++

IdefixArray1D<real>::HostMirror x[3]; // geometrical central points
IdefixArray1D<real>::HostMirror xr[3]; // cell right interface
IdefixArray1D<real>::HostMirror xl[3]; // cell left interface
IdefixArray1D<real>::HostMirror dx[3]; // cell width
IdefixArray1D<real>::host_mirror_type x[3]; // geometrical central points
IdefixArray1D<real>::host_mirror_type xr[3]; // cell right interface
IdefixArray1D<real>::host_mirror_type xl[3]; // cell left interface
IdefixArray1D<real>::host_mirror_type dx[3]; // cell width

IdefixArray3D<real>::HostMirror dV; // cell volume
IdefixArray3D<real>::HostMirror A[3]; // cell right interface area
IdefixArray3D<real>::host_mirror_type dV; // cell volume
IdefixArray3D<real>::host_mirror_type A[3]; // cell right interface area


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

.. code-block:: c++

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

IdefixArray3D<real>::HostMirror Ex1; // x1 electric field
IdefixArray3D<real>::HostMirror Ex2; // x2 electric field
IdefixArray3D<real>::HostMirror Ex3; // x3 electric field
IdefixArray3D<real>::host_mirror_type Ex1; // x1 electric field
IdefixArray3D<real>::host_mirror_type Ex2; // x2 electric field
IdefixArray3D<real>::host_mirror_type Ex3; // x3 electric field

need to be synchronized *manually*. These IdefixArrays are all defined as ``HostMirror``, implying that they are accessible
need to be synchronized *manually*. These IdefixArrays are all defined as ``host_mirror_type``, implying that they are accessible
from the host only. If modifications are performed on the arrays of the
parent ``DataBlock``, one can call ``DataBlockHost::SyncFromDevice()`` to refresh the host arrays,
and inversely one can call ``DataBlockHost::SyncToDevice()`` to send data from ``DataBlockHost``
Expand Down
14 changes: 7 additions & 7 deletions src/dataBlock/dumpToFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ void DataBlock::DumpToFile(std::string filebase) {


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


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

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

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

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

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


if(hydro->haveCurrent) {
IdefixArray4D<real>::HostMirror locJ = Kokkos::create_mirror_view(Kokkos::HostSpace(),
IdefixArray4D<real>::host_mirror_type locJ = Kokkos::create_mirror_view(Kokkos::HostSpace(),
this->hydro->J);
Kokkos::deep_copy(locJ,this->hydro->J);
dims[0] = this->np_tot[IDIR];
Expand Down
4 changes: 2 additions & 2 deletions src/fluid/boundary/axis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Axis::Axis(Boundary<Phys> *boundary) {

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

if constexpr(Phys::mhd) {
symmetryVs = IdefixArray1D<int>("Axis:SymmetryVs",DIMENSIONS);
IdefixArray1D<int>::HostMirror symmetryVsHost = Kokkos::create_mirror_view(symmetryVs);
IdefixArray1D<int>::host_mirror_type symmetryVsHost = Kokkos::create_mirror_view(symmetryVs);
// Init the array
for(int nv = 0; nv < DIMENSIONS; nv++) {
symmetryVsHost(nv) = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/gravity/laplacian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void Laplacian::InitInternalGrid() {
});

// Check that all is well
IdefixArray1D<real>::HostMirror xH = Kokkos::create_mirror_view(x1l);
IdefixArray1D<real>::host_mirror_type xH = Kokkos::create_mirror_view(x1l);
Kokkos::deep_copy(xH, x1l);

if(xH(0)<0.0) {
Expand Down
2 changes: 1 addition & 1 deletion src/kokkos
Submodule kokkos updated 1515 files
2 changes: 1 addition & 1 deletion src/mpi/mpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void Mpi::CheckConfig() {

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

if(idfx::prank == 0) {
srcHost(0) = 0;
Expand Down
Loading