summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kuhn <michael.kuhn@informatik.uni-hamburg.de>2019-11-06 18:14:35 +0100
committerAdam J. Stewart <ajstewart426@gmail.com>2019-11-06 11:14:35 -0600
commit52eba8fb00679f3a7842582d0f24f3f58a61d923 (patch)
tree164f59a24d256e1655ab64c40e28560cd9144d8d
parent95bc67744593e59f1a11ccb4133e7e89ac044ed8 (diff)
downloadspack-52eba8fb00679f3a7842582d0f24f3f58a61d923.tar.gz
spack-52eba8fb00679f3a7842582d0f24f3f58a61d923.tar.bz2
spack-52eba8fb00679f3a7842582d0f24f3f58a61d923.tar.xz
spack-52eba8fb00679f3a7842582d0f24f3f58a61d923.zip
netcdf-fortran: Fix parallel builds (#13612)
netcdf-fortran@4.5: will error if netcdf-c has been built with MPI support: ``` configure: error: ----------------------------------------------------------------------- The NetCDF C library is built with parallel I/O feature enabled, but the Fortran compiler '.../lib/spack/env/gcc/gfortran' supplied in this configure command does not support MPI-IO. Please use one that does. If parallel I/O feature is not desired, please use a NetCDF C library with parallel I/O feature disabled. Abort. ----------------------------------------------------------------------- ``` Copy logic from netcdf-c to add an `mpi` variant.
-rw-r--r--var/spack/repos/builtin/packages/netcdf-fortran/package.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/netcdf-fortran/package.py b/var/spack/repos/builtin/packages/netcdf-fortran/package.py
index cfc4bc1018..77d960c62d 100644
--- a/var/spack/repos/builtin/packages/netcdf-fortran/package.py
+++ b/var/spack/repos/builtin/packages/netcdf-fortran/package.py
@@ -20,10 +20,17 @@ class NetcdfFortran(AutotoolsPackage):
version('4.4.4', sha256='b2d395175f8d283e68c8be516e231a96b191ade67ad0caafaf7fa01b1e6b5d75')
version('4.4.3', sha256='330373aa163d5931e475b5e83da5c1ad041e855185f24e6a8b85d73b48d6cda9')
+ variant('mpi', default=True,
+ description='Enable parallel I/O for netcdf-4')
variant('pic', default=True,
description='Produce position-independent code (for shared libs)')
- depends_on('netcdf-c')
+ # We need to build with MPI wrappers if parallel I/O features is enabled:
+ # https://www.unidata.ucar.edu/software/netcdf/docs/building_netcdf_fortran.html
+ depends_on('mpi', when='+mpi')
+
+ depends_on('netcdf-c~mpi', when='~mpi')
+ depends_on('netcdf-c+mpi', when='+mpi')
# The default libtool.m4 is too old to handle NAG compiler properly:
# https://github.com/Unidata/netcdf-fortran/issues/94
@@ -56,3 +63,13 @@ class NetcdfFortran(AutotoolsPackage):
return find_libraries(
libraries, root=self.prefix, shared=shared, recursive=True
)
+
+ def configure_args(self):
+ config_args = []
+
+ if '+mpi' in self.spec:
+ 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'].mpif77)
+
+ return config_args