2

I am compiling a Fortran program using Visual Studio + Intel Fortran. The program runs fine serially.

However, when I try to parallelize the code stucks and gives me the error: chkstk.asm not found.

The funny thing is that if I decrease the size of some of my arrays the code parallelizes well again and shows no error.

I tried the solution on this link: Go to In the Property Pages for the Solution (not Project), Under Common Properties / Debug Source Files, list the chkstk.asm files under "no debbuging", but with no luck.

Below as well a printscreen of the error.

enter image description here

phdstudent
  • 1,060
  • 20
  • 41
  • 1
    It is just a debugger notification. chkstk.asm is the source file of a CRT function, [__chkstk()](http://stackoverflow.com/questions/8400118/what-is-the-purpose-of-the-chkstk-function). It verifies that your program isn't going to crash with this web site's name. Before it happens, important because when it happens then you have little to look at. Or worse, it might not crash your program but randomly corrupt memory. Pretty typical Fortran problem, it likes big arrays. So what was not supposed to happen did happen, the stack trace tells the story. We can't see it from here. – Hans Passant Jun 17 '16 at 23:32

1 Answers1

2

A problem has occurred in your program and your debugger (Visual Studio in this case) has been notified. Your debugger is then looking for the source code associated with the location of the problem. It cannot find that source code, most likely because you do not have it installed (it is part of the underlying C runtime library).

But you don't particularly need (or want) that source code to understand the nature of the problem.

As per its name, the code in chkstk.asm checks/probes the stack to ensure that there is sufficient space committed on the stack for a stack allocation. Chances are that check failed because there was insufficient stack space. You may be able to use the call stack window to identify the location in your Fortran source code related to the stack allocation - it may be associated with invocation of a procedure (creating storage for the local variables of the function) or an expression (creating storage for temporaries for function results and the like).

Parallel code tends to make much heavier use of the stack because that is a easy way of making storage specific to a particular thread of execution. You generally need to increase the amount of memory reserved for each stack (in the properties for the relevant executable project see under Linker > System > Stack Reserve Size, the default is only 1MB or so, try making it 10MB). You may also want to tell the compiler to use heap based allocations rather than stack based (in the project properties under Fortran > Optimization, set Heap Arrays to 0).

There are numerous posts and articles on the Intel forums for this sort of issue.

IanH
  • 21,026
  • 2
  • 37
  • 59