Skip to content
Merged
Changes from 9 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
137 changes: 92 additions & 45 deletions easybuild/easyblocks/s/siesta.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ def configure_step(self):
if netcdff_loc:
regex_subs.extend([
(r"^(LIBS\s*=.*)$", r"\1 $(NETCDF_LIBS)"),
(r"^(FPPFLAGS\s*=.*)$", r"\1 -DCDF"),
(r"^(FPPFLAGS\s*=.*)$", r"\1 -DCDF $(NETCDF_INCLUDE)"),
])
regex_newlines.append((r"^(COMP_LIBS\s*=.*)$", r"\1\nNETCDF_LIBS = -lnetcdff"))
regex_newlines.append((r"^(COMP_LIBS\s*=.*)$", r"\1\nNETCDF_LIBS = -lnetcdff\nNETCDF_INCLUDE = -I%s/include" % netcdff_loc))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (140 > 120 characters)


apply_regex_substitutions(arch_make, regex_subs)

Expand All @@ -190,9 +190,10 @@ def configure_step(self):
# Make the utils
change_dir(os.path.join(start_dir, 'Util'))

# clean_all.sh might be missing executable bit...
adjust_permissions('./clean_all.sh', stat.S_IXUSR, recursive=False, relative=True)
run_cmd('./clean_all.sh', log_all=True, simple=True, log_output=True)
if LooseVersion(self.version) >= LooseVersion('4'):
# clean_all.sh might be missing executable bit...
adjust_permissions('./clean_all.sh', stat.S_IXUSR, recursive=False, relative=True)
run_cmd('./clean_all.sh', log_all=True, simple=True, log_output=True)

if LooseVersion(self.version) >= LooseVersion('4.1'):
regex_subs_TS = [
Expand All @@ -205,52 +206,59 @@ def configure_step(self):
makefile = os.path.join(start_dir, 'Util', 'TS', 'tshs2tshs', 'Makefile')
apply_regex_substitutions(makefile, regex_subs_TS)

# SUFFIX rules in wrong place
regex_subs_suffix = [
(r'^(\.SUFFIXES:.*)$', r''),
(r'^(include\s*\$\(ARCH_MAKE\).*)$', r'\1\n.SUFFIXES:\n.SUFFIXES: .c .f .F .o .a .f90 .F90'),
]
makefile = os.path.join(start_dir, 'Util', 'Sockets', 'Makefile')
apply_regex_substitutions(makefile, regex_subs_suffix)
makefile = os.path.join(start_dir, 'Util', 'SiestaSubroutine', 'SimpleTest', 'Src', 'Makefile')
apply_regex_substitutions(makefile, regex_subs_suffix)
if LooseVersion(self.version) >= LooseVersion('4'):
# SUFFIX rules in wrong place
regex_subs_suffix = [
(r'^(\.SUFFIXES:.*)$', r''),
(r'^(include\s*\$\(ARCH_MAKE\).*)$', r'\1\n.SUFFIXES:\n.SUFFIXES: .c .f .F .o .a .f90 .F90'),
]
makefile = os.path.join(start_dir, 'Util', 'Sockets', 'Makefile')
apply_regex_substitutions(makefile, regex_subs_suffix)
makefile = os.path.join(start_dir, 'Util', 'SiestaSubroutine', 'SimpleTest', 'Src', 'Makefile')
apply_regex_substitutions(makefile, regex_subs_suffix)

regex_subs_UtilLDFLAGS = [
(r'(\$\(FC\)\s*-o\s)', r'$(FC) %s %s -o ' % (os.environ['FCFLAGS'], os.environ['LDFLAGS'])),
]
makefile = os.path.join(start_dir, 'Util', 'Optimizer', 'Makefile')
apply_regex_substitutions(makefile, regex_subs_UtilLDFLAGS)
makefile = os.path.join(start_dir, 'Util', 'JobList', 'Src', 'Makefile')
apply_regex_substitutions(makefile, regex_subs_UtilLDFLAGS)
if LooseVersion(self.version) >= LooseVersion('4'):
makefile = os.path.join(start_dir, 'Util', 'JobList', 'Src', 'Makefile')
apply_regex_substitutions(makefile, regex_subs_UtilLDFLAGS)

# remove clean at the end of default target
if self.version == '4.0.1' or self.version == '4.1-b3':
makefile = os.path.join(start_dir, 'Util', 'SiestaSubroutine', 'SimpleTest', 'Src', 'Makefile')
apply_regex_substitutions(makefile, [(r"simple_mpi_parallel clean", r"simple_mpi_parallel")])
makefile = os.path.join(start_dir, 'Util', 'SiestaSubroutine', 'ProtoNEB', 'Src', 'Makefile')
apply_regex_substitutions(makefile, [(r"protoNEB clean", r"protoNEB")])

# And yes, they are re-introducing this bug.
if ((LooseVersion(self.version) >= LooseVersion('4.0')
and LooseVersion(self.version) < LooseVersion('4.0.2'))
or LooseVersion(self.version) == LooseVersion('4.1-b3')):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

visually indented line with same indent as next logical line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what does it really want it to be ???

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be left one column, aligned with the ( on line 231?

This is messy though... How about:

loose_ver = LooseVersion(self.version)
is_ver40 = loose_ver >= LooseVersion('4.0') and loose_ver < LooseVersion('4.0.2')
if is_ver40 or loose_ver == LooseVersion('4.1-b3'):

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And obviously the loose_ver definition can be higher up, so you can use it throughout the whole method and avoid using LooseVersion(self.version) all over the place...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just what i was about to ask :-)

makefile = os.path.join(start_dir, 'Util', 'SiestaSubroutine', 'SimpleTest', 'Src', 'Makefile')
apply_regex_substitutions(makefile, [(r"simple_mpi_parallel clean", r"simple_mpi_parallel")])
makefile = os.path.join(start_dir, 'Util', 'SiestaSubroutine', 'ProtoNEB', 'Src', 'Makefile')
apply_regex_substitutions(makefile, [(r"protoNEB clean", r"protoNEB")])

# build_all.sh might be missing executable bit...
adjust_permissions('./build_all.sh', stat.S_IXUSR, recursive=False, relative=True)
run_cmd('./build_all.sh', log_all=True, simple=True, log_output=True)

# Now move all the built utils to the temp installdir
expected_utils = [
'Bands/eigfat2plot',
'CMLComp/ccViz',
'Contrib/APostnikov/eig2bxsf', 'Contrib/APostnikov/rho2xsf',
'Contrib/APostnikov/vib2xsf', 'Contrib/APostnikov/fmpdos',
'Contrib/APostnikov/xv2xsf', 'Contrib/APostnikov/md2axsf',
'COOP/mprop', 'COOP/fat',
'Contrib/APostnikov/eig2bxsf', 'Contrib/APostnikov/fmpdos',
'Contrib/APostnikov/md2axsf', 'Contrib/APostnikov/rho2xsf',
'Contrib/APostnikov/vib2xsf', 'Contrib/APostnikov/xv2xsf',
'COOP/fat', 'COOP/mprop',
'Denchar/Src/denchar',
'DensityMatrix/dm2cdf', 'DensityMatrix/cdf2dm',
'DensityMatrix/cdf2dm', 'DensityMatrix/dm2cdf',
'Eig2DOS/Eig2DOS',
'Gen-basis/ioncat', 'Gen-basis/gen-basis',
'Grid/cdf2grid', 'Grid/cdf_laplacian', 'Grid/cdf2xsf',
'Grid/grid2cube',
'Grid/grid_rotate', 'Grid/g2c_ng', 'Grid/grid2cdf', 'Grid/grid2val',
'Gen-basis/gen-basis', 'Gen-basis/ioncat',
'Gen-basis/ionplot.sh',
'Grid/cdf2grid', 'Grid/cdf2xsf', 'Grid/cdf_laplacian',
'Grid/g2c_ng', 'Grid/grid2cdf', 'Grid/grid2cube',
'Grid/grid2val', 'Grid/grid_rotate',
'Helpers/get_chem_labels',
'HSX/hs2hsx', 'HSX/hsx2hs',
'JobList/Src/getResults', 'JobList/Src/countJobs',
'JobList/Src/runJobs', 'JobList/Src/horizontal',
'JobList/Src/countJobs', 'JobList/Src/getResults',
'JobList/Src/horizontal', 'JobList/Src/runJobs',
'Macroave/Src/macroave',
'ON/lwf2cdf',
'Optimizer/simplex', 'Optimizer/swarm',
Expand All @@ -259,33 +267,69 @@ def configure_step(self):
'SiestaSubroutine/FmixMD/Src/driver',
'SiestaSubroutine/FmixMD/Src/para',
'SiestaSubroutine/FmixMD/Src/simple',
'STM/simple-stm/plstm', 'STM/ol-stm/Src/stm',
'VCA/mixps', 'VCA/fractional',
'Vibra/Src/vibra', 'Vibra/Src/fcbuild',
'WFS/info_wfsx', 'WFS/wfsx2wfs',
'WFS/readwfx', 'WFS/wfsnc2wfsx', 'WFS/readwf', 'WFS/wfs2wfsx',
'STM/ol-stm/Src/stm', 'STM/simple-stm/plstm',
'VCA/fractional', 'VCA/mixps',
'Vibra/Src/fcbuild', 'Vibra/Src/vibra',
'WFS/info_wfsx',
'WFS/readwf', 'WFS/readwfx', 'WFS/wfs2wfsx',
'WFS/wfsnc2wfsx', 'WFS/wfsx2wfs',
]

if LooseVersion(self.version) <= LooseVersion('4.0'):
if LooseVersion(self.version) >= LooseVersion('3.2'):
expected_utils.extend([
'Bands/new.gnubands',
'TBTrans/tbtrans',
'Bands/eigfat2plot',
])

if LooseVersion(self.version) >= LooseVersion('4.0'):
expected_utils.extend([
'SiestaSubroutine/ProtoNEB/Src/protoNEB',
'SiestaSubroutine/SimpleTest/Src/simple_pipes_parallel',
'SiestaSubroutine/SimpleTest/Src/simple_pipes_serial',
'SiestaSubroutine/SimpleTest/Src/simple_sockets_parallel',
'SiestaSubroutine/SimpleTest/Src/simple_sockets_serial',
'Sockets/f2fmaster', 'Sockets/f2fslave',
])
if self.toolchain.options.get('usempi', None):
expected_utils.extend([
'SiestaSubroutine/SimpleTest/Src/simple_mpi_parallel',
'SiestaSubroutine/SimpleTest/Src/simple_mpi_serial',
])

if LooseVersion(self.version) < LooseVersion('4.1'):
if LooseVersion(self.version) >= LooseVersion('4.0'):
expected_utils.extend([
'COOP/dm_creator',
'TBTrans_rep/tbtrans',
])
else:
expected_utils.extend([
'TBTrans/tbtrans',
])

if LooseVersion(self.version) < LooseVersion('4.0.2'):
expected_utils.extend([
'Bands/new.gnubands',
])
else:
expected_utils.extend([
'Bands/gnubands',
])
# Need to revisit this when 4.1 is officialy released.
# This is based on b1-b3 releases
if LooseVersion(self.version) < LooseVersion('4.1'):
expected_utils.extend([
'Contour/grid1d', 'Contour/grid2d',
'Optical/optical', 'Optical/optical_input',
'sies2arc/sies2arc',
])

if LooseVersion(self.version) >= LooseVersion('4.1'):
expected_utils.extend([
'Bands/gnubands',
'DensityMatrix/dmbs2dm', 'DensityMatrix/dmUnblock',
'Grimme/fdf2grimme',
'SpPivot/pvtsp',
'TS/ts2ts/ts2ts', 'TS/tshs2tshs/tshs2tshs', 'TS/TBtrans/tbtrans',
'TS/TBtrans/tbtrans', 'TS/tselecs.sh',
'TS/ts2ts/ts2ts', 'TS/tshs2tshs/tshs2tshs',
])

for util in expected_utils:
Expand Down Expand Up @@ -327,6 +371,9 @@ def sanity_check_step(self):
custom_commands = []
if self.toolchain.options.get('usempi', None):
# make sure Siesta was indeed built with support for running in parallel
custom_commands.append("echo 'SystemName test' | mpirun -np 2 siesta 2>/dev/null | grep PARALLEL")
# The "cd to builddir" is required to not contaminate the install dir with cruft from running siesta
mpi_test_cmd = "cd %s && " % self.builddir
mpi_test_cmd = mpi_test_cmd + "echo 'SystemName test' | mpirun -np 2 siesta 2>/dev/null | grep PARALLEL"
custom_commands.append(mpi_test_cmd)

super(EB_Siesta, self).sanity_check_step(custom_paths=custom_paths, custom_commands=custom_commands)