Skip to content

Issues in linking with the GSL CBLAS library #195

Description

@gkaf89

In the makefile configuration for GNU (src/makefile.gnu), the options to link with the BLAS library are the following:

PROJECT_LDFLAGS_BLAS=-lblas -lgsl -lgslcblas 

The GLS (-lgsl) library requires the CBLAS interface. The GSL CBLAS (-lgslcblas) library implements the CBLAS interface from scratch, and can be used to link with GSL when no other BLAS interface is required.

However, the program seems to require a library implementing the FORTRAN BLAS interface (-lblas). Typically, libraries such Netlib BLAS and OpenBLAS implement either the FORTRAN or C interface and provide a wrapper for the other language. In Netlib for instance, the CBLAS library simply forwards calls to the BLAS library functions.

The GLS library supports linking with external CBLAS implementations. In the case of Netlib BLAS the linking option will be,

PROJECT_LDFLAGS_BLAS=-lgsl -lcblas -lblas

and in the case of OpenBLAS

PROJECT_LDFLAGS_BLAS=-lgsl -lopenblas

since OpenBLAS implements all interfaces in one shared object.

Note that in the case of OpenBLAS, modifying the linking to options to something like

PROJECT_LDFLAGS_BLAS=-lopenblas -lgsl -lgslcblas 

which seems as the natural choice is particularly dangerous, since now 2 libraries provide the functions in CBLAS interface. In runtime either function can be loaded which can cause issues.

Is there any particular reason for linking with GSL CBLAS, or could it be removed and have a single library implementing BLAS (C and FORTRAN interfaces)?

Activity

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