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

Strange stack error causes program terminated without an error

yang__xiaodong
New Contributor I
4,660 Views

 

I'm an experienced fortran programmer, yet a really strange problem confused me.

As mentioned, the program terminates occasionally after the output

"============================ start performing inversion ..."

It seems a stack smash occurs.

The visual studio 2019 project (with oneapi 2021.3 installed) and needed files are attached. You could run the program with

DCFI3D -a mod1

MKL libraries are needed. Could anyone help find the error? Thanks very much.

0 Kudos
1 Solution
yang__xiaodong
New Contributor I
4,309 Views

Okay, now I find where the problem is.

It is because that when I use the MKL subroutine mkl_sparse_d_mm that has a proto of 

stat = mkl_sparse_d_mm (operation, alpha,A, descr, layout, B, columns, ldb,beta, C,ldc)

I declare the variable columns larger than what I need. Thus, it results in a C which takes more memory space than expected. This further causes heap corruption, and no error message could be generated by the Fortran compiler. 

View solution in original post

23 Replies
jimdempseyatthecove
Honored Contributor III
684 Views

Yang, I wish to thank you for replying with the solution to your problem. This is valuable information for others reading this forum thread.

Jim Dempsey

0 Kudos
JohnNichols
Valued Contributor III
648 Views

@yang__xiaodong  - jolly well done.   

 

Next question, what are you using the mesh for? 

0 Kudos
yang__xiaodong
New Contributor I
621 Views

HAPPY solving the problem.

The mesh is used for finite element solving of a large size 3-D direct current electrostatic problem. In which geophysicists eject electric current into the ground, and voltages are measured elsewhere.

As a boundary condition V=0 is applied, the mesh must be large enough to ensure the voltage shrinks.

I think, why the error is hard to find, is because that the MKL interface, including the mkl_sparse_d_mm subroutine, may have a C proto and then be converted to Fortran. Thus, not enough info could be captured by the Fortran compiler.

0 Kudos
Reply