3030 print (line )
3131 test_name = line .split ()[0 ]
3232 test_names .append (test_name )
33+ print ("Test names: " , test_names )
34+
35+ def uses_openmp (lib_path ):
36+ try :
37+ out = subprocess .check_output (["nm" , "-g" , lib_path ], text = True )
38+ return "_GOMP_parallel" in out
39+ except Exception :
40+ return False
3341
3442def build_fortran_test (test_name ):
3543 os .makedirs (temp_test_dir , exist_ok = True )
3644 # make using a fortran compiler
3745 # point to raffle's pip install include and lib to include during compilation
3846
39- build_result = subprocess .run (
40- [
47+ if uses_openmp (os .path .join (lib_dir , "libraffle.dylib" )):
48+ compile_args = ["-fopenmp" , "-lgomp" ]
49+ else :
50+ compile_args = []
51+
52+ compile_list = [
4153 fc , "-o" , test_name + ".o" ,
4254 "../../test/test_io_utils.f90" ,
55+ " " .join (compile_args ),
4356 "-I" , include_dir ,
4457 "-I" , etc_dir ,
4558 "-L" , lib_dir ,
4659 "-lraffle"
47- ],
60+ ]
61+ build_result = subprocess .run (
62+ compile_list ,
4863 cwd = temp_test_dir
4964 )
5065 return build_result
@@ -271,4 +286,4 @@ def test_fortran(self, test_name):
271286 self .assertEqual (run_result .returncode , 0 )
272287
273288if __name__ == '__main__' :
274- unittest .main ()
289+ unittest .main ()
0 commit comments