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

Stackoverflow ifort

NC1
Beginner
582 Views

 

I am having some issues with setting the size of the stack when compiling a fortran code via command line.

When I use Visual Studio with ifort, I know that I can go to: Properties → Linker → System and then change the Stack Commit/Reserve size.

Now if I open Intel oneAPI command prompt for Intel 64 for Visual Studio 2019, I am usually able to compile my codes by doing:

 

ifort -O2 -c -Qopenmp module_master.f90
ifort -O2 -c -Qopenmp main_program.f90
ifort -o main.out -O2 -Qopenmp main_program.f90 module_master.f90

When I run the file I get a stackoverflow error. I tried doing:

ifort -O2 -c -Qopenmp module_master.f90
ifort -O2 -c -Qopenmp main_program.f90
ifort -o main.out -O2 -Qopenmp main_program.f90 module_master.f90 -stack:999999999

But the compiler just ignored the stack flag. Anyone knows how can I compile this via command line?

0 Kudos
1 Solution
mecej4
Honored Contributor III
569 Views

Before the -stack:xxxx option add -link .

Are you aware that you are compiling the Fortran source files twice with the commands that you showed? This is almost harmless, but wasteful. After separately compiling the Fortran source files, you could have used

 

ifort -o main.out -O2 -Qopenmp main_program.obj module_master.obj -link -stack:999999900

 

View solution in original post

0 Kudos
1 Reply
mecej4
Honored Contributor III
570 Views

Before the -stack:xxxx option add -link .

Are you aware that you are compiling the Fortran source files twice with the commands that you showed? This is almost harmless, but wasteful. After separately compiling the Fortran source files, you could have used

 

ifort -o main.out -O2 -Qopenmp main_program.obj module_master.obj -link -stack:999999900

 

0 Kudos
Reply