@@ -1017,6 +1017,60 @@ def test_fft_env_vars_foss(self):
10171017 self .assertEqual (tc .get_variable ('LIBFFT' ), '-lfftw3_mpi -lfftw3' )
10181018 self .assertEqual (tc .get_variable ('LIBFFT_MT' ), '-lfftw3 -lpthread' )
10191019
1020+ self .modtool .purge ()
1021+ self .setup_sandbox_for_foss_fftw (self .test_prefix )
1022+ self .modtool .prepend_module_path (self .test_prefix )
1023+
1024+ tc = self .get_toolchain ('foss' , version = '2018a-FFTW.MPI' )
1025+ tc .prepare ()
1026+
1027+ fft_static_libs = 'libfftw3.a'
1028+ self .assertEqual (tc .get_variable ('FFT_STATIC_LIBS' ), fft_static_libs )
1029+ self .assertEqual (tc .get_variable ('FFTW_STATIC_LIBS' ), fft_static_libs )
1030+
1031+ fft_static_libs_mt = 'libfftw3.a,libpthread.a'
1032+ self .assertEqual (tc .get_variable ('FFT_STATIC_LIBS_MT' ), fft_static_libs_mt )
1033+ self .assertEqual (tc .get_variable ('FFTW_STATIC_LIBS_MT' ), fft_static_libs_mt )
1034+
1035+ self .assertEqual (tc .get_variable ('LIBFFT' ), '-lfftw3' )
1036+ self .assertEqual (tc .get_variable ('LIBFFT_MT' ), '-lfftw3 -lpthread' )
1037+
1038+ fft_lib_dir = os .path .join (modules .get_software_root ('FFTW' ), 'lib' )
1039+ self .assertEqual (tc .get_variable ('FFT_LIB_DIR' ), fft_lib_dir )
1040+
1041+ tc = self .get_toolchain ('foss' , version = '2018a-FFTW.MPI' )
1042+ tc .set_options ({'openmp' : True })
1043+ tc .prepare ()
1044+
1045+ self .assertEqual (tc .get_variable ('FFT_STATIC_LIBS' ), fft_static_libs )
1046+ self .assertEqual (tc .get_variable ('FFTW_STATIC_LIBS' ), fft_static_libs )
1047+
1048+ self .assertEqual (tc .get_variable ('FFT_STATIC_LIBS_MT' ), 'libfftw3_omp.a,' + fft_static_libs_mt )
1049+ self .assertEqual (tc .get_variable ('FFTW_STATIC_LIBS_MT' ), 'libfftw3_omp.a,' + fft_static_libs_mt )
1050+
1051+ self .assertEqual (tc .get_variable ('LIBFFT' ), '-lfftw3' )
1052+ self .assertEqual (tc .get_variable ('LIBFFT_MT' ), '-lfftw3_omp -lfftw3 -lpthread' )
1053+
1054+ fft_lib_dir = os .path .join (modules .get_software_root ('FFTW' ), 'lib' )
1055+ self .assertEqual (tc .get_variable ('FFT_LIB_DIR' ), fft_lib_dir )
1056+
1057+ tc = self .get_toolchain ('foss' , version = '2018a-FFTW.MPI' )
1058+ tc .set_options ({'usempi' : True })
1059+ tc .prepare ()
1060+
1061+ fft_static_libs = 'libfftw3_mpi.a,libfftw3.a'
1062+ self .assertEqual (tc .get_variable ('FFT_STATIC_LIBS' ), fft_static_libs )
1063+ self .assertEqual (tc .get_variable ('FFTW_STATIC_LIBS' ), fft_static_libs )
1064+
1065+ self .assertEqual (tc .get_variable ('FFT_STATIC_LIBS_MT' ), fft_static_libs_mt )
1066+ self .assertEqual (tc .get_variable ('FFTW_STATIC_LIBS_MT' ), fft_static_libs_mt )
1067+
1068+ self .assertEqual (tc .get_variable ('LIBFFT' ), '-lfftw3_mpi -lfftw3' )
1069+ self .assertEqual (tc .get_variable ('LIBFFT_MT' ), '-lfftw3 -lpthread' )
1070+
1071+ fft_lib_dir = os .path .join (modules .get_software_root ('FFTW.MPI' ), 'lib' )
1072+ self .assertEqual (tc .get_variable ('FFT_LIB_DIR' ), fft_lib_dir )
1073+
10201074 def test_fft_env_vars_intel (self ):
10211075 """Test setting of $FFT* environment variables using intel toolchain."""
10221076
@@ -1174,6 +1228,33 @@ def test_fosscuda(self):
11741228 # check CUDA runtime lib
11751229 self .assertTrue ("-lrt -lcudart" in tc .get_variable ('LIBS' ))
11761230
1231+ def setup_sandbox_for_foss_fftw (self , moddir , fftwver = '3.3.7' ):
1232+ """Set up sandbox for foss FFTW and FFTW.MPI"""
1233+ # hack to make foss FFTW lib check pass
1234+ # create dummy FFTW and FFTW.MPI modules
1235+
1236+ fftw_module_path = os .path .join (moddir , 'FFTW' , fftwver )
1237+ fftw_dir = os .path .join (self .test_prefix , 'software' , 'FFTW' , fftwver )
1238+
1239+ fftw_mod_txt = '\n ' .join ([
1240+ "#%Module" ,
1241+ "setenv EBROOTFFTW %s" % fftw_dir ,
1242+ "setenv EBVERSIONFFTW %s" % fftwver ,
1243+ ])
1244+ write_file (fftw_module_path , fftw_mod_txt )
1245+
1246+ fftw_mpi_module_path = os .path .join (moddir , 'FFTW.MPI' , fftwver )
1247+ fftw_mpi_dir = os .path .join (self .test_prefix , 'software' , 'FFTW.MPI' , fftwver )
1248+ fftw_mpi_mod_txt = '\n ' .join ([
1249+ "#%Module" ,
1250+ "setenv EBROOTFFTWMPI %s" % fftw_mpi_dir ,
1251+ "setenv EBVERSIONFFTWMPI %s" % fftwver ,
1252+ ])
1253+ write_file (fftw_mpi_module_path , fftw_mpi_mod_txt )
1254+
1255+ os .makedirs (os .path .join (fftw_dir , 'lib' ))
1256+ os .makedirs (os .path .join (fftw_mpi_dir , 'lib' ))
1257+
11771258 def setup_sandbox_for_intel_fftw (self , moddir , imklver = '2018.1.163' ):
11781259 """Set up sandbox for Intel FFTW"""
11791260 # hack to make Intel FFTW lib check pass
0 commit comments