[dune-fem] Linking problem for UMFPACK in dune-fem
Sacconi, Andrea
a.sacconi11 at imperial.ac.uk
Mon Dec 10 17:25:16 CET 2012
Hi all,
I'm writing you about a problem I have been experiencing for a long time about UMFPACK and its usage in dune-fem.
Tobias Malkmus already told me that in the trunk version there is a new umfpack.m4, that is in charge of looking for the correct inclusion of libraries and so on.
The problem is the following: I have put the option "--with-umfpack=<correctPath>" in my config.opts file. When (somewhere in my code) I try to call the "method solveUMF" from dune-fem/dune/fem/operator/matrix/spmatrix.cc, I get this error:
/usr/local/lib/libblas.a(xerbla.o): In function `xerbla_':
xerbla.f:(.text+0x49): undefined reference to `_gfortran_st_write'
xerbla.f:(.text+0x54): undefined reference to `_gfortran_string_len_trim'
xerbla.f:(.text+0x66): undefined reference to `_gfortran_transfer_character_write'
xerbla.f:(.text+0x76): undefined reference to `_gfortran_transfer_integer_write'
xerbla.f:(.text+0x7e): undefined reference to `_gfortran_st_write_done'
xerbla.f:(.text+0x87): undefined reference to `_gfortran_stop_string'
collect2: ld returned 1 exit status
I have already checked in some Unix forums, the source is the (missing) inclusion of -lgfortran. It's crucial to call -lgfortran after the name of the object/executable is written after g++, and -lblas has to be called BEFORE -lgfortran. If you invert the order, it's a mistake!
My local version of UMFPACK is correctly installed, since I managed to have some examples perfectly working. In addition, I created a new dune-module that does nothing but executing one of the toy demos after having printed "Hello world! Try to compile the following lines written for UMFPACK". I copied and pasted (from UMFPACK Demo folder) the order in which the various libraries are called, and it works!
Now, my question is: how can I fix this linking problem? It's pure linking, since the object file is created correctly. I'm quite sure it's got to do with -lgfortran and -lblas.
Last bit of information: I installed UMFPACK with the option to rely on CHOLMOD, CAMD, CCOLAMD, COLAMD, and METIS.
Many thanks!
Andrea
__________________________________________________________
Andrea Sacconi
PhD student, Applied Mathematics
AMMP Section, Department of Mathematics, Imperial College London,
London SW7 2AZ, UK
a.sacconi11 at imperial.ac.uk
________________________________________
From: Sacconi, Andrea
Sent: 07 December 2012 21:58
To: Tobias Malkmus
Subject: RE: Example with UMFPACK solver in dune-fem
Hi Tobias,
thanks for the file.
I think I have identified the source of the problem. Unfortunately, I don't know how to solve it.
I'm quite sure that UMFPACK is installed correctly on my laptop, since I just compiled a toy example (attached) and it works perfectly. I compiled it by adding manually all the liberaries ".a" that are needed, exactly as it's done in the Demo folder of UMFPACK.
Precisely:
gcc -I/usr/local/include -o umfpack-ex1 umfpack-ex1.c /usr/local/lib/libumfpack.a /usr/local/lib/libamd.a /usr/local/lib/libsuitesparseconfig.a /usr/local/lib/libcholmod.a /usr/local/lib/libcolamd.a /usr/local/lib/libmetis.a /usr/local/lib/libccolamd.a /usr/local/lib/libcamd.a -lblas -lgfortran /usr/local/lib/libcerbla.a -lm -lrt
Unfortunately, if I copy this code and I create a new dune project, that does nothing apart from printing "Hello world! Try to compile the following lines written for UMFPACK", some errors arise, precisely:
/usr/local/lib/libblas.a(xerbla.o): In function `xerbla_':
xerbla.f:(.text+0x49): undefined reference to `_gfortran_st_write'
xerbla.f:(.text+0x54): undefined reference to `_gfortran_string_len_trim'
xerbla.f:(.text+0x66): undefined reference to `_gfortran_transfer_character_write'
xerbla.f:(.text+0x76): undefined reference to `_gfortran_transfer_integer_write'
xerbla.f:(.text+0x7e): undefined reference to `_gfortran_st_write_done'
xerbla.f:(.text+0x87): undefined reference to `_gfortran_stop_string'
collect2: ld returned 1 exit status
I have already checked in some Unix forums, the source seems to be the (missing) inclusion of -lgfortran. Already tried to include it again, it doesn't work. The suggestion is to call -lgfortran after the name of the object/executable is written after g++. Does dune do this way?
I'm attaching the Makefile.am; all the libraries are placed in /usr/local/lib, I'm not linking to the local version, but I'm quite sure the outcome would be the same.
Since the same code (the toy example) compiles and runs perfectly, but it doesn't if put inside a dune code, it means that it's got to do with dune. Not necessarily dune-fem.
Do you have any idea?
I am frustrated! I have installed and purged SuiteSparse dozens of times, and the result is always the same. I have tried to reinstall tweaking the XERBLA flag according to the three different options, but nothing changed.
Thanks again for your help! If you can, maybe we could Skype on Monday, at your convenience.
Andrea
__________________________________________________________
Andrea Sacconi
PhD student, Applied Mathematics
AMMP Section, Department of Mathematics, Imperial College London,
London SW7 2AZ, UK
a.sacconi11 at imperial.ac.uk
________________________________________
From: Tobias Malkmus [tomalk at mathematik.uni-freiburg.de]
Sent: 06 December 2012 07:58
To: Sacconi, Andrea
Subject: Re: Example with UMFPACK solver in dune-fem
Hi Andrea
Here an adapted version of spmatrix.cc
I added some error output if UMFPACK fails.
It is assumed that the matrix is non symmetric and a transpose of the
matrix is build within.
In my code this version works for Stokes problem.
Let me know how it is in your case.
Best Tobias
On 12/05/2012 05:36 PM, Sacconi, Andrea wrote:
> Oh my goodness ..... I think I'll try to have a look only at the spmatrix.cc in the trunk version.
> If I start making updates now, it's likely I mess up everything after 10 minutes ... I'll do it when the next release is available.
>
> Do you think it's possible? Just to have a look at spmatrix.cc ... It'd be enough for now.
>
> Thanks!
>
> Andrea
>
> __________________________________________________________
>
> Andrea Sacconi
> PhD student, Applied Mathematics
> AMMP Section, Department of Mathematics, Imperial College London,
> London SW7 2AZ, UK
> a.sacconi11 at imperial.ac.uk
>
> ________________________________________
> From: Tobias Malkmus [tomalk at mathematik.uni-freiburg.de]
> Sent: 05 December 2012 13:54
> To: Sacconi, Andrea
> Subject: Re: Example with UMFPACK solver in dune-fem
>
> On 12/05/2012 01:55 PM, Sacconi, Andrea wrote:
>> Hi Tobias,
>>
>> how are you?
>> Hope everything is fine :)
>>
>> Sorry if I never got back to you about UMFPACK, but I preferred to fix
>> the issues with the coupling of 2D and 1D codes I had already
>> implemented. Now the merging works, and the plots start having sense.
>>
>> I'm solving the Surface Diffusion problem with Conjugate Gradient, at
>> the moment, and it'd be nice to use instead a direct solver, like UMFPACK.
>> I think my UMFPACK installation is correct, and the workaround (in the
>> Makefile.am) you suggested me, at least avoids compilation errors.
>>
>> Anyway, you mentioned you had some problems when you converted the
>> matrix from the dune-fem format to UMFPACK format. I guess it has got to
>> do with the Compressed Column Storage (CCS); could you please send me
>> the files where you did it, files that compile and run correctly?
>> I don't know if you tweak the entries in your own code, so by passing
>> the correct parameters the ".solveUMF()" call in dune-fem-1.3.0 can
>> work, or if you created an improved version of spmatrix.cc on your local
>> machine.
>
> Hi Andrea
>
> You might consider to switch to the acctual trunk version, where this
> problems are fixed.
>
> Unfortunatly a lot of other things have changed, too.
> So it might cost a lot of time to adapt your code to the new trunk version.
>
> You can obtain it under
> http://users.dune-project.org/projects/dune-fem/repository
>
>
> Best Tobias
>>
>> Many thanks in advance!
>>
>> Andrea
>>
>> __________________________________________________________
>>
>> Andrea Sacconi
>> PhD student, Applied Mathematics
>> AMMP Section, Department of Mathematics, Imperial College London,
>> London SW7 2AZ, UK
>> a.sacconi11 at imperial.ac.uk
>
>
> --
> Tobias Malkmus <tomalk at mathematik.uni-freiburg.de>
>
> Mathematisches Institut Tel: +49 (0) 761 203 5651
> Abt. für Angewandte Mathematik Universität Freiburg
> Hermann-Herder-Str. 10
> 79104 Freiburg
>
--
Tobias Malkmus <tomalk at mathematik.uni-freiburg.de>
Mathematisches Institut Tel: +49 (0) 761 203 5651
Abt. für Angewandte Mathematik Universität Freiburg
Hermann-Herder-Str. 10
79104 Freiburg
More information about the dune-fem
mailing list