diff options
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/gromacs/package.py | 67 |
1 files changed, 45 insertions, 22 deletions
diff --git a/var/spack/repos/builtin/packages/gromacs/package.py b/var/spack/repos/builtin/packages/gromacs/package.py index cf8aaa013c..86ae7d719a 100644 --- a/var/spack/repos/builtin/packages/gromacs/package.py +++ b/var/spack/repos/builtin/packages/gromacs/package.py @@ -71,10 +71,14 @@ class Gromacs(CMakePackage): variant('mdrun_only', default=False, description='Enables the build of a cut-down version' ' of libgromacs and/or the mdrun program') + conflicts('+mdrun_only', when='@2021:', + msg='mdrun-only build option was removed for GROMACS 2021.') variant('openmp', default=True, description='Enables OpenMP at configure time') variant('relaxed_double_precision', default=False, description='GMX_RELAXED_DOUBLE_PRECISION, use only for Fujitsu PRIMEHPC') + conflicts('+relaxed_double_precision', when='@2021:', + msg='GMX_RELAXED_DOUBLE_PRECISION option removed for GROMACS 2021.') variant('hwloc', default=True, description='Use the hwloc portable hardware locality library') variant('lapack', default=False, @@ -99,8 +103,10 @@ class Gromacs(CMakePackage): depends_on('fftw-api@3') depends_on('cmake@2.8.8:3.99.99', type='build') depends_on('cmake@3.4.3:3.99.99', type='build', when='@2018:') - depends_on('cmake@3.13.0:3.99.99', type='build', when='@master') - depends_on('cmake@3.13.0:3.99.99', type='build', when='%fj') + depends_on('cmake@3.9.6:3.99.99', type='build', when='@2020') + depends_on('cmake@3.13.0:3.99.99', type='build', when='@2021:') + depends_on('cmake@3.16.0:3.99.99', type='build', when='@master') + depends_on('cmake@3.16.0:3.99.99', type='build', when='%fj') depends_on('cuda', when='+cuda') depends_on('sycl', when='+sycl') depends_on('lapack', when='+lapack') @@ -123,17 +129,37 @@ class Gromacs(CMakePackage): options = [] - if self.spec.satisfies('@2020:'): - options.append('-DGMX_INSTALL_LEGACY_API=ON') - if '+mpi' in self.spec: options.append('-DGMX_MPI:BOOL=ON') - # Ensures gmxapi builds properly + if self.version < Version('2020'): + # Ensures gmxapi builds properly + options.extend([ + '-DCMAKE_C_COMPILER=%s' % self.spec['mpi'].mpicc, + '-DCMAKE_CXX_COMPILER=%s' % self.spec['mpi'].mpicxx, + '-DCMAKE_Fortran_COMPILER=%s' % self.spec['mpi'].mpifc, + ]) + elif self.version == Version('2021'): + # Work around https://gitlab.com/gromacs/gromacs/-/issues/3896 + # Ensures gmxapi builds properly + options.extend([ + '-DCMAKE_C_COMPILER=%s' % self.spec['mpi'].mpicc, + '-DCMAKE_CXX_COMPILER=%s' % self.spec['mpi'].mpicxx, + ]) + else: + options.extend([ + '-DCMAKE_C_COMPILER=%s' % spack_cc, + '-DCMAKE_CXX_COMPILER=%s' % spack_cxx, + '-DMPI_C_COMPILER=%s' % self.spec['mpi'].mpicc, + '-DMPI_CXX_COMPILER=%s' % self.spec['mpi'].mpicxx + ]) + else: options.extend([ - '-DCMAKE_C_COMPILER=%s' % self.spec['mpi'].mpicc, - '-DCMAKE_CXX_COMPILER=%s' % self.spec['mpi'].mpicxx, - '-DCMAKE_Fortran_COMPILER=%s' % self.spec['mpi'].mpifc, - ]) + '-DCMAKE_C_COMPILER=%s' % spack_cc, + '-DCMAKE_CXX_COMPILER=%s' % spack_cxx, + '-DGMX_MPI:BOOL=OFF']) + + if self.spec.satisfies('@2020:'): + options.append('-DGMX_INSTALL_LEGACY_API=ON') if '+double' in self.spec: options.append('-DGMX_DOUBLE:BOOL=ON') @@ -241,20 +267,17 @@ class Gromacs(CMakePackage): 'GMX_USE_RDTSCP', str(target.family) in ('x86_64', 'x86') )) - if '+mdrun_only' in self.spec: - options.append('-DGMX_BUILD_MDRUN_ONLY:BOOL=ON') - else: - options.append('-DGMX_BUILD_MDRUN_ONLY:BOOL=OFF') + if self.spec.satisfies('@:2020'): + options.append( + self.define_from_variant('GMX_BUILD_MDRUN_ONLY', 'mdrun_only')) - if '~openmp' in self.spec: - options.append('-DGMX_OPENMP:BOOL=OFF') - else: - options.append('-DGMX_OPENMP:BOOL=ON') + options.append(self.define_from_variant('GMX_OPENMP', 'openmp')) - if '+relaxed_double_precision' in self.spec: - options.append('-DGMX_RELAXED_DOUBLE_PRECISION:BOOL=ON') - else: - options.append('-DGMX_RELAXED_DOUBLE_PRECISION:BOOL=OFF') + if self.spec.satisfies('@:2020'): + options.append( + self.define_from_variant( + 'GMX_RELAXED_DOUBLE_PRECISION', + 'relaxed_double_precision')) if '+cycle_subcounters' in self.spec: options.append('-DGMX_CYCLE_SUBCOUNTERS:BOOL=ON') |