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

Finding source of crashes for Java/C encapsulation of F90 code

holmz
New Contributor I
518 Views

I have ~35k lines of F90 code as a main library and executables.

It all works swimmingly on its own. I wrote a simple program that does the same picture as a geochron (tm) clock.
For my code I then went through the same process and it crashes on the entry to one of the subroutines. The general process is:
get command line arguments
Call subroutine to allocate memory.
Call subroutine to initialise variables, and open debug file.
Call subroutines and functions to check input arguments and then fetch data from binary files.
Call other subroutines... (Fails about the third subroutine in)
Call deallocation subroutine
Call subroutine to close debug file
END

On the F90 I have all the subroutine arguments using INTENT, and I also compiled with -gen-interfaces -check all -warn all -noalign.
No issues in the compiling or the running in the executables. And I have checked the REAL(KIND=8), CHAR, INTEGER etc are all the same size and dimension.

But it does not get to line #1 in the failing subroutine with the java encapsulation.
Any ideas of where to start would be appreciated.

0 Kudos
2 Replies
Steven_L_Intel1
Employee
518 Views

Can you elaborate on "crashes"? What is the full text of the error message? Does the failing subroutine have large local arrays? Does adding "-heap-arrays" help at all?

0 Kudos
jimdempseyatthecove
Honored Contributor III
518 Views

This may apply to Java encapsulation as it applies to C++ encapsulation:

 When the main program is written in C/C++, the C main program needs to call for_rtl_init_ to initialize the Fortran RTL and for_rtl_finish_ at the end of the C main program to shut down the Fortran RTL gracefully.

IVF Documentation | mixed-language programming | overview of issues

Also, make sure that the calling conventions are correct: IVF Documentation | mixed-language programming | calling subprograms

Jim Dempsey

0 Kudos
Reply