Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28506 Discussions

What are the equivalent compilation options for gfort given the ifort compilation?

NC1
Beginner
728 Views
 

I am trying to compile a code using gfortran instead of ifortran. The gfortran code runs much much slower than the ifortran code. It does not even use all threads from my computer. I have 40 cores and 80 threads. ifort uses all of them.I think it has to do with the ifort flag /Qm64 but can't be sure (using the /Qm32 flag on ifort is slower and does not use all the threads on openmp - not sure why).

This is the way that visual studio seems to be compiling my code:

Compiling with Intel® Fortran Compiler Classic 2021.4.0 [Intel(R) 64]...
ifort /nologo /O2 /Qopenmp /module:"x64\Release\\" /object:"x64\Release\\" /Fd"x64\Release\vc160.pdb" /libs:dll /threads /c /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64" /Qm64 "D:\test\main1.f90"
Linking...
Link /OUT:"x64\Release\DebtDuration.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"x64\Release\DebtDuration.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /STACK:999999999 /IMPLIB:"D:\test\x64\Release\DebtDuration.lib" -qm64 "x64\Release\splint.obj" "x64\Release\linspace.obj" "x64\Release\random_normal.obj" "x64\Release\spline.obj" "x64\Release\rouwenhorst.obj" "x64\Release\bspline_sub_module.obj" "x64\Release\main1.obj"
Embedding manifest...

Here's how I was trying to compile in gfortran:

gfortran -c -m64 -O2 bspline_sub_module.f90 
gfortran -w -ffree-form -ffree-line-length-0 -m64 -O2 -fopenmp main1.f90 random_normal.f90 linspace.f90 bspline_sub_module.o rouwenhorst.f90 spline.f90 splint.f90

What am I doing wrong?

0 Kudos
3 Replies
FortranFan
Honored Contributor II
704 Views

@NC1 ,

 

Given the nature of your question, you may want to consider inquiring at another forum such as Fortran Discourse where a significant fraction of the readers do use gfortran and can offer their input and guidance:

https://fortran-lang.discourse.group/

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
676 Views

You may need to add -qopenmp to your gfortran compilation of bspline_sub_module (if it contains !$omp directives).

Jim Dempsey

0 Kudos
NC1
Beginner
668 Views

@FortranFran, I will try to ask there as well, thank you. @ jimdempseyatthecove, there are no !$opm directives on that module.

0 Kudos
Reply