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

Mixed Language vs. Standalone Program Output - Hints on Finding Error

Ryan_Noll
Beginner
360 Views

Hello,

I am currently working on a mixed language program involving C/C++ and Fortran; and I am currently running in to a problem with the output generated from the mixed language program. The program consists of 3 projects:

  1. Fortran static library,
  2. C/C++ static library (Fortran static library as dependency and listed as a required library), and
  3. C/C++ main program which pulls the C/C++ static library.

All of the projects compile and link to create an executable.

I am porting over some software that was originally implemented in S-Fortran from a mainframe (the source material). The S-Fortran source was transformed to Fortran-V and the transformed Fortran-V source is what I am using to build the new software.

In order to find the problem with my algorithm, I wrote a standalone program using the source material. I then took the source code from this program and integrated it in to the mixed language program.

The standalone program produced good comparisons that compared well to another implementation. However, when using the same code in the mixed language program the results do not match with the standalone program. When copying the source in to the mixed language program, some minor changes a minor change of adding "_x" was added where needed to not conflict with existing routines. The reason for this is to compare with another set of algorithms already implemented--the two internal algorithms compare well with each other.

I am having difficulty figuring out what I had done wrong between the standalone program and mixed language version. Has anyone ran in to this problem before, and if so, any hints on where the problem could be would be greatly appreciated. help!?

I have tried recreating the project files in the mixed language program, and that seemed to at least have the two algorithms in the mixed language program compare well with each other but did not compare well with the standalone program. I have also tried disabling the whole program optimization setting, in the C/C++ projects, but that did not solve the problem.

Summary: The two algorithms that are implemented/internal to the mixed language program compare well with each other. However, when comparing to the output from the external program the results do not compare well.

Software Versions:

  1. Visual Studio Professional 2017, 15.9.14
  2. Intel Parallel Studio XE 2019 Update 4, Composer Edition for Fortran Windows Package ID: w_comp_lib_2019.4.245
  3. Integration for Visual Studio 2017, Version 19.0.0052.15

Any help/hints would be greatly appreciated.

Respectfully and Thank You,

Ryan

0 Kudos
1 Solution
jimdempseyatthecove
Honored Contributor III
360 Views

Can you run the stand alone program and the mixed language program side-by-side with the addition of data comparisons between the two implementations. The intention is to observe where the intermediary results diverge.

Jim Dempsey

View solution in original post

0 Kudos
2 Replies
jimdempseyatthecove
Honored Contributor III
361 Views

Can you run the stand alone program and the mixed language program side-by-side with the addition of data comparisons between the two implementations. The intention is to observe where the intermediary results diverge.

Jim Dempsey

0 Kudos
Ryan_Noll
Beginner
360 Views

Jim,

Thank you. I was able to run both programs side-by-side and determined that some input data was slightly off. I was able to verify that updating some input data to the standalone program resulted in the same output as the mixed language version.

Thank you again for the fresh perspective!

Respectfully,

Ryan

0 Kudos
Reply