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

How can I increase the stack-size when I want to compile ifort files on Mac OSX

nalgenbottle
Beginner
4,317 Views
When I execute, on the terminal I got the message of "Segmentation fault."
This message starts appearing after I increase the size of array in my code.
Looks like there is a specific size of variables we can allocate, and if we allocate more than this size, "Segmentation fault" message comes.
So I think I can solve this problem by increasing the stack-size.
Probably this question should not be posted here, could anybody please let me know how I can increase the stack size on Mac OSX?
I found several similar threads here and other sites, but they were not helpful for me.
So if anybody could explain the detail very much (like explain to a child), I appreciate it.

0 Kudos
5 Replies
rreis
New Contributor I
4,315 Views
Quoting - nalgenbottle
When I execute, on the terminal I got the message of "Segmentation fault."
This message starts appearing after I increase the size of array in my code.
Looks like there is a specific size of variables we can allocate, and if we allocate more than this size, "Segmentation fault" message comes.
So I think I can solve this problem by increasing the stack-size.
Probably this question should not be posted here, could anybody please let me know how I can increase the stack size on Mac OSX?
I found several similar threads here and other sites, but they were not helpful for me.
So if anybody could explain the detail very much (like explain to a child), I appreciate it.


maybe this has the answer you are looking for?

How to increase the stack size on Mac OS X

0 Kudos
roddur
Beginner
4,317 Views
'ulimit -s' is the unix command to show the maximum stack size.
'ulimit -s unlimited' will put your stack size to unlimited.

hope this will help you.
0 Kudos
Ron_Green
Moderator
4,317 Views
the article pointed to earlier (PDF) is a good one.

Here is a simplified article, but remember -heap-arrays (using this you may not need additional stack). Look for the linker switch for Mac OS X.

http://software.intel.com/en-us/articles/intel-fortran-compiler-increased-stack-usage-of-80-or-higher-compilers-causes-segmentation-fault/


0 Kudos
nalgenbottle
Beginner
4,317 Views
thank you all.

I understand how I can compile one single file with a larger stack size.
But what I want to do is compiling several files together and making a one executable file.
I made "Makefile" to do so, but still I do not know how I can compile them with a larger size.
Probably I should have said this first, but could anybody tell me how I can compile several files in "Makefile" with a larger stack size together?


0 Kudos
rreis
New Contributor I
4,317 Views

Quoting - nalgenbottle
thank you all.

I understand how I can compile one single file with a larger stack size.
But what I want to do is compiling several files together and making a one executable file.
I made "Makefile" to do so, but still I do not know how I can compile them with a larger size.
Probably I should have said this first, but could anybody tell me how I can compile several files in "Makefile" with a larger stack size together?



For instance, I use this make file for one of my codes. You can choose two compilers and has diferent flags for debugging or production. If you can't figure it out maybe you could post your makefile so we can help?


[shell].SUFFIXES: .f90

.f90.o:
$(FC) $(FFLAGS) -c $<

#FC = gfortran
FC = ifort

EXE = dissip.$(FC)

LD = $(FC)

#FLAGS
ifndef L
L=0
endif

ifndef ARCH
ifeq ("$(FC)", "gfortran")
ARCH=native
endif
ifeq ("$(FC)", "ifort")
ARCH=pentium4
endif
endif


ifeq ("$(L)", "0")
ifeq ("$(FC)", "gfortran")

FFLAGS = -O0 -g3 -ggdb -mtune=$(ARCH)
-fbounds-check -Wuninitialized -Wunused-variable
-Wunderflow -Wunused-parameter
-pedantic-errors -Wall
-fbacktrace
-pedantic
endif

ifeq ("$(FC)", "ifort")
FFLAGS = -O0 -g -debug all -debug-parameters all -DD -C
-traceback -warn all -check all
-fp-model precise -fp-stack-check
-heap-arrays
#
# -check arg_temp_created
endif

else ifeq ("$(L)", "4")

ifeq ("$(FC)", "gfortran")
FFLAGS = -O3 -ftree-vectorize -mtune=native -ffast-math
-fopenmp
endif

ifeq ("$(FC)", "ifort")
FFLAGS = -O$(L) -xHost -heap-arrays -fp-model precise
-openmp -parallel
endif

else
ifeq ("$(FC)", "gfortran")
FFLAGS = -O3 -ftree-vectorize -mtune=native -ffast-math
endif

ifeq ("$(FC)", "ifort")
FFLAGS = -O$(L) -xHost -heap-arrays -fp-model precise
endif
endif

LDFLAGS = $(FFLAGS)

LIBS=-lm

OBJS = mod_gendef.o
ensightio.o
io.o
calc.o
analisys.o

all: $(OBJS) dissip_main.o
$(LD) $(LDFLAGS) dissip_main.o $(OBJS) $(LIBS) -o $(EXE)


# - BURGERS -----------------------------------------------------------

burgers: $(BOJS) burgers.o
$(LD) $(LDFLAGS) $(BOJS) burgers.o $(LIBS) -o burgers.$(FC)

clean:
rm -f *.o *.mod $(EXE)

%.o : %.mod


[/shell]

0 Kudos
Reply