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

Ignore Python from virtualenvs in GROMACS configure via -DPython3_FIND_VIRTUALENV=STANDARD #3283

Merged
merged 3 commits into from
Sep 18, 2024
Merged
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
35 changes: 21 additions & 14 deletions easybuild/easyblocks/g/gromacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ def prepare_step(self, *args, **kwargs):
def configure_step(self):
"""Custom configuration procedure for GROMACS: set configure options for configure or cmake."""

if LooseVersion(self.version) >= LooseVersion('4.6'):
gromacs_version = LooseVersion(self.version)

if gromacs_version >= '4.6':
cuda = get_software_root('CUDA')
if cuda:
# CUDA with double precision is currently not supported in GROMACS yet
Expand All @@ -188,10 +190,11 @@ def configure_step(self):
self.log.info("skipping configure step")
return

if LooseVersion(self.version) >= LooseVersion('2021'):
self.cfg.update('configopts', "-DGMX_GPU=CUDA -DCUDA_TOOLKIT_ROOT_DIR=%s" % cuda)
if gromacs_version >= '2021':
self.cfg.update('configopts', "-DGMX_GPU=CUDA")
else:
self.cfg.update('configopts', "-DGMX_GPU=ON -DCUDA_TOOLKIT_ROOT_DIR=%s" % cuda)
self.cfg.update('configopts', "-DGMX_GPU=ON")
self.cfg.update('configopts', "-DCUDA_TOOLKIT_ROOT_DIR=%s" % cuda)

# Set CUDA capabilities based on template value.
if '-DGMX_CUDA_TARGET_SM' not in self.cfg['configopts']:
Expand Down Expand Up @@ -236,14 +239,14 @@ def configure_step(self):
# Ensure that the GROMACS log files report how the code was patched
# during the build, so that any problems are easier to diagnose.
# The GMX_VERSION_STRING_OF_FORK feature is available since 2020.
if (LooseVersion(self.version) >= LooseVersion('2020') and
if (gromacs_version >= '2020' and
'-DGMX_VERSION_STRING_OF_FORK=' not in self.cfg['configopts']):
gromacs_version_string_suffix = 'EasyBuild-%s' % EASYBUILD_VERSION
if plumed_root:
gromacs_version_string_suffix += '-PLUMED-%s' % get_software_version('PLUMED')
self.cfg.update('configopts', '-DGMX_VERSION_STRING_OF_FORK=%s' % gromacs_version_string_suffix)

if LooseVersion(self.version) < LooseVersion('4.6'):
if gromacs_version < '4.6':
self.log.info("Using configure script for configuring GROMACS build.")

if self.cfg['build_shared_libs']:
Expand All @@ -259,7 +262,7 @@ def configure_step(self):
self.cfg.update('configopts', "--without-x")

# OpenMP is not supported for versions older than 4.5.
if LooseVersion(self.version) >= LooseVersion('4.5'):
if gromacs_version >= '4.5':
# enable OpenMP support if desired
if self.toolchain.options.get('openmp', None):
self.cfg.update('configopts', "--enable-threads")
Expand Down Expand Up @@ -310,22 +313,26 @@ def configure_step(self):
mpiexec_path, self.cfg.get('mpiexec_numproc_flag'),
mpi_numprocs)

if LooseVersion(self.version) >= LooseVersion('2019'):
if gromacs_version >= '2019':
# Building the gmxapi interface requires shared libraries,
# this is handled in the class initialisation so --module-only works
self.cfg.update('configopts', "-DGMXAPI=ON")

if LooseVersion(self.version) >= LooseVersion('2020'):
if gromacs_version >= '2020':
# build Python bindings if Python is loaded as a dependency
python_root = get_software_root('Python')
if python_root:
self.cfg.update('configopts', "-DGMX_PYTHON_PACKAGE=ON")
bin_python = os.path.join(python_root, 'bin', 'python')
# For find_package(PythonInterp)
self.cfg.update('configopts', "-DPYTHON_EXECUTABLE=%s" % bin_python)
self.cfg.update('configopts', "-DGMX_PYTHON_PACKAGE=ON")
if gromacs_version >= '2021':
# For find_package(Python3) - Ignore virtual envs
self.cfg.update('configopts', "-DPython3_FIND_VIRTUALENV=STANDARD")

# Now patch GROMACS for PLUMED before cmake
if plumed_root:
if LooseVersion(self.version) >= LooseVersion('5.1'):
if gromacs_version >= '5.1':
# Use shared or static patch depending on
# setting of self.cfg['build_shared_libs']
# and adapt cmake flags accordingly as per instructions
Expand Down Expand Up @@ -355,7 +362,7 @@ def configure_step(self):
if self.toolchain.toolchain_family() != toolchain.CRAYPE:
gmx_simd = self.get_gromacs_arch()
if gmx_simd:
if LooseVersion(self.version) < LooseVersion('5.0'):
if gromacs_version < '5.0':
self.cfg.update('configopts', "-DGMX_CPU_ACCELERATION=%s" % gmx_simd)
else:
self.cfg.update('configopts', "-DGMX_SIMD=%s" % gmx_simd)
Expand Down Expand Up @@ -404,7 +411,7 @@ def configure_step(self):
env.setvar('LDFLAGS', "%s -lgfortran -lm" % os.environ.get('LDFLAGS', ''))

# no more GSL support in GROMACS 5.x, see http://redmine.gromacs.org/issues/1472
if LooseVersion(self.version) < LooseVersion('5.0'):
if gromacs_version < '5.0':
# enable GSL when it's provided
if get_software_root('GSL'):
self.cfg.update('configopts', "-DGMX_GSL=ON")
Expand All @@ -424,7 +431,7 @@ def configure_step(self):
out = super(EB_GROMACS, self).configure_step()

# for recent GROMACS versions, make very sure that a decent BLAS, LAPACK and FFT is found and used
if LooseVersion(self.version) >= LooseVersion('4.6.5'):
if gromacs_version >= '4.6.5':
patterns = [
r"Using external FFT library - \S*",
r"Looking for dgemm_ - found",
Expand Down
Loading