@@ -167,7 +167,9 @@ def prepare_step(self, *args, **kwargs):
167
167
def configure_step (self ):
168
168
"""Custom configuration procedure for GROMACS: set configure options for configure or cmake."""
169
169
170
- if LooseVersion (self .version ) >= LooseVersion ('4.6' ):
170
+ gromacs_version = LooseVersion (self .version )
171
+
172
+ if gromacs_version >= '4.6' :
171
173
cuda = get_software_root ('CUDA' )
172
174
if cuda :
173
175
# CUDA with double precision is currently not supported in GROMACS yet
@@ -188,10 +190,11 @@ def configure_step(self):
188
190
self .log .info ("skipping configure step" )
189
191
return
190
192
191
- if LooseVersion ( self . version ) >= LooseVersion ( '2021' ) :
192
- self .cfg .update ('configopts' , "-DGMX_GPU=CUDA -DCUDA_TOOLKIT_ROOT_DIR=%s" % cuda )
193
+ if gromacs_version >= '2021' :
194
+ self .cfg .update ('configopts' , "-DGMX_GPU=CUDA" )
193
195
else :
194
- self .cfg .update ('configopts' , "-DGMX_GPU=ON -DCUDA_TOOLKIT_ROOT_DIR=%s" % cuda )
196
+ self .cfg .update ('configopts' , "-DGMX_GPU=ON" )
197
+ self .cfg .update ('configopts' , "-DCUDA_TOOLKIT_ROOT_DIR=%s" % cuda )
195
198
196
199
# Set CUDA capabilities based on template value.
197
200
if '-DGMX_CUDA_TARGET_SM' not in self .cfg ['configopts' ]:
@@ -236,14 +239,14 @@ def configure_step(self):
236
239
# Ensure that the GROMACS log files report how the code was patched
237
240
# during the build, so that any problems are easier to diagnose.
238
241
# The GMX_VERSION_STRING_OF_FORK feature is available since 2020.
239
- if (LooseVersion ( self . version ) >= LooseVersion ( '2020' ) and
242
+ if (gromacs_version >= '2020' and
240
243
'-DGMX_VERSION_STRING_OF_FORK=' not in self .cfg ['configopts' ]):
241
244
gromacs_version_string_suffix = 'EasyBuild-%s' % EASYBUILD_VERSION
242
245
if plumed_root :
243
246
gromacs_version_string_suffix += '-PLUMED-%s' % get_software_version ('PLUMED' )
244
247
self .cfg .update ('configopts' , '-DGMX_VERSION_STRING_OF_FORK=%s' % gromacs_version_string_suffix )
245
248
246
- if LooseVersion ( self . version ) < LooseVersion ( '4.6' ) :
249
+ if gromacs_version < '4.6' :
247
250
self .log .info ("Using configure script for configuring GROMACS build." )
248
251
249
252
if self .cfg ['build_shared_libs' ]:
@@ -259,7 +262,7 @@ def configure_step(self):
259
262
self .cfg .update ('configopts' , "--without-x" )
260
263
261
264
# OpenMP is not supported for versions older than 4.5.
262
- if LooseVersion ( self . version ) >= LooseVersion ( '4.5' ) :
265
+ if gromacs_version >= '4.5' :
263
266
# enable OpenMP support if desired
264
267
if self .toolchain .options .get ('openmp' , None ):
265
268
self .cfg .update ('configopts' , "--enable-threads" )
@@ -310,22 +313,26 @@ def configure_step(self):
310
313
mpiexec_path , self .cfg .get ('mpiexec_numproc_flag' ),
311
314
mpi_numprocs )
312
315
313
- if LooseVersion ( self . version ) >= LooseVersion ( '2019' ) :
316
+ if gromacs_version >= '2019' :
314
317
# Building the gmxapi interface requires shared libraries,
315
318
# this is handled in the class initialisation so --module-only works
316
319
self .cfg .update ('configopts' , "-DGMXAPI=ON" )
317
320
318
- if LooseVersion ( self . version ) >= LooseVersion ( '2020' ) :
321
+ if gromacs_version >= '2020' :
319
322
# build Python bindings if Python is loaded as a dependency
320
323
python_root = get_software_root ('Python' )
321
324
if python_root :
325
+ self .cfg .update ('configopts' , "-DGMX_PYTHON_PACKAGE=ON" )
322
326
bin_python = os .path .join (python_root , 'bin' , 'python' )
327
+ # For find_package(PythonInterp)
323
328
self .cfg .update ('configopts' , "-DPYTHON_EXECUTABLE=%s" % bin_python )
324
- self .cfg .update ('configopts' , "-DGMX_PYTHON_PACKAGE=ON" )
329
+ if gromacs_version >= '2021' :
330
+ # For find_package(Python3) - Ignore virtual envs
331
+ self .cfg .update ('configopts' , "-DPython3_FIND_VIRTUALENV=STANDARD" )
325
332
326
333
# Now patch GROMACS for PLUMED before cmake
327
334
if plumed_root :
328
- if LooseVersion ( self . version ) >= LooseVersion ( '5.1' ) :
335
+ if gromacs_version >= '5.1' :
329
336
# Use shared or static patch depending on
330
337
# setting of self.cfg['build_shared_libs']
331
338
# and adapt cmake flags accordingly as per instructions
@@ -355,7 +362,7 @@ def configure_step(self):
355
362
if self .toolchain .toolchain_family () != toolchain .CRAYPE :
356
363
gmx_simd = self .get_gromacs_arch ()
357
364
if gmx_simd :
358
- if LooseVersion ( self . version ) < LooseVersion ( '5.0' ) :
365
+ if gromacs_version < '5.0' :
359
366
self .cfg .update ('configopts' , "-DGMX_CPU_ACCELERATION=%s" % gmx_simd )
360
367
else :
361
368
self .cfg .update ('configopts' , "-DGMX_SIMD=%s" % gmx_simd )
@@ -404,7 +411,7 @@ def configure_step(self):
404
411
env .setvar ('LDFLAGS' , "%s -lgfortran -lm" % os .environ .get ('LDFLAGS' , '' ))
405
412
406
413
# no more GSL support in GROMACS 5.x, see http://redmine.gromacs.org/issues/1472
407
- if LooseVersion ( self . version ) < LooseVersion ( '5.0' ) :
414
+ if gromacs_version < '5.0' :
408
415
# enable GSL when it's provided
409
416
if get_software_root ('GSL' ):
410
417
self .cfg .update ('configopts' , "-DGMX_GSL=ON" )
@@ -424,7 +431,7 @@ def configure_step(self):
424
431
out = super (EB_GROMACS , self ).configure_step ()
425
432
426
433
# for recent GROMACS versions, make very sure that a decent BLAS, LAPACK and FFT is found and used
427
- if LooseVersion ( self . version ) >= LooseVersion ( '4.6.5' ) :
434
+ if gromacs_version >= '4.6.5' :
428
435
patterns = [
429
436
r"Using external FFT library - \S*" ,
430
437
r"Looking for dgemm_ - found" ,
0 commit comments