From 1e2c80b305fb21ae34ce657911a5f08b7c16bcb8 Mon Sep 17 00:00:00 2001 From: wkliao Date: Sat, 3 Aug 2024 11:49:19 -0500 Subject: [PATCH 1/3] Test flexible APIs only when PnetCDF-C >= 1.13.1 or mpi4py < 4.0.0 --- examples/test_all.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/examples/test_all.sh b/examples/test_all.sh index e295d12..28fc460 100755 --- a/examples/test_all.sh +++ b/examples/test_all.sh @@ -7,6 +7,28 @@ # Exit immediately if a command exits with a non-zero status. set -e +MPI4PY_VERSION=`python -c "import mpi4py; print(mpi4py.__version__)"` +MPI4PY_VERSION_MAJOR=`echo ${MPI4PY_VERSION} | cut -d. -f1` +# echo "MPI4PY_VERSION=$MPI4PY_VERSION" +# echo "MPI4PY_VERSION_MAJOR=$MPI4PY_VERSION_MAJOR" + +TEST_FLEXIBLE_API=no +if test "x$PNETCDF_DIR" != x ; then + PNETCDF_C_VERSION=`$PNETCDF_DIR/bin/pnetcdf-config --version | cut -d' ' -f2` + V_MAJOR=`echo ${PNETCDF_C_VERSION} | cut -d. -f1` + V_MINOR=`echo ${PNETCDF_C_VERSION} | cut -d. -f2` + V_SUB=`echo ${PNETCDF_C_VERSION} | cut -d. -f3` + VER_NUM=$((V_MAJOR*1000000 + V_MINOR*1000 + V_SUB)) + if test $VER_NUM > 1013000 ; then + TEST_FLEXIBLE_API=yes + fi +fi + +# test PnetCDF flexible APIs only when PnetCDF-C >= 1.13.1 or mpi4py < 4 +if test $MPI4PY_VERSION_MAJOR -lt 4 ; then + TEST_FLEXIBLE_API=yes +fi + # Get the directory containing this script if test "x$NPROC" = x ; then NPROC=4 @@ -27,12 +49,11 @@ else fi echo "" -echo "---- Run programs wit $NPROC processes in folder 'examples' ---------------" +echo "---- Run programs with $NPROC processes in folder 'examples' --------------" TETS_PROGS="collective_write.py create_open.py fill_mode.py - flexible_api.py get_info.py ghost_cell.py global_attribute.py @@ -45,6 +66,11 @@ TETS_PROGS="collective_write.py put_vara.py get_vara.py" +if test "x$TEST_FLEXIBLE_API" = xyes ; then + TETS_PROGS+=" flexible_api.py" +fi +# echo "TETS_PROGS=$TETS_PROGS" + for prog in $TETS_PROGS do # echo -n "---- Testing $prog with $NPROC MPI processes" From 62b4d265b70baebf98a118e36f1fee2d44b804af Mon Sep 17 00:00:00 2001 From: wkliao Date: Sat, 3 Aug 2024 11:54:00 -0500 Subject: [PATCH 2/3] Github action: remove requirement of mpi4py 3.1.6 --- .github/workflows/build_test_latest_c.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_test_latest_c.yml b/.github/workflows/build_test_latest_c.yml index 4946e05..51b386b 100644 --- a/.github/workflows/build_test_latest_c.yml +++ b/.github/workflows/build_test_latest_c.yml @@ -57,7 +57,7 @@ jobs: - name: Install python dependencies via pip run: | python -m pip install --upgrade pip - pip install numpy cython cftime pytest twine wheel check-manifest mpi4py==3.1.6 + pip install numpy cython cftime pytest twine wheel check-manifest mpi4py - name: Install pnetcdf run: | From a123c820484d7cebed84f675f985a2e4ec211a7c Mon Sep 17 00:00:00 2001 From: wkliao Date: Sat, 3 Aug 2024 12:15:49 -0500 Subject: [PATCH 3/3] Fix bash numerical value comparison --- examples/test_all.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/test_all.sh b/examples/test_all.sh index 28fc460..dbcd411 100755 --- a/examples/test_all.sh +++ b/examples/test_all.sh @@ -19,7 +19,7 @@ if test "x$PNETCDF_DIR" != x ; then V_MINOR=`echo ${PNETCDF_C_VERSION} | cut -d. -f2` V_SUB=`echo ${PNETCDF_C_VERSION} | cut -d. -f3` VER_NUM=$((V_MAJOR*1000000 + V_MINOR*1000 + V_SUB)) - if test $VER_NUM > 1013000 ; then + if test $VER_NUM -gt 1013000 ; then TEST_FLEXIBLE_API=yes fi fi