Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions easybuild/toolchains/fft/fftw.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.toolchain.fft import Fft
from easybuild.tools.modules import get_software_root


class Fftw(Fft):
Expand All @@ -56,6 +57,11 @@ def _set_fftw_variables(self):
fftw_libs = ["fftw%s" % suffix]
if self.options.get('usempi', False):
fftw_libs.insert(0, "fftw%s_mpi" % suffix)
fftwmpiroot = get_software_root('FFTW.MPI')
if fftwmpiroot:
# get libfft%_mpi via the FFTW.MPI module
self.FFT_MODULE_NAME = ['FFTW.MPI']

fftw_libs_mt = ["fftw%s" % suffix]
if self.options.get('openmp', False):
fftw_libs_mt.insert(0, "fftw%s_omp" % suffix)
Expand Down
2 changes: 1 addition & 1 deletion test/framework/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@


# number of modules included for testing purposes
TEST_MODULES_COUNT = 87
TEST_MODULES_COUNT = 90


class ModulesTest(EnhancedTestCase):
Expand Down
31 changes: 31 additions & 0 deletions test/framework/modules/FFTW.MPI/3.3.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#%Module

proc ModulesHelp { } {
puts stderr { FFTW is a C subroutine library for computing the discrete Fourier transform (DFT)
in one or more dimensions, of arbitrary input size, and of both real and complex data. - Homepage: http://www.fftw.org
}
}

module-whatis {FFTW is a C subroutine library for computing the discrete Fourier transform (DFT)
in one or more dimensions, of arbitrary input size, and of both real and complex data. - Homepage: http://www.fftw.org}

set root /home-2/khoste/.local/easybuild/software/FFTW.MPI/3.3.7

conflict FFTW.MPI

if { ![is-loaded gompi/2018a] } {
module load gompi/2018a
}

prepend-path CPATH $root/include
prepend-path LD_LIBRARY_PATH $root/lib
prepend-path MANPATH $root/share/man
prepend-path PATH $root/bin
prepend-path PKG_CONFIG_PATH $root/lib/pkgconfig

setenv EBROOTFFTWMPI "$root"
setenv EBVERSIONFFTWMPI "3.3.7"
setenv EBDEVELFFTWMPI "$root/easybuild/FFTW.MPI-3.3.7-easybuild-devel"


# built with EasyBuild version 1.4.0dev
31 changes: 31 additions & 0 deletions test/framework/modules/FFTW/3.3.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#%Module

proc ModulesHelp { } {
puts stderr { FFTW is a C subroutine library for computing the discrete Fourier transform (DFT)
in one or more dimensions, of arbitrary input size, and of both real and complex data. - Homepage: http://www.fftw.org
}
}

module-whatis {FFTW is a C subroutine library for computing the discrete Fourier transform (DFT)
in one or more dimensions, of arbitrary input size, and of both real and complex data. - Homepage: http://www.fftw.org}

set root /home-2/khoste/.local/easybuild/software/FFTW/3.3.7

conflict FFTW

if { ![is-loaded gompi/2018a] } {
module load gompi/2018a
}

prepend-path CPATH $root/include
prepend-path LD_LIBRARY_PATH $root/lib
prepend-path MANPATH $root/share/man
prepend-path PATH $root/bin
prepend-path PKG_CONFIG_PATH $root/lib/pkgconfig

setenv EBROOTFFTW "$root"
setenv EBVERSIONFFTW "3.3.7"
setenv EBDEVELFFTW "$root/easybuild/FFTW-3.3.7-easybuild-devel"


# built with EasyBuild version 1.4.0dev
46 changes: 46 additions & 0 deletions test/framework/modules/foss/2018a-FFTW.MPI
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#%Module

proc ModulesHelp { } {
puts stderr { GCC based compiler toolchain including
OpenMPI for MPI support, OpenBLAS (BLAS and LAPACK support), FFTW and ScaLAPACK. - Homepage: (none)
}
}

module-whatis {GCC based compiler toolchain including
OpenMPI for MPI support, OpenBLAS (BLAS and LAPACK support), FFTW and ScaLAPACK. - Homepage: (none)}

set root /prefix/software/foss/2018a

conflict foss

if { ![is-loaded GCC/6.4.0-2.28] } {
module load GCC/6.4.0-2.28
}

if { ![is-loaded OpenMPI/2.1.2-GCC-6.4.0-2.28] } {
module load OpenMPI/2.1.2-GCC-6.4.0-2.28
}

if { ![is-loaded OpenBLAS/0.2.20-GCC-6.4.0-2.28] } {
module load OpenBLAS/0.2.20-GCC-6.4.0-2.28
}

if { ![is-loaded FFTW/3.3.7] } {
module load FFTW/3.3.7
}

if { ![is-loaded FFTW.MPI/3.3.7 ] } {
module load FFTW.MPI/3.3.7
}

if { ![is-loaded ScaLAPACK/2.0.2-gompi-2018a-OpenBLAS-0.2.20] } {
module load ScaLAPACK/2.0.2-gompi-2018a-OpenBLAS-0.2.20
}


setenv EBROOTFOSS "$root"
setenv EBVERSIONFOSS "2018a"
setenv EBDEVELFOSS "$root/easybuild/foss-2018a-easybuild-devel"


# built with EasyBuild version 1.4.0dev
81 changes: 81 additions & 0 deletions test/framework/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,60 @@ def test_fft_env_vars_foss(self):
self.assertEqual(tc.get_variable('LIBFFT'), '-lfftw3_mpi -lfftw3')
self.assertEqual(tc.get_variable('LIBFFT_MT'), '-lfftw3 -lpthread')

self.modtool.purge()
self.setup_sandbox_for_foss_fftw(self.test_prefix)
self.modtool.prepend_module_path(self.test_prefix)

tc = self.get_toolchain('foss', version='2018a-FFTW.MPI')
tc.prepare()

fft_static_libs = 'libfftw3.a'
self.assertEqual(tc.get_variable('FFT_STATIC_LIBS'), fft_static_libs)
self.assertEqual(tc.get_variable('FFTW_STATIC_LIBS'), fft_static_libs)

fft_static_libs_mt = 'libfftw3.a,libpthread.a'
self.assertEqual(tc.get_variable('FFT_STATIC_LIBS_MT'), fft_static_libs_mt)
self.assertEqual(tc.get_variable('FFTW_STATIC_LIBS_MT'), fft_static_libs_mt)

self.assertEqual(tc.get_variable('LIBFFT'), '-lfftw3')
self.assertEqual(tc.get_variable('LIBFFT_MT'), '-lfftw3 -lpthread')

fft_lib_dir = os.path.join(modules.get_software_root('FFTW'), 'lib')
self.assertEqual(tc.get_variable('FFT_LIB_DIR'), fft_lib_dir)

tc = self.get_toolchain('foss', version='2018a-FFTW.MPI')
tc.set_options({'openmp': True})
tc.prepare()

self.assertEqual(tc.get_variable('FFT_STATIC_LIBS'), fft_static_libs)
self.assertEqual(tc.get_variable('FFTW_STATIC_LIBS'), fft_static_libs)

self.assertEqual(tc.get_variable('FFT_STATIC_LIBS_MT'), 'libfftw3_omp.a,' + fft_static_libs_mt)
self.assertEqual(tc.get_variable('FFTW_STATIC_LIBS_MT'), 'libfftw3_omp.a,' + fft_static_libs_mt)

self.assertEqual(tc.get_variable('LIBFFT'), '-lfftw3')
self.assertEqual(tc.get_variable('LIBFFT_MT'), '-lfftw3_omp -lfftw3 -lpthread')

fft_lib_dir = os.path.join(modules.get_software_root('FFTW'), 'lib')
self.assertEqual(tc.get_variable('FFT_LIB_DIR'), fft_lib_dir)

tc = self.get_toolchain('foss', version='2018a-FFTW.MPI')
tc.set_options({'usempi': True})
tc.prepare()

fft_static_libs = 'libfftw3_mpi.a,libfftw3.a'
self.assertEqual(tc.get_variable('FFT_STATIC_LIBS'), fft_static_libs)
self.assertEqual(tc.get_variable('FFTW_STATIC_LIBS'), fft_static_libs)

self.assertEqual(tc.get_variable('FFT_STATIC_LIBS_MT'), fft_static_libs_mt)
self.assertEqual(tc.get_variable('FFTW_STATIC_LIBS_MT'), fft_static_libs_mt)

self.assertEqual(tc.get_variable('LIBFFT'), '-lfftw3_mpi -lfftw3')
self.assertEqual(tc.get_variable('LIBFFT_MT'), '-lfftw3 -lpthread')

fft_lib_dir = os.path.join(modules.get_software_root('FFTW.MPI'), 'lib')
self.assertEqual(tc.get_variable('FFT_LIB_DIR'), fft_lib_dir)

def test_fft_env_vars_intel(self):
"""Test setting of $FFT* environment variables using intel toolchain."""

Expand Down Expand Up @@ -1168,6 +1222,33 @@ def test_fosscuda(self):
# check CUDA runtime lib
self.assertTrue("-lrt -lcudart" in tc.get_variable('LIBS'))

def setup_sandbox_for_foss_fftw(self, moddir, fftwver='3.3.7'):
"""Set up sandbox for foss FFTW and FFTW.MPI"""
# hack to make foss FFTW lib check pass
# create dummy FFTW and FFTW.MPI modules

fftw_module_path = os.path.join(moddir, 'FFTW', fftwver)
fftw_dir = os.path.join(self.test_prefix, 'software', 'FFTW', fftwver)

fftw_mod_txt = '\n'.join([
"#%Module",
"setenv EBROOTFFTW %s" % fftw_dir,
"setenv EBVERSIONFFTW %s" % fftwver,
])
write_file(fftw_module_path, fftw_mod_txt)

fftw_mpi_module_path = os.path.join(moddir, 'FFTW.MPI', fftwver)
fftw_mpi_dir = os.path.join(self.test_prefix, 'software', 'FFTW.MPI', fftwver)
fftw_mpi_mod_txt = '\n'.join([
"#%Module",
"setenv EBROOTFFTWMPI %s" % fftw_mpi_dir,
"setenv EBVERSIONFFTWMPI %s" % fftwver,
])
write_file(fftw_mpi_module_path, fftw_mpi_mod_txt)

os.makedirs(os.path.join(fftw_dir, 'lib'))
os.makedirs(os.path.join(fftw_mpi_dir, 'lib'))

def setup_sandbox_for_intel_fftw(self, moddir, imklver='2018.1.163'):
"""Set up sandbox for Intel FFTW"""
# hack to make Intel FFTW lib check pass
Expand Down