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

ifort makefile lapack issue

milenko1976
Beginner
1,490 Views
I am trying to compile a code,I need Lapack libraries.What should I change in FCFLAGS line?Framework is supposed to be
/opt/intel/mkl/lib/ia32 or not?


#----------------------------------------------------
# Intel iFort Compiler, Mac OS X, using vector library with fast Lapack
#----------------------------------------------------
# FC90 = f90
# FCFLAGS= -fast -Wl,-framework,vecLib -warn uncalled
# use the line above for vector library with fast Lapack,
# make sure to first uncomment LAPACK sgesv call in Occam.f90



TARGETS= clean Occam2D

OBJSOC= OccamModules.f90 MT2DModules.f90 Occam.f90 MT2D.f90

all: $(TARGETS)

clean:
rm -f *.o *~ core *.mod
rm -f Occam2D

Occam2D:$(OBJSOC)
$(FC90) $(FCFLAGS) -o $@ $(OBJSOC) $(LIBS)

# General compile rules

.SUFFIXES: .f90 .o

.f90.o:
$(FC90) $(FCFLAGS) -c -o $@ $<
0 Kudos
7 Replies
Ron_Green
Moderator
1,490 Views
#----------------------------------------------------
# Intel iFort Compiler, Mac OS X, using vector library with fast Lapack
#----------------------------------------------------
FC90 = ifort
FCFLAGS= -O2 -xhost -warn uncalled

And do you want 32bit or 64bit binaries? For 32, add -m32 to FCFLAGS, else -m64

You'll need to set up a LIBS variable based on your MKL choices. Use their Link Line Advisor to set this correctly.

http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/
0 Kudos
milenko1976
Beginner
1,490 Views
Thanks Ron.32bit so -m32.
0 Kudos
milenko1976
Beginner
1,490 Views
Still I have problems:
F95ROOT=/opt/intel/composerxe-2011.1.107
MKLROOT=/opt/intel/composerxe-2011.1.107/mkl

FC90 = $(F95ROOT)/bin/ia32/ifort
FCFLAGS= -O2 -xhost -m32 -warn uncalled

INCLUDE = $(MKLROOT)/include
LD_LIBRARY_PATH = $(MKLROOT)/lib/ia32
LIBRARY_PATH = $(MKLROOT)/lib/ia32
CPATH = $(MKLROOT)/include
FPATH = $(MKLROOT)/include
NLSPATH = $(MKLROOT)/lib/ia32/locale/en_US
LIBS=-L$(MKLROOT)/lib/ia32 -lmkl_lapack95 -Wl,--start-group \
$(MKLROOT)/lib/ia32/libmkl_lapack95.a \
$(MKLROOT)/lib/ia32/libmkl_blacs.a \ -Wl, --end group

rm -f *.o *~ core *.mod
rm -f Occam2D
/opt/intel/composerxe-2011.1.107/bin/ia32/ifort -O2 -xhost -m32 -warn uncalled -o Occam2D OccamModules.f90 MT2DModules.f90 Occam.f90 MT2D.f90 -L/opt/intel/composerxe-2011.1.107/mkl/lib/ia32 -lmkl_lapack95 -Wl,--start-group /opt/intel/composerxe-2011.1.107/mkl/lib/ia32/libmkl_lapack95.a /opt/intel/composerxe-2011.1.107/mkl/lib/ia32/libmkl_blacs.a \ -Wl, --end group
ifort: error #10236: File not found: ' -Wl,'
ifort: command line warning #10006: ignoring unknown option '-fend'
ifort: error #10236: File not found: 'group'

How to link libraries?
0 Kudos
mecej4
Honored Contributor III
1,490 Views
change the last LIBS line in the makefile from

$(MKLROOT)/lib/ia32/libmkl_blacs.a \ -Wl, --end group

to

$(MKLROOT)/lib/ia32/libmkl_blacs.a -Wl,--end group


0 Kudos
milenko1976
Beginner
1,490 Views
Well,yes this works but:

/tmp/ifort1CkEJv.o: In function `tofmu_.':
Occam.f90:(.text+0x7270): undefined reference to `sgesv_'
make: *** [Occam2D] Error 1

Don,t know why.

0 Kudos
mecej4
Honored Contributor III
1,490 Views
Not having seen the source code line(s) containing the call to sgesv(), I cannot be sure, but here are some guesses:

1. You asked twice for libmkl_lapack95.a to be used while linking.

2. You did not ask for the Lapack library (F77) to be included in the link.

Use the Link Line Advisor and transcribe the link line correctly.

The answers given here can become confusing to use since you keep changing the question from post to post within a single thread.


0 Kudos
milenko1976
Beginner
1,490 Views
Thanks mecej.I have used link adviser,-I$(F95ROOT)/include/ia32 -mkl=sequential .
It works now.
0 Kudos
Reply