Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Compiling a Fortran Subroutine using MKL

mishaq151
Beginner
327 Views
Hi
I have sucessfully compile and run a FORTRAN 90 program which is calling MKL Library as:

[root@localhost ahmad1]# ifort -w GQ.f90 -L/opt/intel/mlk1/10.1.012/lib/32 -lmkl_lapack95 /opt/intel/mlk1/10.1.012/lib/32/libmkl_intel.a -Wl,--start-group /opt/intel/mlk1/10.1.012/lib/32/libmkl_intel_thread.a /opt/intel/mlk1/10.1.012/lib/32/libmkl_core.a -Wl,--end-group /opt/intel/mlk1/10.1.012/lib/32/libguide.a -lpthread -o GQ.out

When I compile a FORTRAN 90 Subroutine GQ1.f90 with same above parameters, I got error as:

[root@localhost ahmad1]# ifort -w GQ1.f90 -L/opt/intel/mlk1/10.1.012/lib/32 -lmkl_lapack95 /opt/intel/mlk1/10.1.012/lib/32/libmkl_intel.a -Wl,--start-group /opt/intel/mlk1/10.1.012/lib/32/libmkl_intel_thread.a /opt/intel/mlk1/10.1.012/lib/32/libmkl_core.a -Wl,--end-group /opt/intel/mlk1/10.1.012/lib/32/libguide.a -lpthread -o GQ1.out
/opt/intel/fc/10.1.012/lib/for_main.o: In function `main':
/users/nbtester/x86linux_nightly/branch-10_1/20080112_010000/libdev/frtl/src/libfor/for_main.c:(.text+0x39): undefined reference to `MAIN__'

Please give some idea to remove this.

Thanks

Ishaq



0 Kudos
2 Replies
TimP
Honored Contributor III
327 Views
When you don't provide a main program, you add the -c (compile only, no link) in order to make an object file for later linking. With -c, all the MKL linking information will be ignored.
0 Kudos
mishaq151
Beginner
327 Views
Dear sir,
Thank you very much.
I have done this as:

[root@localhost ahmad1]# ifort -c GQ1.f90

It has created GQ1.o

Now, can you guide me, how to run GQ1.o (which includes MKL function)
Please write the commands to link this with main program.

Thanks
Ishaq

0 Kudos
Reply