Giter Club home page Giter Club logo

Comments (13)

aamaricci avatar aamaricci commented on July 27, 2024

The quad interface is a subroutine so the correct program is:
program test
Use scifor
Implicit None
real(8) :: Integral
call quad(sin2, 0.0d0, pi, result=integral)
Write (,) Integral
! ------------------------------- !
Contains
Function sin2(x)
Real(8) :: sin2
Real(8) :: x
sin2 = sin(x)**2
End Function sin2
end Program test

$ mpif90 $(pkg-config --cflags --libs scifor) test.f90
$ ./a.out
1.5707963097588762

Cheers,
A

from scifortran.

WangYun1995 avatar WangYun1995 commented on July 27, 2024

Thank you!
When I used the compile command (pkg-config --cflags --libs scifor) test.f95, it returned -bash: -I/home/wangy/opt/scifor/gnu/4.6.31/include: No such file or directory to me.

However, when I input gfortran test.f95 -I/home/wangy/opt/scifor/gnu/4.6.31/include -L/home/wangy/opt/scifor/gnu/4.6.31/lib -lscifor /usr/lib64/liblapack.so /usr/lib64/libblas.so,
it returned me ./a.out.

Why did I fail to use $(pkg-config --cflags --libs scifor) test.f95?

from scifortran.

aamaricci avatar aamaricci commented on July 27, 2024

from scifortran.

WangYun1995 avatar WangYun1995 commented on July 27, 2024

According to your advice, I follow instructions printed after the make post-install. But there is another issue shown below.
QQ图片20201202093941

Why is there a \; in /usr/lib64/liblapack.so\;/usr/lib64/libblas.so? I think the \; leads to the gfortran error. How to address it?

from scifortran.

aamaricci avatar aamaricci commented on July 27, 2024

This looks like the pkg-config configuration file for SCIFOR is corrupted.
pkg-config report informations about linking (and other) directives for any installed library in the system. This is done by reading suitable configuration files specific to each library. Each such file is provided together with the library and placed in specific system directories, where pkg-config can find and read, as stored in the environment variable PKG_CONFIG_PATH. The file have the form <library_name>.pc

Together with SCIFOR we thus provide a scifor.pc file, which is created by Cmake during post-install step. To avoid getting access to system directory we place such file in your home under ~/.pkgconfig.d. This directory is then added to the PKG_CONFIG_PATH by one of the method listed after $make post-install. In this way you can always retrieve linking information no matter where you compile using the $(pkg-config --cflags --libs scifor) string.

In some cases (depending on the Linux distro) this file scifor.pc comes out corrupted. You need to fix it by removing the ;;/usr/lib64/libblas.so and replacing it with a space. There should be only one reference to lapack and one to blas.

Note that this string is generated by a CMake macro that we use to search Lapack/Blas library.

This should solve your problem.

Cheers,
A

from scifortran.

WangYun1995 avatar WangYun1995 commented on July 27, 2024

So how to remove the ;;/usr/lib64/libblas.so?

from scifortran.

aamaricci avatar aamaricci commented on July 27, 2024

from scifortran.

WangYun1995 avatar WangYun1995 commented on July 27, 2024

Thank you so much!

from scifortran.

band-a-prend avatar band-a-prend commented on July 27, 2024

@aamaricci ,

string is generated by a CMake macro

It seems that issue could be resolved by placing

STRING(REPLACE ";" " " LAPACK_LIBRARIES ${LAPACK_LIBRARIES})

into cmake/BuildPkgConfigFile.cmake before IF statements. And I need to check if this replacement works as I has described issue in my system.

LAPACK_LIBRARIES returns paths to /usr/lib64/lapack.so;/usr/lib64/blas.so by cmake for lapack implementation installed in my case. Additional path from BLAS_LIBRARIES string just add one blas library /usr/lib64/blas.so path if available and doesn't cause problem.

But I didn't check if this replacement affects other cmake files later.

from scifortran.

aamaricci avatar aamaricci commented on July 27, 2024

I see.
Thanks for pointing this out. I'll try to implement this in a separate branch. Should this works as expected we can integrate it in the stable version.

from scifortran.

band-a-prend avatar band-a-prend commented on July 27, 2024

I will update my gentoo package (not ready yet) for scifortran and will make additionally tests with some example that uses blas.

At least for 4.7.4 with example for newton() (no blas of couse) there was no ld errors with double blas library linked.

from scifortran.

aamaricci avatar aamaricci commented on July 27, 2024

Packaging for Linux distro would be a very welcome upgrade. Please let us know and thanks for trying.

from scifortran.

band-a-prend avatar band-a-prend commented on July 27, 2024

STRING(REPLACE ";" " " LAPACK_LIBRARIES ${LAPACK_LIBRARIES})

It should be (quoted last variable)
STRING(REPLACE ";" " " LAPACK_LIBRARIES "${LAPACK_LIBRARIES}") otherwise ";" will be replaced with empty string.

I update my patch with some more common cases (remove duplicates) but need to scifor with lapack related example.

from scifortran.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.