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

Storage problems with OpenMP

theoryx
Beginner
344 Views
I keep running into this problem using OpenMP where my executable doesn't run and gives me the following error:

OMP: Error#136: Cannot create thread
OMP: System error #8: Not enough storage is available to process this commant
OMP: Error #178: Function GetExitCodeThread() failed:
OMP: System error #6: The handle is invalid

I am using visual fortran with visual studio 2008. In the linker settings I have set stack size to 50 000 000, and the heap size to 1500 000 000. I have made all my arrays "save" and set heap arrays in fortran->optimization to 0.

My computer has 48Gigs of RAM so I know that should not be an issue.

Any help would be greatly appreciated.
0 Kudos
4 Replies
theoryx
Beginner
344 Views
I further realize that if I decrease the stack size it sometimes works? I am very confused!
0 Kudos
Steven_L_Intel1
Employee
344 Views
You may need to set the environment variable KMP_STACKSIZE to a larger value - this specifies the amount of stack per thread.

The amount of RAM is not relevant. What is important is the amount of virtual address space available to a process. Is this a 32-bit or 64-bit application?
0 Kudos
theoryx
Beginner
344 Views
It is a 32-bit application.

Two follow-up questions:
- How do I create a 64-bit application using visual fortran and visual studio 2008?
- How do I set KMP_STACKSIZE?

Thanks.

0 Kudos
TimP
Honored Contributor III
344 Views
For 64-bit application, you must install the Microsoft C++ X64 and the ifort Intel64. Then you can change your project setting to X64. You will need the Windows X64 to run.
KMP_STACKSIZE default will increase to 4MB when you switch to 64-bit compilation. You can control it by the environment variable or by the subroutine call, both in the ifort documentation.
0 Kudos
Reply