Lapack function call in Code_Saturne 2.0.4

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
pomarede

Lapack function call in Code_Saturne 2.0.4

Post by pomarede »

Hi there,

My question is the following : how can I know if Lapack library is installed on my Code_Saturne version ? And if it is not, how can I do it, and particularly, how can I make the link between Lapack and Code_Saturne ?
As I have to solve an eigenvalue problem in a user subroutine, I was wondering if I could directly call Lapack functions (dsyev in my case). My version is Code_Saturne 2.0.4.

Many thanks for your help,
Regards,

Marie
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Lapack function call in Code_Saturne 2.0.4

Post by Yvan Fournier »

Hello,

In general, Code_Saturne does not use Lapack.

To add Lapack, the surest way is to rebuild the code adding LDFLAGS="<path_to_lapack_libs>" and LIBS=<lapack_libs> to the "configure" command, for example, using the ATLAS BLAS:

../code-saturne-2.3/configure ..... LDFLAGS="-L<path_to_atlas>" LIBS="-llapack -lcbas"

To use Lapack from C code, adding CPPFLAGS="-I<path_to_lapack_includes>" is also recommended.

Another solution would be to run "code_saturne compile --opt-libs="-llapack -lcblas", for example :

code_saturne compile --opt-libs="-L/home/yvan/opt/atlas-3.9/lib -llapack -lcblas" -s src_saturne

But this not currently handled by the scipt, so using Code_Saturne 2.1 or above, you need to run "code_saturne run --param <param.xml> --initialize"
to prepare the execution directory, then rebuild the code with the above command, and finally run "run_solver.sh" in the RESULTS/execution directory.

In any case, rebuilding/installing with CFLAGS and LDFLAGS/LIBS seems the most practical and robust if you use it often.

Regards,

Yvan
pomarede

Re: Lapack function call in Code_Saturne 2.0.4

Post by pomarede »

Hello Yvan,

thank you for your answer and for your reactivity. I've tried your first proposition, which consists, if I am right, to specify the LDFLAGS and LIBS variables of the "configure" file, which is in the NCS directory.
So after a manual creation of a ncs.build directory, I used the following command (I don't know if it is the best method):

Code: Select all

env LDFLAGS="-L/local00/home/marie/usr/local/lib/lapack-3.4.1" LIBS="-llapack" ./configure
(I need lapack only in my Fortran routines). Then I compiled again the NCS by typing (in the ncs directory):

Code: Select all

make
make install
make clean
How can I check if the new link to the lapack library is done ? By launching a calculation after a complete code rebuilt, it seems that the lapack function call is still not recognized...
Thank you,

Marie
pomarede

Re: Lapack function call in Code_Saturne 2.0.4

Post by pomarede »

Hello again,

I didn't fix the problem with the version 2.0.4, because as there are several configure files, I don't know which one is to be modified, and I used to automatically compile the code by running the install_saturne.py file.
Thus I finally installed the 2.2.2 version, adding, as you recommanded Yvan:

Code: Select all

LDFLAGS="-L/local00/home/marie/usr/local/lib/lapack-3.4.1" LIBS="-llapack -lblas"
to the configure command. I need "lblas" since my lapack function is calling lower level functions from the BLAS library.
And my calculation works now perfectly.
Thank you again,

Marie
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Lapack function call in Code_Saturne 2.0.4

Post by Yvan Fournier »

Hello,

Good to know that it works.

Just in case you need this with version 2.0.x, the configure command you need to add those same options to is that of the NCS (Kernel) package.

Best regards,

Yvan
Post Reply