gfortran linking flag for openmp

2019-07-18 06:13发布

I'm trying to link multiple .o files using gfortran. I've compiled the files like so (in a makefile):

gfortran -c -fopenmp file1.f
gfortran -c -fopenmp file2.f

Now I'd like to link the files with an option for OpenMP. I know with the Intel compiler the linking flag is -liomp5, so to link the files with the Intel compiler one would call:

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

This is obviously not the correct flag for the GNU compiler. What is the correct OpenMP linking flag for gfortran?

1条回答
Deceive 欺骗
2楼-- · 2019-07-18 06:28

It is -fopenmp as well:

gfortran -fopenmp -o a.out file1.o file2.o
查看更多
登录 后发表回答