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?