Skip to content

Commit a69a9b4

Browse files
authored
Merge pull request #3861 from ComputeCanada/imkl-fftw
make intelfftw toolchain component aware of imkl-FFTW module
2 parents c66bf0d + 5d840ce commit a69a9b4

File tree

8 files changed

+277
-5
lines changed

8 files changed

+277
-5
lines changed

easybuild/toolchains/fft/intelfftw.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ def _set_fftw_variables(self):
9595
# so make sure libraries are there before FFT_LIB is set
9696
imklroot = get_software_root(self.FFT_MODULE_NAME[0])
9797
fft_lib_dirs = [os.path.join(imklroot, d) for d in self.FFT_LIB_DIR]
98+
imklfftwroot = get_software_root('imkl-FFTW')
99+
if imklfftwroot:
100+
# only get cluster_interface_lib from seperate module imkl-FFTW, rest via libmkl_gf/libmkl_intel
101+
fft_lib_dirs += [os.path.join(imklfftwroot, 'lib')]
102+
fftw_libs.remove(interface_lib)
103+
fftw_mt_libs.remove(interface_lib)
98104

99105
def fftw_lib_exists(libname):
100106
"""Helper function to check whether FFTW library with specified name exists."""

test/framework/modules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555

5656
# number of modules included for testing purposes
57-
TEST_MODULES_COUNT = 82
57+
TEST_MODULES_COUNT = 87
5858

5959

6060
class ModulesTest(EnhancedTestCase):
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#%Module
2+
proc ModulesHelp { } {
3+
puts stderr {
4+
5+
Description
6+
===========
7+
FFTW interfaces using Intel oneAPI Math Kernel Library
8+
9+
10+
More information
11+
================
12+
- Homepage: https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html
13+
}
14+
}
15+
16+
module-whatis {Description: FFTW interfaces using Intel oneAPI Math Kernel Library}
17+
module-whatis {Homepage: https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html}
18+
module-whatis {URL: https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html}
19+
20+
set root /tmp/imkl-FFTW/2021.4.0
21+
22+
conflict imkl-FFTW
23+
24+
prepend-path CMAKE_PREFIX_PATH $root
25+
prepend-path LD_LIBRARY_PATH $root/lib
26+
prepend-path LIBRARY_PATH $root/lib
27+
setenv EBROOTIMKLMINFFTW "$root"
28+
setenv EBVERSIONIMKLMINFFTW "2021.4.0"
29+
setenv EBDEVELIMKLMINFFTW "$root/easybuild/imkl-FFTW-2021.4.0-easybuild-devel"
30+
31+
# Built with EasyBuild version 4.5.0dev
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#%Module
2+
proc ModulesHelp { } {
3+
puts stderr {
4+
5+
Description
6+
===========
7+
Intel oneAPI Math Kernel Library
8+
9+
10+
More information
11+
================
12+
- Homepage: https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html
13+
}
14+
}
15+
16+
module-whatis {Description: Intel oneAPI Math Kernel Library}
17+
module-whatis {Homepage: https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html}
18+
module-whatis {URL: https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html}
19+
20+
set root /tmp/eb-bI0pBy/eb-DmuEpJ/eb-leoYDw/eb-UtJJqp/tmp8P3FOY
21+
22+
conflict imkl
23+
24+
prepend-path CMAKE_PREFIX_PATH $root
25+
prepend-path CPATH $root/mkl/2021.4.0/include
26+
prepend-path CPATH $root/mkl/2021.4.0/include/fftw
27+
prepend-path LD_LIBRARY_PATH $root/compiler/2021.4.0/linux/compiler/lib/intel64_lin
28+
prepend-path LD_LIBRARY_PATH $root/mkl/2021.4.0/lib/intel64
29+
prepend-path LIBRARY_PATH $root/compiler/2021.4.0/linux/compiler/lib/intel64_lin
30+
prepend-path LIBRARY_PATH $root/mkl/2021.4.0/lib/intel64
31+
setenv EBROOTIMKL "$root"
32+
setenv EBVERSIONIMKL "2021.4.0"
33+
setenv EBDEVELIMKL "$root/easybuild/Core-imkl-2021.4.0-easybuild-devel"
34+
35+
setenv MKL_EXAMPLES "$root/mkl/2021.4.0/examples"
36+
setenv MKLROOT "$root/mkl/2021.4.0"
37+
# Built with EasyBuild version 4.5.0dev
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#%Module
2+
proc ModulesHelp { } {
3+
puts stderr {
4+
5+
Description
6+
===========
7+
Intel MPI Library, compatible with MPICH ABI
8+
9+
10+
More information
11+
================
12+
- Homepage: https://software.intel.com/content/www/us/en/develop/tools/mpi-library.html
13+
}
14+
}
15+
16+
module-whatis {Description: Intel MPI Library, compatible with MPICH ABI}
17+
module-whatis {Homepage: https://software.intel.com/content/www/us/en/develop/tools/mpi-library.html}
18+
module-whatis {URL: https://software.intel.com/content/www/us/en/develop/tools/mpi-library.html}
19+
20+
set root /tmp/impi/2021.4.0
21+
22+
conflict impi
23+
24+
prepend-path CMAKE_PREFIX_PATH $root
25+
prepend-path CPATH $root/mpi/2021.4.0/include
26+
prepend-path FI_PROVIDER_PATH $root/mpi/2021.4.0/libfabric/lib/prov
27+
prepend-path LD_LIBRARY_PATH $root/mpi/2021.4.0/lib
28+
prepend-path LD_LIBRARY_PATH $root/mpi/2021.4.0/lib/release
29+
prepend-path LD_LIBRARY_PATH $root/mpi/2021.4.0/libfabric/lib
30+
prepend-path LIBRARY_PATH $root/mpi/2021.4.0/lib
31+
prepend-path LIBRARY_PATH $root/mpi/2021.4.0/lib/release
32+
prepend-path LIBRARY_PATH $root/mpi/2021.4.0/libfabric/lib
33+
prepend-path MANPATH $root/mpi/2021.4.0/man
34+
prepend-path PATH $root/mpi/2021.4.0/bin
35+
prepend-path PATH $root/mpi/2021.4.0/libfabric/bin
36+
setenv EBROOTIMPI "$root"
37+
setenv EBVERSIONIMPI "2021.4.0"
38+
setenv EBDEVELIMPI "$root/easybuild/impi-2021.4.0-easybuild-devel"
39+
40+
setenv I_MPI_ROOT "$root/mpi/2021.4.0"
41+
setenv UCX_TLS "all"
42+
# Built with EasyBuild version 4.5.0dev
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#%Module
2+
proc ModulesHelp { } {
3+
puts stderr {
4+
5+
Description
6+
===========
7+
Intel C, C++ & Fortran compilers (classic and oneAPI)
8+
9+
10+
More information
11+
================
12+
- Homepage: https://software.intel.com/content/www/us/en/develop/tools/oneapi/hpc-toolkit.html
13+
}
14+
}
15+
16+
module-whatis {Description: Intel C, C++ & Fortran compilers (classic and oneAPI)}
17+
module-whatis {Homepage: https://software.intel.com/content/www/us/en/develop/tools/oneapi/hpc-toolkit.html}
18+
module-whatis {URL: https://software.intel.com/content/www/us/en/develop/tools/oneapi/hpc-toolkit.html}
19+
20+
set root /tmp/intel-compilers/2021.4.0
21+
22+
conflict intel-compilers
23+
24+
prepend-path CPATH $root/tbb/2021.4.0/include
25+
prepend-path LD_LIBRARY_PATH $root/compiler/2021.4.0/linux/lib
26+
prepend-path LD_LIBRARY_PATH $root/compiler/2021.4.0/linux/lib/x64
27+
prepend-path LD_LIBRARY_PATH $root/compiler/2021.4.0/linux/compiler/lib/intel64_lin
28+
prepend-path LD_LIBRARY_PATH $root/tbb/2021.4.0/lib/intel64/gcc4.8
29+
prepend-path LIBRARY_PATH $root/compiler/2021.4.0/linux/lib
30+
prepend-path LIBRARY_PATH $root/compiler/2021.4.0/linux/lib/x64
31+
prepend-path LIBRARY_PATH $root/compiler/2021.4.0/linux/compiler/lib/intel64_lin
32+
prepend-path LIBRARY_PATH $root/tbb/2021.4.0/lib/intel64/gcc4.8
33+
prepend-path OCL_ICD_FILENAMES $root/compiler/2021.4.0/linux/lib/x64/libintelocl.so
34+
prepend-path PATH $root/compiler/2021.4.0/linux/bin
35+
prepend-path PATH $root/compiler/2021.4.0/linux/bin/intel64
36+
prepend-path TBBROOT $root/tbb/2021.4.0
37+
setenv EBROOTINTELMINCOMPILERS "$root"
38+
setenv EBVERSIONINTELMINCOMPILERS "2021.4.0"
39+
setenv EBDEVELINTELMINCOMPILERS "$root/easybuild/Core-intel-compilers-2021.4.0-easybuild-devel"
40+
41+
# Built with EasyBuild version 4.5.0dev

test/framework/modules/intel/2021b

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#%Module
2+
3+
proc ModulesHelp { } {
4+
puts stderr { Intel Cluster Toolkit Compiler Edition provides Intel C/C++ and Fortran compilers, Intel MPI & Intel MKL. - Homepage: http://software.intel.com/en-us/intel-cluster-toolkit-compiler/
5+
}
6+
}
7+
8+
module-whatis {Intel Cluster Toolkit Compiler Edition provides Intel C/C++ and Fortran compilers, Intel MPI & Intel MKL. - Homepage: http://software.intel.com/en-us/intel-cluster-toolkit-compiler/}
9+
10+
set root /tmp/intel/2021b
11+
12+
conflict intel
13+
14+
if { ![is-loaded intel-compilers/2021.4.0] } {
15+
module load intel-compilers/2021.4.0
16+
}
17+
18+
if { ![is-loaded impi/2021.4.0] } {
19+
module load impi/2021.4.0
20+
}
21+
22+
if { ![is-loaded imkl/2021.4.0] } {
23+
module load imkl/2021.4.0
24+
}
25+
26+
if { ![is-loaded imkl-FFTW/2021.4.0] } {
27+
module load imkl-FFTW/2021.4.0
28+
}
29+
30+
31+
setenv EBROOTINTEL "$root"
32+
setenv EBVERSIONINTEL "2021b"
33+
setenv EBDEVELINTEL "$root/easybuild/intel-2021b-easybuild-devel"
34+
35+
36+
# built with EasyBuild version 4.5.0dev

test/framework/toolchain.py

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,7 @@ def test_fft_env_vars_foss(self):
10201020
def test_fft_env_vars_intel(self):
10211021
"""Test setting of $FFT* environment variables using intel toolchain."""
10221022

1023+
self.modtool.purge()
10231024
self.setup_sandbox_for_intel_fftw(self.test_prefix)
10241025
self.modtool.prepend_module_path(self.test_prefix)
10251026

@@ -1079,6 +1080,64 @@ def test_fft_env_vars_intel(self):
10791080
libfft_mt += '-Wl,-Bdynamic -liomp5 -lpthread'
10801081
self.assertEqual(tc.get_variable('LIBFFT_MT'), libfft_mt)
10811082

1083+
self.modtool.purge()
1084+
self.setup_sandbox_for_intel_fftw(self.test_prefix, imklver='2021.4.0')
1085+
tc = self.get_toolchain('intel', version='2021b')
1086+
tc.prepare()
1087+
1088+
fft_static_libs = 'libmkl_intel_lp64.a,libmkl_sequential.a,libmkl_core.a'
1089+
self.assertEqual(tc.get_variable('FFT_STATIC_LIBS'), fft_static_libs)
1090+
self.assertEqual(tc.get_variable('FFTW_STATIC_LIBS'), fft_static_libs)
1091+
1092+
fft_static_libs_mt = 'libmkl_intel_lp64.a,libmkl_intel_thread.a,libmkl_core.a,'
1093+
fft_static_libs_mt += 'libiomp5.a,libpthread.a'
1094+
self.assertEqual(tc.get_variable('FFT_STATIC_LIBS_MT'), fft_static_libs_mt)
1095+
self.assertEqual(tc.get_variable('FFTW_STATIC_LIBS_MT'), fft_static_libs_mt)
1096+
1097+
libfft = "-Wl,-Bstatic -Wl,--start-group -lmkl_intel_lp64 -lmkl_sequential -lmkl_core "
1098+
libfft += "-Wl,--end-group -Wl,-Bdynamic"
1099+
self.assertEqual(tc.get_variable('LIBFFT'), libfft)
1100+
1101+
libfft_mt = "-Wl,-Bstatic -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core "
1102+
libfft_mt += "-Wl,--end-group -Wl,-Bdynamic -liomp5 -lpthread"
1103+
self.assertEqual(tc.get_variable('LIBFFT_MT'), libfft_mt)
1104+
1105+
tc = self.get_toolchain('intel', version='2021b')
1106+
tc.set_options({'openmp': True})
1107+
tc.prepare()
1108+
1109+
self.assertEqual(tc.get_variable('FFT_STATIC_LIBS'), fft_static_libs)
1110+
self.assertEqual(tc.get_variable('FFTW_STATIC_LIBS'), fft_static_libs)
1111+
1112+
self.assertEqual(tc.get_variable('FFT_STATIC_LIBS_MT'), fft_static_libs_mt)
1113+
self.assertEqual(tc.get_variable('FFTW_STATIC_LIBS_MT'), fft_static_libs_mt)
1114+
1115+
self.assertEqual(tc.get_variable('LIBFFT'), libfft)
1116+
self.assertEqual(tc.get_variable('LIBFFT_MT'), libfft_mt)
1117+
1118+
tc = self.get_toolchain('intel', version='2021b')
1119+
tc.set_options({'usempi': True})
1120+
tc.prepare()
1121+
1122+
fft_static_libs = 'libfftw3x_cdft_lp64.a,libmkl_cdft_core.a,libmkl_blacs_intelmpi_lp64.a,'
1123+
fft_static_libs += 'libmkl_intel_lp64.a,libmkl_sequential.a,libmkl_core.a'
1124+
self.assertEqual(tc.get_variable('FFT_STATIC_LIBS'), fft_static_libs)
1125+
self.assertEqual(tc.get_variable('FFTW_STATIC_LIBS'), fft_static_libs)
1126+
1127+
fft_static_libs_mt = 'libfftw3x_cdft_lp64.a,libmkl_cdft_core.a,libmkl_blacs_intelmpi_lp64.a,'
1128+
fft_static_libs_mt += 'libmkl_intel_lp64.a,libmkl_intel_thread.a,libmkl_core.a,libiomp5.a,libpthread.a'
1129+
self.assertEqual(tc.get_variable('FFT_STATIC_LIBS_MT'), fft_static_libs_mt)
1130+
self.assertEqual(tc.get_variable('FFTW_STATIC_LIBS_MT'), fft_static_libs_mt)
1131+
1132+
libfft = '-Wl,-Bstatic -Wl,--start-group -lfftw3x_cdft_lp64 -lmkl_cdft_core '
1133+
libfft += '-lmkl_blacs_intelmpi_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -Wl,--end-group -Wl,-Bdynamic'
1134+
self.assertEqual(tc.get_variable('LIBFFT'), libfft)
1135+
1136+
libfft_mt = '-Wl,-Bstatic -Wl,--start-group -lfftw3x_cdft_lp64 -lmkl_cdft_core '
1137+
libfft_mt += '-lmkl_blacs_intelmpi_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group '
1138+
libfft_mt += '-Wl,-Bdynamic -liomp5 -lpthread'
1139+
self.assertEqual(tc.get_variable('LIBFFT_MT'), libfft_mt)
1140+
10821141
def test_fosscuda(self):
10831142
"""Test whether fosscuda is handled properly."""
10841143
tc = self.get_toolchain("fosscuda", version="2018a")
@@ -1124,17 +1183,37 @@ def setup_sandbox_for_intel_fftw(self, moddir, imklver='2018.1.163'):
11241183
])
11251184
write_file(imkl_module_path, imkl_mod_txt)
11261185

1127-
fftw_libs = ['fftw3xc_intel', 'fftw3xc_pgi', 'mkl_cdft_core', 'mkl_blacs_intelmpi_lp64']
1128-
fftw_libs += ['mkl_intel_lp64', 'mkl_sequential', 'mkl_core', 'mkl_intel_ilp64']
1186+
mkl_libs = ['mkl_cdft_core', 'mkl_blacs_intelmpi_lp64']
1187+
mkl_libs += ['mkl_intel_lp64', 'mkl_sequential', 'mkl_core', 'mkl_intel_ilp64']
1188+
fftw_libs = ['fftw3xc_intel', 'fftw3xc_pgi']
11291189
if LooseVersion(imklver) >= LooseVersion('11'):
11301190
fftw_libs.extend(['fftw3x_cdft_ilp64', 'fftw3x_cdft_lp64'])
11311191
else:
11321192
fftw_libs.append('fftw3x_cdft')
11331193

1134-
for subdir in ['mkl/lib/intel64', 'compiler/lib/intel64', 'lib/em64t']:
1194+
if LooseVersion(imklver) >= LooseVersion('2021.4.0'):
1195+
imkl_fftw_module_path = os.path.join(moddir, 'imkl-FFTW', imklver)
1196+
imkl_fftw_dir = os.path.join(self.test_prefix, 'software', 'imkl-FFTW', imklver)
1197+
imkl_fftw_mod_txt = '\n'.join([
1198+
"#%Module",
1199+
"setenv EBROOTIMKLMINFFTW %s" % imkl_fftw_dir,
1200+
"setenv EBVERSIONIMKLMINFFTW %s" % imklver,
1201+
])
1202+
write_file(imkl_fftw_module_path, imkl_fftw_mod_txt)
1203+
1204+
subdir = 'mkl/%s/lib/intel64' % imklver
11351205
os.makedirs(os.path.join(imkl_dir, subdir))
1136-
for fftlib in fftw_libs:
1206+
for fftlib in mkl_libs:
11371207
write_file(os.path.join(imkl_dir, subdir, 'lib%s.a' % fftlib), 'foo')
1208+
subdir = 'lib'
1209+
os.makedirs(os.path.join(imkl_fftw_dir, subdir))
1210+
for fftlib in fftw_libs:
1211+
write_file(os.path.join(imkl_fftw_dir, subdir, 'lib%s.a' % fftlib), 'foo')
1212+
else:
1213+
for subdir in ['mkl/lib/intel64', 'compiler/lib/intel64', 'lib/em64t']:
1214+
os.makedirs(os.path.join(imkl_dir, subdir))
1215+
for fftlib in mkl_libs + fftw_libs:
1216+
write_file(os.path.join(imkl_dir, subdir, 'lib%s.a' % fftlib), 'foo')
11381217

11391218
def test_intel_toolchain(self):
11401219
"""Test for intel toolchain."""

0 commit comments

Comments
 (0)