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

Compilation of Fortran Code in VS 2022

Jaensch
Beginner
906 Views

Hello,

At the moment I am trying to compile an older .F file for a combustion model in GT Power.
In the next step, I want to make some changes to the older .F combustion model. But first, I want to find a solution to compile the Fortran code.

 

Using the procedure from the UserCode.pdf and Visual Studio, I can build a .dll file.

But if I use the same GT model for the older .dll and for the new .dll, I do not get the same results.
In both cases, however, I used the same .F code and the same GT model.

 

So I think the only difference is the compiler. Because now I use Visual Studio 2022, and the older .dll it was 2015. But should the compiler affect the results, or did I overlook something?

 

Here are the Setups:

 

My old setup in GT 2024:

  • GT version: v2024
  • Fortran code
  • UserCodeReference folder used: %GTIHOME%\v2020\usercode\Fortran\UserCodeReference
  • Microsoft Visual Studio: version 2015 à Intel Parallel Studio XE 2017
  • Binary file: .dll generated from the above
  • Results: stored after running the GT v2024 model with the .dll

 

My current setup:

  • GT version: v2024
  • Fortan code (unchanged)
  • UserCodeReference folder used: %GTIHOME%\v2020\usercode\Fortran\UserCodeReference
  • Microsoft Visual Studio: version 2022 à Intel® Fortran Compiler 2025.3.2 [Intel(R) 64]
  • Binary file: .dll generated from the above
  • Results: stored after running the GT v2024 model with the .dll

     

     

     

     

     

    I know it is difficult to present a solution with so little information, but maybe anybody have a few ideas about what it could be caused by.

    Thanks for any helpt!

Best regards,

Jaensch

0 Kudos
1 Solution
jimdempseyatthecove
Honored Contributor III
882 Views

This may be a floating point issue.

First try disabling optimizations.

That failing, in the project properties, try setting the

Properties | Fortran | Code Generation | Intel Processor-Specific Optimization | (pull down) ...

and select older ISA (QxSSE3, or QxAVX).

 

Jim Dempsey

View solution in original post

0 Kudos
4 Replies
jimdempseyatthecove
Honored Contributor III
883 Views

This may be a floating point issue.

First try disabling optimizations.

That failing, in the project properties, try setting the

Properties | Fortran | Code Generation | Intel Processor-Specific Optimization | (pull down) ...

and select older ISA (QxSSE3, or QxAVX).

 

Jim Dempsey

0 Kudos
Jaensch
Beginner
859 Views

Thank you very much!!!

Disabling optimizations works! Now it gives me the same results.

But why did that work? What exactly is the compiler doing differently now?

0 Kudos
witwald
New Contributor II
836 Views

@Jaensch, from your description, it appears that the original code was compiled with optimizations off. Whoever did that was a defensive programmer. When performing optimizations, the compiler writes object code that it thinks will improve the speed of execution in comparison to the non-optimized object code. As you have encountered, there may be differences in the results that are produced by optimized and non-optimized code. With any program, particularly larger codebases, it may be prudent to initially compile with all optimizations turned off. In my experience, this seems to be a reasonable and robust approach to take.

0 Kudos
Jaensch
Beginner
774 Views

Thank you for the explanation!

0 Kudos
Reply