On Feb 27, 11:53 am, Ondrej Certik <ond...@certik.cz> wrote:
> Hi,

Hi,

> I have some C code that uses lapack (http://www.openmx-square.org/)
> --- how should I link with it in Sage?

It depends, C code can either use either Fortran code directly or
might rely on a CLapack implementation.

> In Debian I just do:
>
> target_link_libraries(openmx fftw3 lapack blas gfortran)

In this case it is using the Fortran code directly.

> e.g. I link with lapack, blas and gfortran and it works. In sage, it
> also requires atlas and cblas, so that's fine, but then lapack also
> needs blas, so I end up with:

ATLAS does not depends on CBLAS because it uses the CBLAS interface.
But if you need the F77 BLAS interface you just need to add f77blas to
the libraries to link.

> target_link_libraries(openmx fftw3 lapack cblas blas atlas f2c)
>
> The f2c is maybe not needed, but anyway, the last undefined symbol is:
>
> /home/ondrej/ext/sage-3.2.3-ubuntu-64bit-intel_xeon-x86_64-Linux/local/lib/ 
> ../lib/libblas.a(xerbla.o):
> In function `xerbla_':
> xerbla.f:(.text+0xd7): undefined reference to `_g95_stop_blank'
> collect2: ld returned 1 exit status

This is the g95 runtime. If you have to use f2c some code you use must
suck :)

> and I haven't figured out what to link with. I thought, that one
> should link with clapack in C? But I haven't found the clapack library
> in Sage. So what should I do?

We don't ship clapack, it is rather inefficient and there is no
standardized C Lapack interface anyway like there is a CBLAS
interface.

> I think if I set SAGE_FORTRAN to gfortran, I'll be fine, but I'd
> prefer if I can get it working with the current sage, e.g. g95, if
> there is a way.

I am working on a rework of the Fortran support in Sage and in the not
too distant future (Sage 4.0 probably) you will just call some script
and it will tell you the Fortran runtime you will need to link. As is
the Fortran support is rather messy in Sage and I need to fix it for
the Cygwin port, so it will be a focus for me once I am at UW after SD
13 :)

> Thanks for any help,
> Ondrej

Cheers,

Michael
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to