Skip to content
Merged
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
15 changes: 15 additions & 0 deletions .github/workflows/actions/pre-install-py-packages/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Install python packages

description: "Action installing the Idefix python packages before running the tests."

inputs: {}

runs:
using: "composite"
steps:
- name: Create venv
shell: bash
run: |
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r ./test/python_requirements.txt
26 changes: 26 additions & 0 deletions .github/workflows/idefix-ci-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
with:
submodules: recursive
persist-credentials: false
- name: Prep python
uses: ./.github/workflows/actions/pre-install-py-packages
- name: Sod test
run: scripts/ci/run-tests $IDEFIX_DIR/test/HD/sod -all $TESTME_OPTIONS
- name: Isothermal Sod test
Expand All @@ -49,6 +51,8 @@ jobs:
with:
submodules: recursive
persist-credentials: false
- name: Prep python
uses: ./.github/workflows/actions/pre-install-py-packages
- name: Viscous flow past cylinder
run: scripts/ci/run-tests $IDEFIX_DIR/test/HD/ViscousFlowPastCylinder -all $TESTME_OPTIONS
- name: Viscous disk
Expand All @@ -64,6 +68,8 @@ jobs:
with:
submodules: recursive
persist-credentials: false
- name: Prep python
uses: ./.github/workflows/actions/pre-install-py-packages
- name: MHD Sod test
run: scripts/ci/run-tests $IDEFIX_DIR/test/MHD/sod -all $TESTME_OPTIONS
- name: MHD Isothermal Sod test
Expand All @@ -85,6 +91,8 @@ jobs:
with:
submodules: recursive
persist-credentials: false
- name: Prep python
uses: ./.github/workflows/actions/pre-install-py-packages
- name: Ambipolar C Shock
run: scripts/ci/run-tests $IDEFIX_DIR/test/MHD/AmbipolarCshock -all $TESTME_OPTIONS
- name: Ambipolar C Shock 3D
Expand All @@ -105,6 +113,8 @@ jobs:
with:
submodules: recursive
persist-credentials: false
- name: Prep python
uses: ./.github/workflows/actions/pre-install-py-packages
- name: Fargo + planet
run: scripts/ci/run-tests $IDEFIX_DIR/test/HD/FargoPlanet -all $TESTME_OPTIONS
- name: Fargo MHD spherical
Expand All @@ -119,6 +129,8 @@ jobs:
with:
submodules: recursive
persist-credentials: false
- name: Prep python
uses: ./.github/workflows/actions/pre-install-py-packages
- name: Hydro shearing box
run: scripts/ci/run-tests $IDEFIX_DIR/test/HD/ShearingBox -all $TESTME_OPTIONS
- name: MHD shearing box
Expand All @@ -133,6 +145,8 @@ jobs:
with:
submodules: recursive
persist-credentials: false
- name: Prep python
uses: ./.github/workflows/actions/pre-install-py-packages
- name: Jeans Instability
run: scripts/ci/run-tests $IDEFIX_DIR/test/SelfGravity/JeansInstability -all $TESTME_OPTIONS
- name: Random sphere spherical
Expand All @@ -153,6 +167,8 @@ jobs:
with:
submodules: recursive
persist-credentials: false
- name: Prep python
uses: ./.github/workflows/actions/pre-install-py-packages
- name: 3 body
run: scripts/ci/run-tests $IDEFIX_DIR/test/Planet/Planet3Body -all $TESTME_OPTIONS
- name: migration
Expand All @@ -175,6 +191,8 @@ jobs:
with:
submodules: recursive
persist-credentials: false
- name: Prep python
uses: ./.github/workflows/actions/pre-install-py-packages
- name: Energy conservation
run: scripts/ci/run-tests $IDEFIX_DIR/test/Dust/DustEnergy -all $TESTME_OPTIONS
- name: Dusty wave
Expand All @@ -189,6 +207,8 @@ jobs:
with:
submodules: recursive
persist-credentials: false
- name: Prep python
uses: ./.github/workflows/actions/pre-install-py-packages
- name: MTI
run: scripts/ci/run-tests $IDEFIX_DIR/test/MHD/MTI -all $TESTME_OPTIONS
- name: Spherical anisotropic diffusion
Expand All @@ -207,6 +227,8 @@ jobs:
with:
submodules: recursive
persist-credentials: false
- name: Prep python
uses: ./.github/workflows/actions/pre-install-py-packages
- name: Run examples test
run: cd test && ./checks_examples.sh $TEST_OPTIONS

Expand All @@ -219,6 +241,8 @@ jobs:
with:
submodules: recursive
persist-credentials: false
- name: Prep python
uses: ./.github/workflows/actions/pre-install-py-packages
- name: Lookup table
run: scripts/ci/run-tests $IDEFIX_DIR/test/utils/lookupTable -all $TESTME_OPTIONS
- name: Dump Image
Expand All @@ -235,6 +259,8 @@ jobs:
with:
submodules: recursive
persist-credentials: false
- name: Prep python
uses: ./.github/workflows/actions/pre-install-py-packages
- name: Restart dumps
run: scripts/ci/run-tests $IDEFIX_DIR/test/IO/dump -all $TESTME_OPTIONS
- name: Pydefix
Expand Down
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 3)
Expand Down
9 changes: 6 additions & 3 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ algorithm is essentially the same (but with some major modification to its struc
================
Requirements
================
*Idefix* is written is standard C++17 and does not rely on any external library in serial (non MPI).
*Idefix* is written is standard C++20 and does not rely on any external library in serial (non MPI).

Compiler
*Idefix* requires a C++17 compatible compiler. It has been tested successfully with GCC (>8), Intel compiler suite (>2018) and
Clang on both Intel and AMD CPUs. *Idefix* has also been tested on NVIDIA GPUs (Pascal, Volta and Ampere architectures) using the nvcc (>10) compiler, and on AMD GPUs (Radeon Mi50, Mi210, Mi250) using the hipcc compiler.
*Idefix* requires a C++20 compatible compiler. It has been tested successfully with GCC (>11), Intel compiler suite (>2022) and
Clang on both Intel and AMD CPUs. *Idefix* has also been tested on NVIDIA GPUs (Pascal, Volta and Ampere architectures) using the nvcc (>12) compiler, and on AMD GPUs (Radeon Mi50, Mi210, Mi250, Mi300) using the hipcc compiler.

Kokkos library
*Idefix* relies internally on the `Kokkos <https://github.com/kokkos/kokkos>`_ library, which is bundled with *Idefix* as a git submodule and compiled on the fly, hence no external installation is required.
Expand Down Expand Up @@ -90,6 +90,9 @@ Jean Kempf, Victor Reville, François Rincon
Marc Coiffier
Continuous integration, automatic benchmarking

Sébastien Valat
Continuous integration

========================
About this documentation
========================
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
13 changes: 13 additions & 0 deletions scripts/ci/run-tests
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
#!/usr/bin/env bash

# load ICC compiler env
if [ "$IDEFIX_COMPILER" == icc ]; then
source /opt/intel/oneapi/setvars.sh
fi

# enable bash features
set -ue

# load python venv if present
if [ -d .venv ]; then
source .venv/bin/activate
fi

# jump in test directory
cd "$1"

# run the test
./testme.py "${@:2}"
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
2 changes: 1 addition & 1 deletion src/dataBlock/planetarySystem/planetStructs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct Force {
real f_ex_inner[3];
real f_outer[3];
real f_ex_outer[3];
KOKKOS_FUNCTION void operator+=(Force const volatile& f) volatile {
KOKKOS_FUNCTION void operator+=(const Force & f) {
for (int i = 0; i < 3; ++i) {
f_inner[i] += f.f_inner[i];
f_ex_inner[i] += f.f_ex_inner[i];
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
2 changes: 1 addition & 1 deletion test/MHD/AmbipolarWind/setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ void ComputeUserVars(DataBlock & data, UserDefVariablesContainer &variables) {
IdefixHostArray1D<real> x1=d.x[IDIR];
IdefixHostArray1D<real> x2=d.x[JDIR];
IdefixHostArray4D<real> Vc=d.Vc;
IdefixArray3D<real>::HostMirror scrhHost = Kokkos::create_mirror_view(scrh);
IdefixArray3D<real>::host_mirror_type scrhHost = Kokkos::create_mirror_view(scrh);
Kokkos::deep_copy(scrhHost,scrh);

for(int k = d.beg[KDIR]; k < d.end[KDIR] ; k++) {
Expand Down
2 changes: 1 addition & 1 deletion test/python_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ scipy>=1.2.3

# note that no version of inifix supports Python older than 3.6
inifix>=0.11.2

pybind11 >= 3.0.4
# To run the test suite, we can use pytest, mostly any version
# 6.0 is the one available on system available on debian-11
pytest >= 6.0
2 changes: 1 addition & 1 deletion test/skeleton/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void testReduction() {

// Init an array on device, and image on host
IdefixArray3D<real> rho = IdefixArray3D<real>("rho",nx3,nx2,nx1);
IdefixArray3D<real>::HostMirror rhoHost = Kokkos::create_mirror_view(rho);
IdefixArray3D<real>::host_mirror_type rhoHost = Kokkos::create_mirror_view(rho);

// Fill the host array, and compute the theoretical results
real theoreticalResult = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/utils/columnDensity/setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void Analysis(DataBlock & data) {
columnX3Right->ComputeColumn(rho);

IdefixArray3D<real> columnDensityLeft, columnDensityRight;
IdefixArray3D<real>::HostMirror columnDensityLeftHost, columnDensityRightHost;
IdefixArray3D<real>::host_mirror_type columnDensityLeftHost, columnDensityRightHost;
// IDIR
columnDensityLeft = columnX1Left->GetColumn();
columnDensityRight = columnX1Right->GetColumn();
Expand Down
2 changes: 1 addition & 1 deletion test/utils/lookupTable/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int main( int argc, char* argv[] )
idfx::cout << "--------------------------------------" << std::endl;
idfx::cout << "Testing 2D CSV file on device." << std::endl;
IdefixArray1D<real> arr = IdefixArray1D<real>("Test",1);
IdefixArray1D<real>::HostMirror arrHost = Kokkos::create_mirror_view(arr);
IdefixArray1D<real>::host_mirror_type arrHost = Kokkos::create_mirror_view(arr);

LookupTable<2> csv("toto.csv",',');

Expand Down
Loading