Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions easybuild/toolchains/fft/fftw.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _set_fft_variables(self):
# TODO can these be replaced with the FFT ones?
self.variables.join('FFTW_INC_DIR', 'FFT_INC_DIR')
self.variables.join('FFTW_LIB_DIR', 'FFT_LIB_DIR')
if 'FFT_STATIC_LIBS' in self.variables:
self.variables.join('FFTW_STATIC_LIBS', 'FFT_STATIC_LIBS')
if 'FFT_STATIC_LIBS_MT' in self.variables:
self.variables.join('FFTW_STATIC_LIBS_MT', 'FFT_STATIC_LIBS_MT')

for key in ('SHARED_LIBS', 'SHARED_LIBS_MT', 'STATIC_LIBS', 'STATIC_LIBS_MT'):
if 'FFT_' + key in self.variables:
self.variables.join('FFTW_' + key, 'FFT_' + key)
26 changes: 24 additions & 2 deletions easybuild/tools/toolchain/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"""

from easybuild.tools.variables import AbsPathList
from easybuild.tools.toolchain.variables import LinkLibraryPaths, IncludePaths, CommandFlagList, CommaStaticLibs
from easybuild.tools.toolchain.variables import FlagList, LibraryList
from easybuild.tools.toolchain.variables import CommandFlagList, CommaSharedLibs, CommaStaticLibs
from easybuild.tools.toolchain.variables import FlagList, IncludePaths, LibraryList, LinkLibraryPaths


COMPILER_VARIABLES = [
Expand Down Expand Up @@ -114,6 +114,10 @@
('LIBBLAS', 'BLAS libraries'),
('LIBBLAS_MT', 'multithreaded BLAS libraries'),
],
CommaSharedLibs: [
('BLAS_SHARED_LIBS', 'Comma-separated list of shared BLAS libraries'),
('BLAS_MT_SHARED_LIBS', 'Comma-separated list of shared multithreaded BLAS libraries'),
],
CommaStaticLibs: [
('BLAS_STATIC_LIBS', 'Comma-separated list of static BLAS libraries'),
('BLAS_MT_STATIC_LIBS', 'Comma-separated list of static multithreaded BLAS libraries'),
Expand All @@ -132,6 +136,12 @@
('LIBLAPACK', 'LAPACK libraries'),
('LIBLAPACK_MT', 'multithreaded LAPACK libraries'),
],
CommaSharedLibs: [
('LAPACK_SHARED_LIBS', 'Comma-separated list of shared LAPACK libraries'),
('LAPACK_MT_SHARED_LIBS', 'Comma-separated list of shared LAPACK libraries'),
('BLAS_LAPACK_SHARED_LIBS', 'Comma-separated list of shared BLAS and LAPACK libraries'),
('BLAS_LAPACK_MT_SHARED_LIBS', 'Comma-separated list of shared BLAS and LAPACK libraries'),
],
CommaStaticLibs: [
('LAPACK_STATIC_LIBS', 'Comma-separated list of static LAPACK libraries'),
('LAPACK_MT_STATIC_LIBS', 'Comma-separated list of static LAPACK libraries'),
Expand Down Expand Up @@ -166,6 +176,10 @@
('LIBSCALAPACK', 'SCALAPACK libraries'),
('LIBSCALAPACK_MT', 'multithreaded SCALAPACK libraries'),
],
CommaSharedLibs: [
('SCALAPACK_SHARED_LIBS', 'Comma-separated list of shared SCALAPACK libraries'),
('SCALAPACK_MT_SHARED_LIBS', 'Comma-separated list of shared SCALAPACK libraries'),
],
CommaStaticLibs: [
('SCALAPACK_STATIC_LIBS', 'Comma-separated list of static SCALAPACK libraries'),
('SCALAPACK_MT_STATIC_LIBS', 'Comma-separated list of static SCALAPACK libraries'),
Expand All @@ -181,6 +195,10 @@
('LIBFFT', 'FFT libraries'),
('LIBFFT_MT', 'Multithreaded FFT libraries'),
],
CommaSharedLibs: [
('FFT_SHARED_LIBS', 'Comma-separated list of shared FFT libraries'),
('FFT_SHARED_LIBS_MT', 'Comma-separated list of shared multithreaded FFT libraries'),
],
CommaStaticLibs: [
('FFT_STATIC_LIBS', 'Comma-separated list of static FFT libraries'),
('FFT_STATIC_LIBS_MT', 'Comma-separated list of static multithreaded FFT libraries'),
Expand All @@ -192,6 +210,10 @@
('FFTW_LIB_DIR', 'FFTW library directory'),
('FFTW_INC_DIR', 'FFTW include directory'),
],
CommaSharedLibs: [
('FFTW_SHARED_LIBS', 'Comma-separated list of shared FFTW libraries'),
('FFTW_SHARED_LIBS_MT', 'Comma-separated list of shared multithreaded FFTW libraries'),
],
CommaStaticLibs: [
('FFTW_STATIC_LIBS', 'Comma-separated list of static FFTW libraries'),
('FFTW_STATIC_LIBS_MT', 'Comma-separated list of static multithreaded FFTW libraries'),
Expand Down
2 changes: 2 additions & 0 deletions easybuild/tools/toolchain/fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def _set_fft_variables(self):
if getattr(self, 'LIB_MULTITHREAD', None) is not None:
self.variables.nappend('LIBFFT_MT', self.LIB_MULTITHREAD)

self.variables.join('FFT_SHARED_LIBS', 'LIBFFT')
self.variables.join('FFT_STATIC_LIBS', 'LIBFFT')
self.variables.join('FFT_SHARED_LIBS_MT', 'LIBFFT_MT')
self.variables.join('FFT_STATIC_LIBS_MT', 'LIBFFT_MT')

for root in self.get_software_root(self.FFT_MODULE_NAME):
Expand Down
10 changes: 10 additions & 0 deletions easybuild/tools/toolchain/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ def _set_blas_variables(self):
self.variables.nappend('LIBBLAS', self.LIB_EXTRA, position=20)
self.variables.nappend('LIBBLAS_MT', self.LIB_EXTRA, position=20)

self.variables.join('BLAS_SHARED_LIBS', 'LIBBLAS')
self.variables.join('BLAS_STATIC_LIBS', 'LIBBLAS')
self.variables.join('BLAS_MT_SHARED_LIBS', 'LIBBLAS_MT')
self.variables.join('BLAS_MT_STATIC_LIBS', 'LIBBLAS_MT')
for root in self.get_software_root(self.BLAS_MODULE_NAME):
self.variables.append_exists('BLAS_LIB_DIR', root, self.BLAS_LIB_DIR)
Expand All @@ -147,7 +149,9 @@ def _set_lapack_variables(self):
self.variables.join('LIBLAPACK_MT_ONLY', 'LIBBLAS_MT')
self.variables.join('LIBLAPACK', 'LIBBLAS')
self.variables.join('LIBLAPACK_MT', 'LIBBLAS_MT')
self.variables.join('LAPACK_SHARED_LIBS', 'BLAS_SHARED_LIBS')
self.variables.join('LAPACK_STATIC_LIBS', 'BLAS_STATIC_LIBS')
self.variables.join('LAPACK_MT_SHARED_LIBS', 'BLAS_MT_SHARED_LIBS')
self.variables.join('LAPACK_MT_STATIC_LIBS', 'BLAS_MT_STATIC_LIBS')
self.variables.join('LAPACK_LIB_DIR', 'BLAS_LIB_DIR')
self.variables.join('LAPACK_INC_DIR', 'BLAS_INC_DIR')
Expand Down Expand Up @@ -183,7 +187,9 @@ def _set_lapack_variables(self):
self.variables.nappend('LIBLAPACK', self.LIB_EXTRA, position=20)
self.variables.nappend('LIBLAPACK_MT', self.LIB_EXTRA, position=20)

self.variables.join('LAPACK_SHARED_LIBS', 'LIBLAPACK')
self.variables.join('LAPACK_STATIC_LIBS', 'LIBLAPACK')
self.variables.join('LAPACK_MT_SHARED_LIBS', 'LIBLAPACK_MT')
self.variables.join('LAPACK_MT_STATIC_LIBS', 'LIBLAPACK_MT')

for root in self.get_software_root(self.LAPACK_MODULE_NAME):
Expand All @@ -192,7 +198,9 @@ def _set_lapack_variables(self):

self.variables.join('BLAS_LAPACK_LIB_DIR', 'LAPACK_LIB_DIR', 'BLAS_LIB_DIR')
self.variables.join('BLAS_LAPACK_INC_DIR', 'LAPACK_INC_DIR', 'BLAS_INC_DIR')
self.variables.join('BLAS_LAPACK_SHARED_LIBS', 'LAPACK_SHARED_LIBS', 'BLAS_SHARED_LIBS')
self.variables.join('BLAS_LAPACK_STATIC_LIBS', 'LAPACK_STATIC_LIBS', 'BLAS_STATIC_LIBS')
self.variables.join('BLAS_LAPACK_MT_SHARED_LIBS', 'LAPACK_MT_SHARED_LIBS', 'BLAS_MT_SHARED_LIBS')
self.variables.join('BLAS_LAPACK_MT_STATIC_LIBS', 'LAPACK_MT_STATIC_LIBS', 'BLAS_MT_STATIC_LIBS')

# add general dependency variables
Expand Down Expand Up @@ -293,7 +301,9 @@ def _set_scalapack_variables(self):
self.variables.nappend('LIBSCALAPACK', self.LIB_EXTRA, position=20)
self.variables.nappend('LIBSCALAPACK_MT', self.LIB_EXTRA, position=20)

self.variables.join('SCALAPACK_SHARED_LIBS', 'LIBSCALAPACK')
self.variables.join('SCALAPACK_STATIC_LIBS', 'LIBSCALAPACK')
self.variables.join('SCALAPACK_MT_SHARED_LIBS', 'LIBSCALAPACK_MT')
self.variables.join('SCALAPACK_MT_STATIC_LIBS', 'LIBSCALAPACK_MT')
for root in self.get_software_root(self.SCALAPACK_MODULE_NAME):
self.variables.append_exists('SCALAPACK_LIB_DIR', root, self.SCALAPACK_LIB_DIR)
Expand Down
10 changes: 9 additions & 1 deletion easybuild/tools/toolchain/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,16 @@ def change(self, separator=None, separator_begin_end=None, prefix=None, prefix_b
self.END.PREFIX = prefix_begin_end


class CommaSharedLibs(LibraryList):
"""Comma-separated list of shared libraries"""
SEPARATOR = ','

PREFIX = 'lib'
SUFFIX = '.so'


class CommaStaticLibs(LibraryList):
"""Comma-separated list"""
"""Comma-separated list of static libraries"""
SEPARATOR = ','

PREFIX = 'lib'
Expand Down
106 changes: 103 additions & 3 deletions test/framework/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,8 @@ def test_old_new_iccifort(self):
libblas_mt_intel3 += " -Wl,--end-group -Wl,-Bdynamic -liomp5 -lguide -lpthread"

# no -lguide
blas_static_libs_intel4 = 'libmkl_intel_lp64.a,libmkl_sequential.a,libmkl_core.a'
blas_shared_libs_intel4 = blas_static_libs_intel4.replace('.a', '.so')
libblas_intel4 = "-Wl,-Bstatic -Wl,--start-group -lmkl_intel_lp64 -lmkl_sequential -lmkl_core"
libblas_intel4 += " -Wl,--end-group -Wl,-Bdynamic"
libblas_mt_intel4 = "-Wl,-Bstatic -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core"
Expand All @@ -1469,18 +1471,83 @@ def test_old_new_iccifort(self):
libscalack_intel4 = "-lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64 -lmkl_intel_lp64 -lmkl_sequential "
libscalack_intel4 += "-lmkl_core"

libblas_mt_fosscuda = "-lopenblas -lgfortran -lpthread"
blas_static_libs_fosscuda = "libopenblas.a,libgfortran.a"
blas_shared_libs_fosscuda = blas_static_libs_fosscuda.replace('.a', '.so')
blas_mt_static_libs_fosscuda = blas_static_libs_fosscuda + ",libpthread.a"
blas_mt_shared_libs_fosscuda = blas_mt_static_libs_fosscuda.replace('.a', '.so')
libblas_fosscuda = "-lopenblas -lgfortran"
libblas_mt_fosscuda = libblas_fosscuda + " -lpthread"

fft_static_libs_fosscuda = "libfftw3.a"
fft_shared_libs_fosscuda = fft_static_libs_fosscuda.replace('.a', '.so')
fft_mt_static_libs_fosscuda = "libfftw3.a,libpthread.a"
fft_mt_shared_libs_fosscuda = fft_mt_static_libs_fosscuda.replace('.a', '.so')
fft_mt_static_libs_fosscuda_omp = "libfftw3_omp.a,libfftw3.a,libpthread.a"
fft_mt_shared_libs_fosscuda_omp = fft_mt_static_libs_fosscuda_omp.replace('.a', '.so')
libfft_fosscuda = "-lfftw3"
libfft_mt_fosscuda = libfft_fosscuda + " -lpthread"
libfft_mt_fosscuda_omp = "-lfftw3_omp " + libfft_fosscuda + " -lpthread"

lapack_static_libs_fosscuda = "libopenblas.a,libgfortran.a"
lapack_shared_libs_fosscuda = lapack_static_libs_fosscuda.replace('.a', '.so')
lapack_mt_static_libs_fosscuda = lapack_static_libs_fosscuda + ",libpthread.a"
lapack_mt_shared_libs_fosscuda = lapack_mt_static_libs_fosscuda.replace('.a', '.so')
liblapack_fosscuda = "-lopenblas -lgfortran"
liblapack_mt_fosscuda = liblapack_fosscuda + " -lpthread"

libscalack_fosscuda = "-lscalapack -lopenblas -lgfortran"
libfft_mt_fosscuda = "-lfftw3_omp -lfftw3 -lpthread"
libscalack_mt_fosscuda = libscalack_fosscuda + " -lpthread"
scalapack_static_libs_fosscuda = "libscalapack.a,libopenblas.a,libgfortran.a"
scalapack_shared_libs_fosscuda = scalapack_static_libs_fosscuda.replace('.a', '.so')
scalapack_mt_static_libs_fosscuda = "libscalapack.a,libopenblas.a,libgfortran.a,libpthread.a"
scalapack_mt_shared_libs_fosscuda = scalapack_mt_static_libs_fosscuda.replace('.a', '.so')

tc = self.get_toolchain('fosscuda', version='2018a')
tc.prepare()
self.assertEqual(os.environ['BLAS_SHARED_LIBS'], blas_shared_libs_fosscuda)
self.assertEqual(os.environ['BLAS_STATIC_LIBS'], blas_static_libs_fosscuda)
self.assertEqual(os.environ['BLAS_MT_SHARED_LIBS'], blas_mt_shared_libs_fosscuda)
self.assertEqual(os.environ['BLAS_MT_STATIC_LIBS'], blas_mt_static_libs_fosscuda)
self.assertEqual(os.environ['LIBBLAS'], libblas_fosscuda)
self.assertEqual(os.environ['LIBBLAS_MT'], libblas_mt_fosscuda)

self.assertEqual(os.environ['LAPACK_SHARED_LIBS'], lapack_shared_libs_fosscuda)
self.assertEqual(os.environ['LAPACK_STATIC_LIBS'], lapack_static_libs_fosscuda)
self.assertEqual(os.environ['LAPACK_MT_SHARED_LIBS'], lapack_mt_shared_libs_fosscuda)
self.assertEqual(os.environ['LAPACK_MT_STATIC_LIBS'], lapack_mt_static_libs_fosscuda)
self.assertEqual(os.environ['LIBLAPACK'], liblapack_fosscuda)
self.assertEqual(os.environ['LIBLAPACK_MT'], liblapack_mt_fosscuda)

self.assertEqual(os.environ['BLAS_LAPACK_SHARED_LIBS'], blas_shared_libs_fosscuda)
self.assertEqual(os.environ['BLAS_LAPACK_STATIC_LIBS'], blas_static_libs_fosscuda)
self.assertEqual(os.environ['BLAS_LAPACK_MT_SHARED_LIBS'], blas_mt_shared_libs_fosscuda)
self.assertEqual(os.environ['BLAS_LAPACK_MT_STATIC_LIBS'], blas_mt_static_libs_fosscuda)

self.assertEqual(os.environ['FFT_SHARED_LIBS'], fft_shared_libs_fosscuda)
self.assertEqual(os.environ['FFT_STATIC_LIBS'], fft_static_libs_fosscuda)
self.assertEqual(os.environ['FFT_SHARED_LIBS_MT'], fft_mt_shared_libs_fosscuda)
self.assertEqual(os.environ['FFT_STATIC_LIBS_MT'], fft_mt_static_libs_fosscuda)
self.assertEqual(os.environ['FFTW_SHARED_LIBS'], fft_shared_libs_fosscuda)
self.assertEqual(os.environ['FFTW_STATIC_LIBS'], fft_static_libs_fosscuda)
self.assertEqual(os.environ['FFTW_SHARED_LIBS_MT'], fft_mt_shared_libs_fosscuda)
self.assertEqual(os.environ['FFTW_STATIC_LIBS_MT'], fft_mt_static_libs_fosscuda)
self.assertEqual(os.environ['LIBFFT'], libfft_fosscuda)
self.assertEqual(os.environ['LIBFFT_MT'], libfft_mt_fosscuda)

self.assertEqual(os.environ['LIBSCALAPACK'], libscalack_fosscuda)
self.assertEqual(os.environ['LIBSCALAPACK_MT'], libscalack_mt_fosscuda)
self.assertEqual(os.environ['SCALAPACK_SHARED_LIBS'], scalapack_shared_libs_fosscuda)
self.assertEqual(os.environ['SCALAPACK_STATIC_LIBS'], scalapack_static_libs_fosscuda)
self.assertEqual(os.environ['SCALAPACK_MT_SHARED_LIBS'], scalapack_mt_shared_libs_fosscuda)
self.assertEqual(os.environ['SCALAPACK_MT_STATIC_LIBS'], scalapack_mt_static_libs_fosscuda)
self.modtool.purge()

tc = self.get_toolchain('intel', version='2018a')
tc.prepare()
self.assertEqual(os.environ.get('BLAS_SHARED_LIBS', "(not set)"), blas_shared_libs_intel4)
self.assertEqual(os.environ.get('BLAS_STATIC_LIBS', "(not set)"), blas_static_libs_intel4)
self.assertEqual(os.environ.get('LAPACK_SHARED_LIBS', "(not set)"), blas_shared_libs_intel4)
self.assertEqual(os.environ.get('LAPACK_STATIC_LIBS', "(not set)"), blas_static_libs_intel4)
self.assertEqual(os.environ.get('LIBBLAS', "(not set)"), libblas_intel4)
self.assertEqual(os.environ.get('LIBBLAS_MT', "(not set)"), libblas_mt_intel4)
self.assertEqual(os.environ.get('LIBFFT', "(not set)"), libfft_intel4)
Expand Down Expand Up @@ -1517,9 +1584,42 @@ def test_old_new_iccifort(self):
tc = self.get_toolchain('fosscuda', version='2018a')
tc.set_options({'openmp': True})
tc.prepare()
self.assertEqual(os.environ['BLAS_SHARED_LIBS'], blas_shared_libs_fosscuda)
self.assertEqual(os.environ['BLAS_STATIC_LIBS'], blas_static_libs_fosscuda)
self.assertEqual(os.environ['BLAS_MT_SHARED_LIBS'], blas_mt_shared_libs_fosscuda)
self.assertEqual(os.environ['BLAS_MT_STATIC_LIBS'], blas_mt_static_libs_fosscuda)
self.assertEqual(os.environ['LIBBLAS'], libblas_fosscuda)
self.assertEqual(os.environ['LIBBLAS_MT'], libblas_mt_fosscuda)
self.assertEqual(os.environ['LIBFFT_MT'], libfft_mt_fosscuda)

self.assertEqual(os.environ['LAPACK_SHARED_LIBS'], lapack_shared_libs_fosscuda)
self.assertEqual(os.environ['LAPACK_STATIC_LIBS'], lapack_static_libs_fosscuda)
self.assertEqual(os.environ['LAPACK_MT_SHARED_LIBS'], lapack_mt_shared_libs_fosscuda)
self.assertEqual(os.environ['LAPACK_MT_STATIC_LIBS'], lapack_mt_static_libs_fosscuda)
self.assertEqual(os.environ['LIBLAPACK'], liblapack_fosscuda)
self.assertEqual(os.environ['LIBLAPACK_MT'], liblapack_mt_fosscuda)

self.assertEqual(os.environ['BLAS_LAPACK_SHARED_LIBS'], blas_shared_libs_fosscuda)
self.assertEqual(os.environ['BLAS_LAPACK_STATIC_LIBS'], blas_static_libs_fosscuda)
self.assertEqual(os.environ['BLAS_LAPACK_MT_SHARED_LIBS'], blas_mt_shared_libs_fosscuda)
self.assertEqual(os.environ['BLAS_LAPACK_MT_STATIC_LIBS'], blas_mt_static_libs_fosscuda)

self.assertEqual(os.environ['FFT_SHARED_LIBS'], fft_shared_libs_fosscuda)
self.assertEqual(os.environ['FFT_STATIC_LIBS'], fft_static_libs_fosscuda)
self.assertEqual(os.environ['FFT_SHARED_LIBS_MT'], fft_mt_shared_libs_fosscuda_omp)
self.assertEqual(os.environ['FFT_STATIC_LIBS_MT'], fft_mt_static_libs_fosscuda_omp)
self.assertEqual(os.environ['FFTW_SHARED_LIBS'], fft_shared_libs_fosscuda)
self.assertEqual(os.environ['FFTW_STATIC_LIBS'], fft_static_libs_fosscuda)
self.assertEqual(os.environ['FFTW_SHARED_LIBS_MT'], fft_mt_shared_libs_fosscuda_omp)
self.assertEqual(os.environ['FFTW_STATIC_LIBS_MT'], fft_mt_static_libs_fosscuda_omp)
self.assertEqual(os.environ['LIBFFT'], libfft_fosscuda)
self.assertEqual(os.environ['LIBFFT_MT'], libfft_mt_fosscuda_omp)

self.assertEqual(os.environ['LIBSCALAPACK'], libscalack_fosscuda)
self.assertEqual(os.environ['LIBSCALAPACK_MT'], libscalack_mt_fosscuda)
self.assertEqual(os.environ['SCALAPACK_SHARED_LIBS'], scalapack_shared_libs_fosscuda)
self.assertEqual(os.environ['SCALAPACK_STATIC_LIBS'], scalapack_static_libs_fosscuda)
self.assertEqual(os.environ['SCALAPACK_MT_SHARED_LIBS'], scalapack_mt_shared_libs_fosscuda)
self.assertEqual(os.environ['SCALAPACK_MT_STATIC_LIBS'], scalapack_mt_static_libs_fosscuda)

def test_standalone_iccifort(self):
"""Test whether standalone installation of iccifort matches the iccifort toolchain definition."""
Expand Down