Using BLAS and LAPACK

I am really lost and very much a newbie to programming. I am trying to use the BLAS and LAPACK libraries. I am programming in VSCODE and at the terminal when I'm trying to run my code I am using this command - g++ MV_mult_sequential.cpp -I/usr/local/include -L/usr/local/lib -llapack -lblas. I think there is some way I could be using Accelerate to do this, but again I have no clue.

I have no idea if I'm doing anything correctly. I could use some guidance.

  • Undefined symbols for architecture x86_64: "sgemv", referenced from: sgemv(float*, float*, float*, int) in MV_mult_sequential-3cd440.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

    This is the specific error I am seeing.

Add a Comment

Replies

You can link the Accelerate framework (when using the Apple's clang) by adding -framework Accelerate at the command line.

This primarily uses the cblas APIs (e.g. cblas_sgemv) which you can access by #include <Accelerate/Accelerate.h>. It also provides fortran-style name mangled versions for compatibility with projects that use them.