From 8fcdb41bc083adf84a65909d1aed62cbbd6bc668 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Tue, 4 Feb 2020 14:47:05 +0100 Subject: [PATCH 1/5] Fix failing static linking tests on Dom * Workaround for Cray Bug #255707. --- cscs-checks/libraries/io/hdf5_compile_run.py | 12 +++++- .../libraries/io/netcdf_compile_run.py | 18 ++++++--- .../libraries/math/scalapack_compile_run.py | 15 +++++++- cscs-checks/prgenv/helloworld.py | 37 ++++++++++--------- 4 files changed, 57 insertions(+), 25 deletions(-) diff --git a/cscs-checks/libraries/io/hdf5_compile_run.py b/cscs-checks/libraries/io/hdf5_compile_run.py index c632966b3e..afb8525e18 100644 --- a/cscs-checks/libraries/io/hdf5_compile_run.py +++ b/cscs-checks/libraries/io/hdf5_compile_run.py @@ -7,11 +7,11 @@ for linkage in ['static', 'dynamic'])) class HDF5Test(rfm.RegressionTest): def __init__(self, lang, linkage): - super().__init__() lang_names = { 'c': 'C', 'f90': 'Fortran 90' } + self.linkage = linkage self.descr = lang_names[lang] + ' HDF5 ' + linkage.capitalize() self.sourcepath = 'h5ex_d_chunk.' + lang self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc', @@ -74,3 +74,13 @@ def __init__(self, lang, linkage): self.maintainers = ['SO', 'RS'] self.tags = {'production', 'craype'} + + @rfm.run_after('setup') + def set_linker_variables(self): + # FIXME: static compilation yields a link error in case of + # PrgEnv-cray(Cray Bug #255707) + if (self.linkage == 'static' and + self.current_system.name == 'dom' and + self.current_environ.name == 'PrgEnv-cray'): + self.variables = {'LINKER_X86_64': '/usr/bin/ld', + 'LINKER_AARCH64': '=/usr/bin/ld'} diff --git a/cscs-checks/libraries/io/netcdf_compile_run.py b/cscs-checks/libraries/io/netcdf_compile_run.py index 90eb9d97fd..b4315eac2f 100644 --- a/cscs-checks/libraries/io/netcdf_compile_run.py +++ b/cscs-checks/libraries/io/netcdf_compile_run.py @@ -9,7 +9,6 @@ for linkage in ['dynamic', 'static'])) class NetCDFTest(rfm.RegressionTest): def __init__(self, lang, linkage): - super().__init__() lang_names = { 'c': 'C', 'cpp': 'C++', @@ -42,9 +41,18 @@ def __init__(self, lang, linkage): self.maintainers = ['AJ', 'SO'] self.tags = {'production', 'craype', 'external-resources'} - def setup(self, partition, environ, **job_opts): + @rfm.run_after('setup') + def set_flags(self): + # FIXME: static compilation yields a link error in case of + # PrgEnv-cray(Cray Bug #255707) + if (self.linkage == 'static' and + self.current_system.name == 'dom' and + self.current_environ.name == 'PrgEnv-cray'): + self.variables = {'LINKER_X86_64': '/usr/bin/ld', + 'LINKER_AARCH64': '=/usr/bin/ld'} + if self.current_system.name == 'kesch': - if environ.name == 'PrgEnv-cray-nompi': + if self.current_environ.name == 'PrgEnv-cray-nompi': self.modules = ['netcdf/4.4.1.1-gmvolf-17.02', 'netcdf-c++/4.3.0-gmvolf-17.02', 'netcdf-fortran/4.4.4-gmvolf-17.02'] @@ -62,7 +70,7 @@ def setup(self, partition, environ, **job_opts): '-L$EBROOTNETCDFMINFORTRAN/lib64', '-lnetcdf', '-lnetcdf_c++4', '-lnetcdff' ] - elif environ.name == 'PrgEnv-pgi-nompi': + elif self.current_environ.name == 'PrgEnv-pgi-nompi': self.modules = ['netcdf/4.6.1-pgi-18.5-gcc-5.4.0-2.26', 'netcdf-c++/4.3.0-pgi-18.5-gcc-5.4.0-2.26', 'netcdf-fortran/4.4.4-pgi-18.5-gcc-5.4.0-2.26'] @@ -83,5 +91,3 @@ def setup(self, partition, environ, **job_opts): ] else: self.build_system.ldflags = ['-%s' % self.linkage] - - super().setup(partition, environ, **job_opts) diff --git a/cscs-checks/libraries/math/scalapack_compile_run.py b/cscs-checks/libraries/math/scalapack_compile_run.py index 5784ca3eac..59abad4f1a 100644 --- a/cscs-checks/libraries/math/scalapack_compile_run.py +++ b/cscs-checks/libraries/math/scalapack_compile_run.py @@ -6,7 +6,7 @@ class ScaLAPACKTest(rfm.RegressionTest): def __init__(self, linkage): - super().__init__() + self.linkage = linkage self.sourcesdir = os.path.join(self.current_system.resourcesdir, 'scalapack') self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:mc', @@ -29,6 +29,16 @@ def __init__(self, linkage): self.maintainers = ['CB', 'LM'] self.tags = {'production', 'external-resources'} + @rfm.run_after('setup') + def set_linker_variables(self): + # FIXME: static compilation yields a link error in case of + # PrgEnv-cray(Cray Bug #255707) + if (self.linkage == 'static' and + self.current_system.name == 'dom' and + self.current_environ.name == 'PrgEnv-cray'): + self.variables = {'LINKER_X86_64': '/usr/bin/ld', + 'LINKER_AARCH64': '=/usr/bin/ld'} + @rfm.required_version('>=2.14') @rfm.parameterized_test(['static'], ['dynamic']) @@ -36,6 +46,9 @@ class ScaLAPACKSanity(ScaLAPACKTest): def __init__(self, linkage): super().__init__(linkage) self.sourcepath = 'scalapack_compile_run.f' + if linkage == 'static': + self.variables['LINKER_X86_64'] = '/usr/bin/ld' + self.variables['LINKER_AARCH64'] = '/usr/bin/ld' def fortran_float(value): return float(value.replace('D', 'E')) diff --git a/cscs-checks/prgenv/helloworld.py b/cscs-checks/prgenv/helloworld.py index d7ad04c8fe..df9d573b07 100644 --- a/cscs-checks/prgenv/helloworld.py +++ b/cscs-checks/prgenv/helloworld.py @@ -6,7 +6,7 @@ class HelloWorldBaseTest(rfm.RegressionTest): def __init__(self, variant, lang, linkage): - super().__init__() + self.linkage = linkage self.variables = {'CRAYPE_LINK_TYPE': linkage} self.prgenv_flags = {} self.lang_names = { @@ -32,11 +32,25 @@ def __init__(self, variant, lang, linkage): self.valid_prog_environs = [] self.compilation_time_seconds = None - self.maintainers = ['VH', 'EK'] self.tags = {'production', 'craype'} - def setup(self, partition, environ, **job_opts): + def compile(self): + self.compilation_time_seconds = datetime.now() + super().compile() + self.compilation_time_seconds = ( + datetime.now() - self.compilation_time_seconds).total_seconds() + + @rfm.run_after('setup') + def set_flags(self): + # FIXME: static compilation yields a link error in case of + # PrgEnv-cray(Cray Bug #255707) + if (self.linkage == 'static' and + self.current_system.name == 'dom' and + self.current_environ.name.startswith('PrgEnv-cray')): + self.variables = {'LINKER_X86_64': '/usr/bin/ld', + 'LINKER_AARCH64': '=/usr/bin/ld'} + result = sn.findall(r'Hello World from thread \s*(\d+) out ' r'of \s*(\d+) from process \s*(\d+) out of ' r'\s*(\d+)', self.stdout) @@ -80,18 +94,11 @@ def setup(self, partition, environ, **job_opts): } } - envname = environ.name.replace('-nompi', '') + envname = self.current_environ.name.replace('-nompi', '') prgenv_flags = self.prgenv_flags[envname] self.build_system.cflags = prgenv_flags self.build_system.cxxflags = prgenv_flags self.build_system.fflags = prgenv_flags - super().setup(partition, environ, **job_opts) - - def compile(self): - self.compilation_time_seconds = datetime.now() - super().compile() - self.compilation_time_seconds = ( - datetime.now() - self.compilation_time_seconds).total_seconds() @rfm.required_version('>=2.14') @@ -150,9 +157,7 @@ def __init__(self, lang, linkage): # On SLURM there is no need to set OMP_NUM_THREADS if one defines # num_cpus_per_task, but adding for completeness and portability - self.variables = { - 'OMP_NUM_THREADS': str(self.num_cpus_per_task) - } + self.variables['OMP_NUM_THREADS']: str(self.num_cpus_per_task) @rfm.required_version('>=2.14') @@ -205,6 +210,4 @@ def __init__(self, lang, linkage): # On SLURM there is no need to set OMP_NUM_THREADS if one defines # num_cpus_per_task, but adding for completeness and portability - self.variables = { - 'OMP_NUM_THREADS': str(self.num_cpus_per_task) - } + self.variables['OMP_NUM_THREADS'] = str(self.num_cpus_per_task) From d04830b270c82ab8e09cfc5df7a4fe364e8146af Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Tue, 4 Feb 2020 15:58:50 +0100 Subject: [PATCH 2/5] Address PR comments --- cscs-checks/libraries/io/hdf5_compile_run.py | 16 ++++++----- .../libraries/io/netcdf_compile_run.py | 21 ++++++++------ .../libraries/math/scalapack_compile_run.py | 17 ++++++----- cscs-checks/prgenv/helloworld.py | 28 ++++++++++++------- 4 files changed, 47 insertions(+), 35 deletions(-) diff --git a/cscs-checks/libraries/io/hdf5_compile_run.py b/cscs-checks/libraries/io/hdf5_compile_run.py index e6aded4407..76b288b8b5 100644 --- a/cscs-checks/libraries/io/hdf5_compile_run.py +++ b/cscs-checks/libraries/io/hdf5_compile_run.py @@ -76,12 +76,14 @@ def __init__(self, lang, linkage): self.maintainers = ['SO', 'RS'] self.tags = {'production', 'craype'} - @rfm.run_after('setup') - def set_linker_variables(self): + @rfm.run_before('compile') + def cray_linker_workaround(self): # FIXME: static compilation yields a link error in case of # PrgEnv-cray(Cray Bug #255707) - if (self.linkage == 'static' and - self.current_system.name == 'dom' and - self.current_environ.name == 'PrgEnv-cray'): - self.variables = {'LINKER_X86_64': '/usr/bin/ld', - 'LINKER_AARCH64': '=/usr/bin/ld'} + if not (self.linkage == 'static' and + self.current_system.name == 'dom' and + self.current_environ.name == 'PrgEnv-cray'): + return + + self.variables = {'LINKER_X86_64': '/usr/bin/ld', + 'LINKER_AARCH64': '/usr/bin/ld'} diff --git a/cscs-checks/libraries/io/netcdf_compile_run.py b/cscs-checks/libraries/io/netcdf_compile_run.py index d2fbbfaee2..cb1998933a 100644 --- a/cscs-checks/libraries/io/netcdf_compile_run.py +++ b/cscs-checks/libraries/io/netcdf_compile_run.py @@ -41,16 +41,7 @@ def __init__(self, lang, linkage): self.maintainers = ['AJ', 'SO'] self.tags = {'production', 'craype', 'external-resources'} - @rfm.run_before('compile') def setflags(self): - # FIXME: static compilation yields a link error in case of - # PrgEnv-cray(Cray Bug #255707) - if (self.linkage == 'static' and - self.current_system.name == 'dom' and - self.current_environ.name == 'PrgEnv-cray'): - self.variables = {'LINKER_X86_64': '/usr/bin/ld', - 'LINKER_AARCH64': '=/usr/bin/ld'} - if self.current_system.name == 'kesch': if self.current_environ.name == 'PrgEnv-cray-nompi': self.modules = ['netcdf/4.4.1.1-gmvolf-17.02', @@ -91,3 +82,15 @@ def setflags(self): ] else: self.build_system.ldflags = ['-%s' % self.linkage] + + @rfm.run_before('compile') + def cray_linker_workaround(self): + # FIXME: static compilation yields a link error in case of + # PrgEnv-cray(Cray Bug #255707) + if not (self.linkage == 'static' and + self.current_system.name == 'dom' and + self.current_environ.name == 'PrgEnv-cray'): + return + + self.variables = {'LINKER_X86_64': '/usr/bin/ld', + 'LINKER_AARCH64': '/usr/bin/ld'} diff --git a/cscs-checks/libraries/math/scalapack_compile_run.py b/cscs-checks/libraries/math/scalapack_compile_run.py index 71b7509f04..659f3bfd3f 100644 --- a/cscs-checks/libraries/math/scalapack_compile_run.py +++ b/cscs-checks/libraries/math/scalapack_compile_run.py @@ -29,14 +29,16 @@ def __init__(self, linkage): self.tags = {'production', 'external-resources'} @rfm.run_before('compile') - def set_linker_variables(self): + def cray_linker_workaround(self): # FIXME: static compilation yields a link error in case of # PrgEnv-cray(Cray Bug #255707) - if (self.linkage == 'static' and - self.current_system.name == 'dom' and - self.current_environ.name == 'PrgEnv-cray'): - self.variables = {'LINKER_X86_64': '/usr/bin/ld', - 'LINKER_AARCH64': '=/usr/bin/ld'} + if not (self.linkage == 'static' and + self.current_system.name == 'dom' and + self.current_environ.name == 'PrgEnv-cray'): + return + + self.variables.update({'LINKER_X86_64': '/usr/bin/ld', + 'LINKER_AARCH64': '/usr/bin/ld'}) @rfm.required_version('>=2.14') @@ -45,9 +47,6 @@ class ScaLAPACKSanity(ScaLAPACKTest): def __init__(self, linkage): super().__init__(linkage) self.sourcepath = 'scalapack_compile_run.f' - if linkage == 'static': - self.variables['LINKER_X86_64'] = '/usr/bin/ld' - self.variables['LINKER_AARCH64'] = '/usr/bin/ld' def fortran_float(value): return float(value.replace('D', 'E')) diff --git a/cscs-checks/prgenv/helloworld.py b/cscs-checks/prgenv/helloworld.py index 2d3671ae3a..1c13be5357 100644 --- a/cscs-checks/prgenv/helloworld.py +++ b/cscs-checks/prgenv/helloworld.py @@ -84,14 +84,6 @@ def num_ranks(match): @rfm.run_before('compile') def setflags(self): - # FIXME: static compilation yields a link error in case of - # PrgEnv-cray(Cray Bug #255707) - if (self.linkage == 'static' and - self.current_system.name == 'dom' and - self.current_environ.name.startswith('PrgEnv-cray')): - self.variables = {'LINKER_X86_64': '/usr/bin/ld', - 'LINKER_AARCH64': '=/usr/bin/ld'} - envname = self.current_environ.name.replace('-nompi', '') prgenv_flags = self.prgenv_flags[envname] self.build_system.cflags = prgenv_flags @@ -107,6 +99,18 @@ def compile_timer_end(self): elapsed = datetime.now() - self.compilation_time_seconds self.compilation_time_seconds = elapsed.total_seconds() + @rfm.run_before('compile') + def cray_linker_workaround(self): + # FIXME: static compilation yields a link error in case of + # PrgEnv-cray(Cray Bug #255707) + if not (self.linkage == 'static' and + self.current_system.name == 'dom' and + self.current_environ.name.startswith('PrgEnv-cray')): + return + + self.variables.update({'LINKER_X86_64': '/usr/bin/ld', + 'LINKER_AARCH64': '/usr/bin/ld'}) + @rfm.required_version('>=2.14') @rfm.parameterized_test(*([lang, linkage] @@ -164,7 +168,9 @@ def __init__(self, lang, linkage): # On SLURM there is no need to set OMP_NUM_THREADS if one defines # num_cpus_per_task, but adding for completeness and portability - self.variables['OMP_NUM_THREADS']: str(self.num_cpus_per_task) + self.variables = { + 'OMP_NUM_THREADS': str(self.num_cpus_per_task) + } @rfm.required_version('>=2.14') @@ -217,4 +223,6 @@ def __init__(self, lang, linkage): # On SLURM there is no need to set OMP_NUM_THREADS if one defines # num_cpus_per_task, but adding for completeness and portability - self.variables['OMP_NUM_THREADS'] = str(self.num_cpus_per_task) + self.variables = { + 'OMP_NUM_THREADS': str(self.num_cpus_per_task) + } From a1453e9f42bcf77a288797d668ada06be36911b3 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Tue, 4 Feb 2020 16:16:40 +0100 Subject: [PATCH 3/5] Remove extra space from dictionary key-value --- cscs-checks/prgenv/helloworld.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cscs-checks/prgenv/helloworld.py b/cscs-checks/prgenv/helloworld.py index 1c13be5357..ee3d36b607 100644 --- a/cscs-checks/prgenv/helloworld.py +++ b/cscs-checks/prgenv/helloworld.py @@ -169,7 +169,7 @@ def __init__(self, lang, linkage): # On SLURM there is no need to set OMP_NUM_THREADS if one defines # num_cpus_per_task, but adding for completeness and portability self.variables = { - 'OMP_NUM_THREADS': str(self.num_cpus_per_task) + 'OMP_NUM_THREADS': str(self.num_cpus_per_task) } From 72500dd0c04564289c2b420ff1b6e2625d8a9e35 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Wed, 5 Feb 2020 09:51:56 +0100 Subject: [PATCH 4/5] Address PR comments (version 2) --- cscs-checks/libraries/io/hdf5_compile_run.py | 3 +-- cscs-checks/libraries/io/netcdf_compile_run.py | 3 +-- cscs-checks/libraries/math/scalapack_compile_run.py | 3 +-- cscs-checks/prgenv/helloworld.py | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cscs-checks/libraries/io/hdf5_compile_run.py b/cscs-checks/libraries/io/hdf5_compile_run.py index 76b288b8b5..76b0b46e84 100644 --- a/cscs-checks/libraries/io/hdf5_compile_run.py +++ b/cscs-checks/libraries/io/hdf5_compile_run.py @@ -85,5 +85,4 @@ def cray_linker_workaround(self): self.current_environ.name == 'PrgEnv-cray'): return - self.variables = {'LINKER_X86_64': '/usr/bin/ld', - 'LINKER_AARCH64': '/usr/bin/ld'} + self.variables = {'ALT_LINKER': '/usr/bin/ld'} diff --git a/cscs-checks/libraries/io/netcdf_compile_run.py b/cscs-checks/libraries/io/netcdf_compile_run.py index cb1998933a..1ef7072506 100644 --- a/cscs-checks/libraries/io/netcdf_compile_run.py +++ b/cscs-checks/libraries/io/netcdf_compile_run.py @@ -92,5 +92,4 @@ def cray_linker_workaround(self): self.current_environ.name == 'PrgEnv-cray'): return - self.variables = {'LINKER_X86_64': '/usr/bin/ld', - 'LINKER_AARCH64': '/usr/bin/ld'} + self.variables = {'ALT_LINKER': '/usr/bin/ld'} diff --git a/cscs-checks/libraries/math/scalapack_compile_run.py b/cscs-checks/libraries/math/scalapack_compile_run.py index 659f3bfd3f..4480f272e4 100644 --- a/cscs-checks/libraries/math/scalapack_compile_run.py +++ b/cscs-checks/libraries/math/scalapack_compile_run.py @@ -37,8 +37,7 @@ def cray_linker_workaround(self): self.current_environ.name == 'PrgEnv-cray'): return - self.variables.update({'LINKER_X86_64': '/usr/bin/ld', - 'LINKER_AARCH64': '/usr/bin/ld'}) + self.variables['ALT_LINKER'] = '/usr/bin/ld' @rfm.required_version('>=2.14') diff --git a/cscs-checks/prgenv/helloworld.py b/cscs-checks/prgenv/helloworld.py index ee3d36b607..a06d4dae5e 100644 --- a/cscs-checks/prgenv/helloworld.py +++ b/cscs-checks/prgenv/helloworld.py @@ -108,8 +108,7 @@ def cray_linker_workaround(self): self.current_environ.name.startswith('PrgEnv-cray')): return - self.variables.update({'LINKER_X86_64': '/usr/bin/ld', - 'LINKER_AARCH64': '/usr/bin/ld'}) + self.variables['ALT_LINKER'] = '/usr/bin/ld' @rfm.required_version('>=2.14') From e0b05b46c46ada73e7a64f1e713b4f8e99f5ebef Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Wed, 5 Feb 2020 11:28:30 +0100 Subject: [PATCH 5/5] Fix missing run_before compilation --- cscs-checks/libraries/io/netcdf_compile_run.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cscs-checks/libraries/io/netcdf_compile_run.py b/cscs-checks/libraries/io/netcdf_compile_run.py index 1ef7072506..a6ded7da52 100644 --- a/cscs-checks/libraries/io/netcdf_compile_run.py +++ b/cscs-checks/libraries/io/netcdf_compile_run.py @@ -41,6 +41,7 @@ def __init__(self, lang, linkage): self.maintainers = ['AJ', 'SO'] self.tags = {'production', 'craype', 'external-resources'} + @rfm.run_before('compile') def setflags(self): if self.current_system.name == 'kesch': if self.current_environ.name == 'PrgEnv-cray-nompi':