Skip to content

pkgconfig filles for cblas, blas and lapack #1740

Closed

Description

@timokau

When pkgconfig files were added, there used to be pkgconfig files for clbas, blas and lapack in addition to the openblas one. They were removed in #1096 by @martin-frbg. Discussion about it is in #598, though I don't really see any arguments against inclusion.

Currently at least sage relies on these pkgconfig files. Because of that distributions have to include them if they want to package sage. I'm the packager for nix and we just wondered (NixOS/nixpkgs#45257) why openblas doesn't provide these pc files by default.

So is there any reason not to include them? It seems useful to me to be able to abstract over blas libraries.

Activity

  1. martin-frbg commented on Aug 18, 2018

    @martin-frbg
    Collaborator

    As I remember it, there were no arguments for inclusion of separate pkgconfig files, and my concern was that these would all end up adding the same link line to any build process that would use them. Then there was the question of parallel installations of OpenBLAS and e.g. netlib or atlas, which
    might provide conflicting cblas.pc etc.

  2. timokau commented on Aug 18, 2018

    @timokau
    Author

    As I remember it, there were no arguments for inclusion of separate pkgconfig files

    What about the use case "link some blas library"?

    adding the same link line to any build process that would use them

    That shouldn't make a difference right?

    Then there was the question of parallel installations of OpenBLAS and e.g. netlib or atlas, which
    might provide conflicting cblas.pc etc

    That would be remedied by prefixing the filenames like suggested in #598.

  3. brada4 commented on Aug 18, 2018

    @brada4
    Contributor

    BLAS is like 20 years older than pkgconfig, and in those 20 years of pkgconfig nobody found it practical to have such .pc file
    Indeed you can have synthetic openblas.pc and atlas.pc and mkl.pc files in sagemath if that is your preferred way.
    in most linux distributions it is either -lblas alternatives or easily replaceable thunk to distributor's prefered blas implementation, that you can symlink to replacement of users' choice.

  4. timokau commented on Aug 19, 2018

    @timokau
    Author

    Why would it not be practical? And what disadvantages would there be?

  5. brada4 commented on Aug 19, 2018

    @brada4
    Contributor

    You can make 'ld -lblas -osageblas.so' thunk library that one can replace with openblas , or in case of ubuntu, it is already obedient to alternatives. Or in case of windows just plant openblas there?
    Sort of leave easy choice to users instead of implying one implementation on them?
    pkgconfig is not very good at understanding that blas.pc atlas.pc openblas.pc and mkl.pc all would provide same API in the end. Lets take ubuntu alternatives as an example where netlib blas is used for compiler linking but alternatives can be used for runtime loading.

  6. timokau commented on Aug 19, 2018

    @timokau
    Author

    I'm sorry I still don't understand you. What is a thunk library? What is ubuntu obedient to? What do you mean with windows?

  7. brada4 commented on Aug 20, 2018

    @brada4
    Contributor

    You just link your executables to a library which imports blas, lapack and cblas
    One can replace that with blas implementation of their choice, by relinking, or rewriting library file...
    In turn in ubuntu or debian you can redirect -lblas that i suggest to link from your fake blas library with a blas implementation of your choice. I.e far outside sagemath. Or replace fake blas library with mkl etc

  8. timokau commented on Aug 21, 2018

    @timokau
    Author

    Yes, that is a possibility. However are there any reasons against just providing the pkgconfig files for cblas, blas and lapack? If you are opposed against this, is there any reason against us providing them as a distribution?

  9. brada4 commented on Aug 21, 2018

    @brada4
    Contributor

    They are not part of Netlib LAPACK API?
    cmake and autoconf has on their own blas implementation finders for example.

  10. martin-frbg commented on Aug 21, 2018

    @martin-frbg
    Collaborator

    I am not opposed to reinstating the additional pkgconfig files, as long as they do not cause any new and interesting problems. Getting the recent thread memory allocating mess fixed is much higher on my list of priorities however.

  11. timokau commented on Aug 21, 2018

    @timokau
    Author

    Why would an implementation detail like pkgconfig-files be a part of the api? That other implementation finders exist shouldn't be an issue.

    Okay, glad to hear that you are open to it. I understand that it is not high priority. I'll then add the files to our distro package for now. Let me know if I can do anything to help.

  12. isuruf commented on Aug 25, 2018

    @isuruf
    Contributor

    @timokau, I added them initially when I was packaging sagemath for conda and I agree with the decision that the cblas, blas, lapack files should be left to the distributions to add them. Reason is that the system-wide blas or cblas or lapack should be chosen by the distribution and openblas should not assert itself as the blas implementation for the distribution.

  13. timokau commented on Aug 25, 2018

    @timokau
    Author

    @isuruf my understanding of pkgconfig is incomplete, but shouldn't it be able to deal with multiple declarations of "blas" and "cblas"?

  14. timokau commented on Aug 25, 2018

    @timokau
    Author

    Okay apparently it is not. So in that case I agree that adding those files to lib/pkgconfig would be a bad idea. Thanks for the explanations!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions