Skip to content

Commit 8171c32

Browse files
authored
Reorganise tests (#367)
* move xdmf test in a dedicated directory * do not use xdmf in sedov test * move dump checks in a dedicated directory * add back sedov and IO tests to github actions * add back the linear wave test, and fix tolerance * Hard code pybind11 venv path from cmake
1 parent df60d14 commit 8171c32

24 files changed

Lines changed: 602 additions & 216 deletions

.github/workflows/idefix-ci-jobs.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ env:
2121
PYTHONPATH: ${{ github.workspace }}
2222
IDEFIX_DIR: ${{ github.workspace }}
2323

24+
2425
jobs:
2526
ShocksHydro:
2627
runs-on: self-hosted
@@ -35,6 +36,8 @@ jobs:
3536
run: scripts/ci/run-tests $IDEFIX_DIR/test/HD/sod-iso -all $TESTME_OPTIONS
3637
- name: Mach reflection test
3738
run: scripts/ci/run-tests $IDEFIX_DIR/test/HD//MachReflection -all $TESTME_OPTIONS
39+
- name: Sedov blast wave
40+
run: scripts/ci/run-tests $IDEFIX_DIR/test/HD/SedovBlastWave -all $TESTME_OPTIONS
3841

3942
ParabolicHydro:
4043
runs-on: self-hosted
@@ -63,8 +66,10 @@ jobs:
6366
run: scripts/ci/run-tests $IDEFIX_DIR/test/MHD/sod-iso -all $TESTME_OPTIONS
6467
- name: Orszag Tang
6568
run: scripts/ci/run-tests $IDEFIX_DIR/test/MHD/OrszagTang -all $TESTME_OPTIONS
66-
- name: Orszag Tang 3D+restart tests
69+
- name: Orszag Tang 3D
6770
run: scripts/ci/run-tests $IDEFIX_DIR/test/MHD/OrszagTang3D -all $TESTME_OPTIONS
71+
- name: Linear wave test
72+
run: scripts/ci/run-tests $IDEFIX_DIR/test/MHD/LinearWaveTest -all $TESTME_OPTIONS
6873
- name: Axis Flux tube
6974
run: scripts/ci/run-tests $IDEFIX_DIR/test/MHD/AxisFluxTube -all $TESTME_OPTIONS
7075

@@ -207,3 +212,23 @@ jobs:
207212
run: scripts/ci/run-tests $IDEFIX_DIR/test/utils/dumpImage -all $TESTME_OPTIONS
208213
- name: Column density
209214
run: scripts/ci/run-tests $IDEFIX_DIR/test/utils/columnDensity -all $TESTME_OPTIONS
215+
216+
IOs:
217+
needs: [Fargo, Dust, Planet, ShearingBox, SelfGravity]
218+
runs-on: self-hosted
219+
steps:
220+
- name: Check out repo
221+
uses: actions/checkout@v3
222+
with:
223+
submodules: recursive
224+
- name: Restart dumps
225+
run: scripts/ci/run-tests $IDEFIX_DIR/test/IO/dump -all $TESTME_OPTIONS
226+
- name: Pydefix
227+
run: |
228+
python3 -m venv $IDEFIX_DIR/test/IO/pydefix/env
229+
source $IDEFIX_DIR/test/IO/pydefix/env/bin/activate
230+
python3 -m pip install -r $IDEFIX_DIR/test/IO/pydefix/python_requirements.txt
231+
scripts/ci/run-tests $IDEFIX_DIR/test/IO/pydefix -all $TESTME_OPTIONS
232+
233+
- name: xdmf
234+
run: scripts/ci/run-tests $IDEFIX_DIR/test/IO/xdmf -all $TESTME_OPTIONS

CMakeLists.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,30 @@ if(Idefix_HDF5)
115115
)
116116
find_package(HDF5 REQUIRED)
117117
target_link_libraries(idefix "${HDF5_LIBRARIES}")
118-
target_include_directories(idefix "${HDF5_INCLUDE_DIRS}")
118+
message(STATUS "Found HDF5 include directories: ${HDF5_INCLUDE_DIRS}")
119+
target_include_directories(idefix PUBLIC "${HDF5_INCLUDE_DIRS}")
120+
if(Idefix_MPI)
121+
if(NOT HDF5_IS_PARALLEL)
122+
message(FATAL_ERROR "Parallel HDF5 required for Idefix_MPI but the found HDF5 library does not support it")
123+
endif()
124+
endif()
119125
message(STATUS "XDMF (hdf5+xmf) dumps enabled")
120126
else()
121127
set(Idefix_HDF5 OFF)
122128
endif()
123129

124130
if(Idefix_PYTHON)
125131
add_compile_definitions("WITH_PYTHON")
132+
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
133+
134+
execute_process(
135+
COMMAND "${Python3_EXECUTABLE}" -m pybind11 --cmakedir
136+
OUTPUT_VARIABLE PYBIND11_CMAKE_DIR
137+
OUTPUT_STRIP_TRAILING_WHITESPACE
138+
COMMAND_ERROR_IS_FATAL ANY
139+
)
140+
141+
list(APPEND CMAKE_PREFIX_PATH "${PYBIND11_CMAKE_DIR}")
126142
if (NOT DEFINED Python_FIND_FRAMEWORK)
127143
set(Python_FIND_FRAMEWORK "LAST") # Use Apple's python only at last resort on Macos
128144
endif ()

src/output/xdmf.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,18 +286,18 @@ int Xdmf::Write() {
286286
idfx::pushRegion("Xdmf::Write");
287287
fs::path filename;
288288
fs::path filename_xmf;
289-
hid_t err;
289+
[[maybe_unused]] hid_t err;
290290
idfx::cout << "Xdmf: Write file n " << xdmfFileNumber << "..." << std::flush;
291291
timer.reset();
292292

293293
// Create a copy of the dataBlock on Host, and sync it.
294294

295295
#if DIMENSIONS == 1
296-
int tot_dim = 1;
296+
[[maybe_unused]] int tot_dim = 1;
297297
#elif DIMENSIONS == 2
298298
int tot_dim = 2;
299299
#elif DIMENSIONS == 3
300-
int tot_dim = 3;
300+
[[maybe_unused]] int tot_dim = 3;
301301
#endif
302302

303303
std::stringstream ssfileName, ssfileNameXmf, ssxdmfFileNum;
@@ -344,7 +344,8 @@ int Xdmf::Write() {
344344
#endif
345345

346346
// Layout of the field data in memory
347-
hsize_t field_data_size[3], field_data_start[3], field_data_subsize[3], stride[3];
347+
[[maybe_unused]] hsize_t field_data_size[3], field_data_start[3];
348+
[[maybe_unused]] hsize_t field_data_subsize[3], stride[3];
348349
#ifdef WITH_MPI
349350
for(int dir = 0; dir < 3 ; dir++) {
350351
field_data_size[dir] = static_cast<hsize_t>(this->mpi_data_size[dir]);
@@ -454,11 +455,10 @@ void Xdmf::WriteHeader(
454455
hid_t tspace, tattr;
455456
hid_t unit_info, unit_attr;
456457
hid_t group;
457-
hid_t file_access = 0;
458458
#ifdef WITH_MPI
459459
hid_t plist_id_mpiio = 0; /* for collective MPI I/O */
460460
#endif
461-
hid_t err;
461+
[[maybe_unused]] hid_t err;
462462

463463
hsize_t dimstr;
464464

@@ -814,7 +814,7 @@ void Xdmf::WriteScalar(
814814
dataset_name = var_name.c_str();
815815
std::string dataset_label = dataset_name.c_str();
816816
std::transform(dataset_label.begin(), dataset_label.end(), dataset_label.begin(), ::tolower);
817-
hid_t err, dataset;
817+
[[maybe_unused]] hid_t err, dataset;
818818

819819
// We define the dataset that contain the fields.
820820

src/pydefix.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ py::array_t<real, py::array::c_style> GatherIdefixArray(IdefixHostArray3D<real>
6868
// np_int: size that should be copied into global
6969
// beg: offset in the incoming array where copy should begin
7070
// gbeg: offset in the global array where copy should be begin
71-
std::array<int,3> np_int,np_tot, beg, gbeg;
71+
[[maybe_unused]] std::array<int,3> np_int,np_tot, beg, gbeg;
7272
IdefixHostArray3D<real> buf;
7373

7474
if(rank==0) {
@@ -127,7 +127,7 @@ py::array_t<real, py::array::c_style> GatherIdefixArray(IdefixHostArray3D<real>
127127
}// End loop on target rank for root process
128128
} else { // MPI prank >0
129129
std::array<int,3> np_int = dataHost.np_int;
130-
std::array<int,3> np_tot = dataHost.np_tot;
130+
[[maybe_unused]] std::array<int,3> np_tot = dataHost.np_tot;
131131
std::array<int,3> gbeg = dataHost.gbeg;
132132
std::array<int,3> beg = dataHost.beg;
133133

@@ -278,6 +278,9 @@ Pydefix::Pydefix(Input &input) {
278278
idfx::cout << "Pydefix: start Python interpreter." << std::endl;
279279

280280
py::initialize_interpreter();
281+
py::exec("import sys; print(f'Pydefix: Python Version: {sys.version}')");
282+
py::exec("print(f'Pydefix: Executable Path: {sys.executable}')");
283+
py::exec("print(f'Pydefix: Sys Path: {sys.path}')");
281284
}
282285
this->scriptFilename = input.Get<std::string>("Python","script",0);
283286
if(scriptFilename.substr(scriptFilename.length() - 3, 3).compare(".py")==0) {

src/setup.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
// own implementation of the constructor, initflow and destructor
1313

1414
__attribute__((weak)) Setup::Setup(Input &input, Grid &grid, DataBlock &data, Output &output) {
15-
IDEFIX_WARNING("Caution, this is the default Setup constructor and it does nothing!");
15+
#ifndef WITH_PYTHON
16+
IDEFIX_WARNING("Caution, this is the default Setup constructor and it does nothing!");
17+
#endif
1618
}
1719

1820
__attribute__((weak)) void Setup::InitFlow(DataBlock &data) {

test/HD/SedovBlastWave/idefix.ini

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,5 @@ X3-beg periodic
2525
X3-end periodic
2626

2727
[Output]
28-
vtk 0.1
29-
xdmf 0.1
30-
dmp 0.1
28+
vtk 0.1
29+
dmp 0.1

test/IO/dump/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
enable_idefix_property(Idefix_MHD)

test/IO/dump/definitions.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#define COMPONENTS 3
2+
#define DIMENSIONS 3
3+
//#define DEBUG
4+
5+
#define GEOMETRY CARTESIAN

test/MHD/OrszagTang3D/idefix-checkrestart.ini renamed to test/IO/dump/idefix.ini

File renamed without changes.

0 commit comments

Comments
 (0)