Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netcdf-{c,fortran}: add parallel testing variants #521

Merged
merged 4 commits into from
Feb 27, 2025
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
7 changes: 7 additions & 0 deletions var/spack/repos/builtin/packages/netcdf-c/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ class NetcdfC(CMakePackage, AutotoolsPackage):
variant("szip", default=True, description="Enable Szip compression plugin")
variant("blosc", default=True, description="Enable Blosc compression plugin")
variant("zstd", default=True, description="Enable Zstandard compression plugin")
# JCSDA fork only:
variant("parallel_tests", default=False, description="Run parallel tests", when="+mpi")

with when("build_system=cmake"):
# Based on the versions required by the root CMakeLists.txt:
Expand Down Expand Up @@ -398,6 +400,10 @@ def configure_args(self):
"--enable-netcdf-4",
]

# JCSDA fork only:
if self.spec.satisfies("+parallel_tests") and self.pkg.run_tests:
config_args.append("--enable-parallel-tests")

# NCZarr was added in version 4.8.0 as an experimental feature and became a supported one
# in version 4.8.1:
if self.spec.satisfies("@4.8.1:"):
Expand Down Expand Up @@ -556,6 +562,7 @@ def configure_args(self):
# It looks like the issues with running the tests in parallel were fixed around version 4.6.0
# (see https://github.com/Unidata/netcdf-c/commit/812c2fd4d108cca927582c0d84049c0f271bb9e0):
@when("@:4.5.0")
@run_after("install")
def check(self):
# h5_test fails when run in parallel
make("check", parallel=False)
17 changes: 11 additions & 6 deletions var/spack/repos/builtin/packages/netcdf-fortran/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class NetcdfFortran(AutotoolsPackage):
variant("pic", default=True, description="Produce position-independent code (for shared libs)")
variant("shared", default=True, description="Enable shared library")
variant("doc", default=False, description="Enable building docs")
# JCSDA fork only:
variant("parallel_tests", default=False, description="Enable parallel tests")

depends_on("netcdf-c")
depends_on("netcdf-c@4.7.4:", when="@4.5.3:") # nc_def_var_szip required
Expand Down Expand Up @@ -130,12 +132,14 @@ def configure_args(self):

netcdf_c_spec = self.spec["netcdf-c"]
if "+mpi" in netcdf_c_spec or "+parallel-netcdf" in netcdf_c_spec:
# Prefixing with 'mpiexec -n 4' is not necessarily the correct way
# to launch MPI programs on a particular machine (e.g. 'srun -n 4'
# with additional arguments might be the right one). Therefore, we
# make sure the parallel tests are not launched at all (although it
# is the default behaviour currently):
config_args.append("--disable-parallel-tests")
# JCSDA fork only:
if self.spec.satisfies("+parallel_tests") and self.run_tests:
config_args.append("--enable-parallel-tests")
config_args.append("CC=%s" % self.spec["mpi"].mpicc)
config_args.append("FC=%s" % self.spec["mpi"].mpifc)
config_args.append("F77=%s" % self.spec["mpi"].mpifc)
else:
config_args.append("--disable-parallel-tests")
if self.spec.satisfies("@4.5.0:4.5.2"):
# Versions from 4.5.0 to 4.5.2 check whether the Fortran MPI
# interface is available and fail the configuration if it is
Expand All @@ -153,6 +157,7 @@ def configure_args(self):

return config_args

@run_after("install")
def check(self):
make("check", parallel=self.spec.satisfies("@4.5:"))

Expand Down
Loading