Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building on M1 mac (osx 12.2.1) #61

Open
maczikasz opened this issue Mar 9, 2022 · 4 comments
Open

Building on M1 mac (osx 12.2.1) #61

maczikasz opened this issue Mar 9, 2022 · 4 comments

Comments

@maczikasz
Copy link

Hi

I am trying to build SuperLu from source on my m1 macbook. I copied over the mac make.inc but I am getting the following errors:

gcc -O2  -DAdd_  -c ssp_blas2.c 
ssp_blas2.c:256:7: error: implicit declaration of function 'strsv_' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                    strsv_("L", "T", "U", &nsupc, &Lval[luptr], &nsupr,
                    ^
ssp_blas2.c:291:7: error: implicit declaration of function 'strsv_' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                    strsv_("U", "T", "N", &nsupc, &Lval[luptr], &nsupr,
                    ^

I changed
BLASLIB = /opt/homebrew/opt/openblas/lib/libopenblas.a to point to the openblas installation on my mac, but to no avail

@xiaoyeli
Copy link
Owner

I don't know what goes wrong.
If you see file SRC/ssp_blas2.c, it includes slu_sdefs.h, which contains the prototype definition:
extern int strsv_(char*, char*, char*, int*, float*, int*,
float*, int*);
But the compiler still complains that strsv_ is not declared.

Can you try to use 'cmake' to install it? See instruction on this page:
https://github.com/xiaoyeli/superlu

@alugowski
Copy link
Contributor

I can confirm that the cmake instructions work on an M1 mac:

mkdir build ; cd build
cmake -Denable_internal_blaslib=YES ..
make

Then run one of the tests to confirm:

superlu/build % ./Testing/d_test
dgstrf info 1
dgstrf info 1
All tests for DGE driver passed the threshold (  1154 tests run)

Note that the Readme says TESTING but the actual directory name is Testing.

@alugowski
Copy link
Contributor

Ah, I see @maczikasz was specifically referring to using brew's OpenBLAS on M1.

That still works, though the Readme instructions are incomplete. One must manually append the link path so the linker can find libopenblas.a:

mkdir build ; cd build
cmake -DTPL_BLAS_LIBRARIES=openblas ..
LIBRARY_PATH="/opt/homebrew/opt/openblas/lib/" make

@xiaoyeli have you considered CMake's FindBLAS function that does all the fun stuff automatically? https://cmake.org/cmake/help/latest/module/FindBLAS.html

@xiaoyeli
Copy link
Owner

CMakeLists.txt does use find_package(BLAS). What more needs to be done?
If you have suggestions, please set up a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants