On Fri, Feb 27, 2009 at 12:12 PM, mabshoff <[email protected]> wrote:
>
>
>
> On Feb 27, 11:53 am, Ondrej Certik <[email protected]> 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.

Wow, you are great, this line did it:

target_link_libraries(openmx fftw3 lapack cblas f77blas atlas)

Now it links. :) Btw, wouldn't the same trick fix this problem here:

http://www.mail-archive.com/[email protected]/msg12593.html

?


>> 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 :)

No, I just threw it there hoping that it would fix the problem, but it
didn't. Just a lame attempt.

>
>> 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 help, now everything works. I am really a beginner in this,
but I just learned a new trick. :)

Ondrej

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

Reply via email to