Linking and Using LAPACK with MESASDK

General discussion of all things GYRE-related (e.g., results, talks, ideas, tips)
Post Reply
ehsan
Posts: 88
Joined: Sun Jun 16, 2013 11:31 am

Linking and Using LAPACK with MESASDK

Post by ehsan » Thu Dec 18, 2014 4:06 am

Dear Rich,
I am certain that this message does not belong to here. Perhaps, I should have sent it to the MESA mailing list, or definitely somewhere like MESASDK forum, which for now does not exist ;-)
So, this forum is the only discussion place I find useful for my question.

Due to my serious addiction to MESA and its prerequisite SDK, the MESASDK is the only bundle of compiler and libraries that I install on all systems that I work with. Now, for a separate project (that you will hear about soon), I need to link to and use LAPACK library. However, I do not know how to do that in my makefile. Additionally, the HDF5 support that ships for free with the SDK is also very appealing to use.
I would like to kindly ask you to document that, and perhaps provide examples on how to link to these libraries in MESASDK, and call then from within our own fortran programs.

Thanks for your support.
Ehsan

User avatar
rhtownsend
Site Admin
Posts: 397
Joined: Sun Mar 31, 2013 4:22 pm

Re: Linking and Using LAPACK with MESASDK

Post by rhtownsend » Sat Dec 20, 2014 3:59 pm

ehsan wrote:Dear Rich,
I am certain that this message does not belong to here. Perhaps, I should have sent it to the MESA mailing list, or definitely somewhere like MESASDK forum, which for now does not exist ;-)
So, this forum is the only discussion place I find useful for my question.

Due to my serious addiction to MESA and its prerequisite SDK, the MESASDK is the only bundle of compiler and libraries that I install on all systems that I work with. Now, for a separate project (that you will hear about soon), I need to link to and use LAPACK library. However, I do not know how to do that in my makefile. Additionally, the HDF5 support that ships for free with the SDK is also very appealing to use.
I would like to kindly ask you to document that, and perhaps provide examples on how to link to these libraries in MESASDK, and call then from within our own fortran programs.

Thanks for your support.
Ehsan
To use the MESASDK version of LAPACK, add the following to the command used to link the executable:

Code: Select all

`mesasdk_lapack_link`
(Note that the `` symbols are backticks, not normal quotes). For instance, if you are creating the executable 'foo' from the object file 'foo.o', you might use a rule like this in the Makefile:

Code: Select all

foo : foo.o
     gfortran -o $@ $< `mesasdk_lapack_link`
The procedure is similar for linking to the HDF5 library, except you use `mesasdk_hdf5_link` instead of `mesasdk_lapack_link`.

When compiling object files from Fortran 90/95/03 source code, you may have to tell the compiler where to find the appropriate .mod files for modules you use in your code. To do this, add the following to the code used to compile the object file:

Code: Select all

-I$(MESASDK_ROOT)/include
For instance, if you are compiling the object file 'foo.o' from the source file 'foo.f90', you might use a rule like this in the Makefile:

Code: Select all

foo.o : foo.f90
     gfortran -I$(MESASDK_ROOT) -c $<
cheers,

Rich

Post Reply