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

FORTRAN Code converges slow in Intel Fortran Compiler as Compared to the Digital visual FORTRAN

Qaiser_Bozdar
Novice
1,173 Views

I have a code that compiles smoothly in Microsoft Visual Developer using Digital visual FORTRAN Professional Edition 5.0A compiler in Win-XP in a virtual box (Oracle) in a INTEL I7 computer having (RAM 16GB). All arrays are declared for example as A(100),B(100),etc. The code executable file converges within 4 minutes. The Code output is correct as per scientific literature and calculations.

I have updated the code as per FORTRAN 90/95. I declared arrays as A(0:100), B(0:100), due to the upper bound error which is 1. Now code takes relatively large time to converge, it takes around 35 minutes, and also have a difference in output as compared to previous version of the code. I am using MVS-2022 and Intel FORTRAN compiler (2024 latest) in an intel I7 computer having (RAM 16GB).

I just changed the array format from A(100) to A(0:100). All of the arrays.

Both codes take 636 iterations to converge to a certain result.

I have also tested the code (old version executable file) in my personal computer, it takes around 11 minutes to converge with correct results. I have a Intel core m3 (8GB RAM). I have tested it again then it converged in 14 minutes.

Qaiser_Bozdar_3-1721244432167.png

Qaiser_Bozdar_0-1721161032199.png

Qaiser_Bozdar_4-1721244474937.png

Qaiser_Bozdar_5-1721244501832.png

 

Look at the following variable declaration (Old code)

Qaiser_Bozdar_0-1721244032859.png

Look at the following variable declaration (New code)

Qaiser_Bozdar_1-1721244303420.png

My task is to converge the code within less time as compared to the old version which converges within 4-mintues with correct results.

0 Kudos
4 Replies
andrew_4619
Honored Contributor III
1,119 Views
I would suggest showing your compile options. We can only make wild guesses from the information given.
0 Kudos
Qaiser_Bozdar
Novice
1,017 Views

Qaiser_Bozdar_0-1721323582281.pngQaiser_Bozdar_1-1721323607114.png

I suppose this is the debug configuration.

 

0 Kudos
andrew_4619
Honored Contributor III
986 Views

debug has all optimisation disabled and has additional code checking, it is much slower than release builds. look at the project properties page also.

 

andrew_4619_0-1721341857825.png

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
930 Views

If your old code used static arrays A(100), B(100), your test code should ALLOCATE(A(100), B(100)...), or if you wish to be more specific, ALLOCATE(A(1:100), B(1:100), ...), .NOT. A(0:100)

Not doing so can result in:

CALL FOO(A)

...

SUBROUTINE FOO(A)

   REAL A(100)

   REAL SUMPTN

   SUMPTN = A(1) ! this references the 1st location of the dummy argument A, which is the caller's actual argument A(0).

 

This may be the cause of your different results.

 

If you need to rearrange your code to use zero based arrays, then you need to check for and correct such errors in programming.

 

Jim Dempsey

0 Kudos
Reply