Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Compilation openmp的gfortran链接标志_Compilation_Fortran_Openmp_Gfortran - Fatal编程技术网

Compilation openmp的gfortran链接标志

Compilation openmp的gfortran链接标志,compilation,fortran,openmp,gfortran,Compilation,Fortran,Openmp,Gfortran,我正在尝试使用gfortran链接多个.o文件。我像这样编译了文件(在makefile中): 现在我想用OpenMP选项链接这些文件。我知道使用英特尔编译器时,链接标志是-liomp5,因此要使用英特尔编译器链接文件,可以调用: ifort -o a.out file1.o file2.o -liomp5 这显然不是GNU编译器的正确标志。gfortran的正确OpenMP链接标志是什么 它也是-fopenmp: gfortran -fopenmp -o a.out file1.o file2

我正在尝试使用
gfortran
链接多个.o文件。我像这样编译了文件(在makefile中):

现在我想用OpenMP选项链接这些文件。我知道使用英特尔编译器时,链接标志是
-liomp5
,因此要使用英特尔编译器链接文件,可以调用:

ifort -o a.out file1.o file2.o -liomp5

这显然不是GNU编译器的正确标志。
gfortran
的正确OpenMP链接标志是什么

它也是
-fopenmp

gfortran -fopenmp -o a.out file1.o file2.o

谢谢你,亚历山大。因为我正在尝试为Matlab链接mex文件,它仍然不能正常工作,但我很确定这是一个单独的问题。我将编辑我的问题以反映这一点。经过再三考虑,作为一个单独的问题可能更好。@HH,只需通过添加
-lgomp
链接
libgomp
。这就是
-fopenmp
在链接阶段所做的。如果Matlab不使用编译器链接目标文件,则
-fopenmp
将失败。对于Intel,您应该链接
-openmp
-qopenmp
,您的
-liomp5
相当于
-lgfortran
gfortran -fopenmp -o a.out file1.o file2.o