xiaoyeli / superlu

Supernodal sparse direct solver. https://portal.nersc.gov/project/sparse/superlu/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Errors compiling on MacOSX

Aklotz-cadence opened this issue · comments

Hello, when I try to compile on MacOSX, there are errors in following files:

ssnode_bmod.c, dsnode_bmod.c, csnode_bmod.c, zsnode_bmod.c. The compiler complains that certain functions are used, before being defined. In order to fix the issue, I simply copied Function Prototypes from other sources into the files after inclusion of header files:

ssnode_bmod.c

/*

  • Function prototypes
    */
    void slsolve(int, int, float *, float *);
    void smatvec(int, int, int, float *, float *, float *);

dsnode_bmod.c

/*

  • Function prototypes
    */

void dusolve(int, int, double*, double*);
void dlsolve(int, int, double*, double*);
void dmatvec(int, int, int, double*, double*, double*);

csnode_bmod.c

/*

  • Function prototypes
    /
    void cusolve(int, int, complex
    , complex*);
    void clsolve(int, int, complex*, complex*);
    void cmatvec(int, int, int, complex*, complex*, complex*);

zsnode_bmod.c

/*

  • Function prototypes
    /
    void zusolve(int, int, doublecomplex
    , doublecomplex*);
    void zlsolve(int, int, doublecomplex*, doublecomplex*);
    void zmatvec(int, int, int, doublecomplex*, doublecomplex*, doublecomplex*);

Would be great, if this could be included by default

Best Regards,

Anton

I tried MacOS, do not see this problem.
Note: these prototypes are defined in slu_{s,d,c,z}defs.h, and these header files are included in snode_bmod.c.
So there is no problem.

  1. What version of SuperLU are you trying to compiler? 6.0.0, master, or something older?
  2. What is your compiler and what version of it are you using?
  3. Do you use Makefiles or CMake? With other words, do you type make in SuperLu's root directory or are you creating a build directory, call cmake and then make (or similar build tool)?
  4. Can you show the actual compiler error in verbatim? Please add the command that invokes the compiler, for CMake you have to call make VERSOBE=1 to get the command.

Hello,

I'm compiling the latest version of SuperLU, in the compilation script it is cloned from GitHub
Here is the compilation call:

[93/308] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DDEBUGlevel=0 -DPRNTlevel=0 -I/Users/anton/ALIGN-public/_skbuild/macosx-10.15-x86_64-3.9/cmake-build/_deps/superlu-src/SRC -O3 -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.15 -fPIC -MD -MT _deps/superlu-build/SRC/CMakeFiles/superlu.dir/ssnode_bmod.c.o -MF _deps/superlu-build/SRC/CMakeFiles/superlu.dir/ssnode_bmod.c.o.d -o _deps/superlu-build/SRC/CMakeFiles/superlu.dir/ssnode_bmod.c.o -c /Users/anton/ALIGN-public/_skbuild/macosx-10.15-x86_64-3.9/cmake-build/_deps/superlu-src/SRC/ssnode_bmod.c
FAILED: _deps/superlu-build/SRC/CMakeFiles/superlu.dir/ssnode_bmod.c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DDEBUGlevel=0 -DPRNTlevel=0 -I/Users/anton/ALIGN-public/_skbuild/macosx-10.15-x86_64-3.9/cmake-build/_deps/superlu-src/SRC -O3 -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.15 -fPIC -MD -MT _deps/superlu-build/SRC/CMakeFiles/superlu.dir/ssnode_bmod.c.o -MF _deps/superlu-build/SRC/CMakeFiles/superlu.dir/ssnode_bmod.c.o.d -o _deps/superlu-build/SRC/CMakeFiles/superlu.dir/ssnode_bmod.c.o -c /Users/anton/ALIGN-public/_skbuild/macosx-10.15-x86_64-3.9/cmake-build/_deps/superlu-src/SRC/ssnode_bmod.c
/Users/anton/ALIGN-public/_skbuild/macosx-10.15-x86_64-3.9/cmake-build/_deps/superlu-src/SRC/ssnode_bmod.c:113:2: error: implicit declaration of function 'slsolve' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
slsolve ( nsupr, nsupc, &lusup[luptr], &lusup[ufirst] );
^
/Users/anton/ALIGN-public/_skbuild/macosx-10.15-x86_64-3.9/cmake-build/_deps/superlu-src/SRC/ssnode_bmod.c:114:2: error: implicit declaration of function 'smatvec' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
smatvec ( nsupr, nrow, nsupc, &lusup[luptr+nsupc],
^
2 errors generated.

ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/private/var/folders/94/hbb4hd6w8xj3qb001s722w200000gq/T/pip-build-env-nyi8j0xv/overlay/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 674, in setup
cmkr.make(make_args, install_target=cmake_install_target, env=env)
File "/private/var/folders/94/hbb4hd6w8xj3qb001s722w200000gq/T/pip-build-env-nyi8j0xv/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 696, in make
self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
File "/private/var/folders/94/hbb4hd6w8xj3qb001s722w200000gq/T/pip-build-env-nyi8j0xv/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 741, in make_impl
raise SKBuildError(msg)

An error occurred while building with CMake.
Command:
/private/var/folders/94/hbb4hd6w8xj3qb001s722w200000gq/T/pip-build-env-nyi8j0xv/overlay/lib/python3.9/site-packages/cmake/data/bin/cmake --build . --target install --config Release --
Install target:
install
Source directory:
/Users/anton/ALIGN-public
Working directory:
/Users/anton/ALIGN-public/_skbuild/macosx-10.15-x86_64-3.9/cmake-build
Please check the install target is valid and see CMake's output for more information.

error: subprocess-exited-with-error

Your C flags contain -Werror,-Wimplicit-function-declaration, this makes a harmless warning about an implicit declaration becoming an error. Do not add -Werrorand it should compile.

Still, implicit function declaration is not nice and should be fixed. I tried to reproduce issue (disabling the use of my system's BLAS, Clang 16, adding -Wimplicit-function-declaration), I was not able to. As Sherry pointed out, slsolve is unconditioned declared in slusdef.h which is included in ssnode_bmod.c.
Can you build again, passing -k to your cmake --build call? Then the build is continued even after build errors. It would be interesting to know whether it works for csnode_bmod.c, dsnode_bmod.c, and zsnode_bmod.c. It could help to indentify differences.

Can you control the ninja call for SuperLU? Or at least, can you see it? Then you can copy it. Add -v and all commands are printed that are executed by ninja.

I can see the ninja call for SuperLU, but I cannot copy it, nor can I edit it, because in the cmake call there are some temp files included, which get removed, when an error occurs.

/private/var/folders/94/hbb4hd6w8xj3qb001s722w200000gq/T/pip-build-env-nyi8j0xv/overlay/lib/python3.9/site-packages/cmake/data/bin/cmake /Users/anton/ALIGN-public -G Ninja --no-warn-unused-cli -DCMAKE_INSTALL_PREFIX:PATH=/Users/anton/ALIGN-public/_skbuild/macosx-10.15-x86_64-3.9/cmake-install -DPYTHON_VERSION_STRING:STRING=3.9.7 -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/private/var/folders/94/hbb4hd6w8xj3qb001s722w200000gq/T/pip-build-env-nyi8j0xv/overlay/lib/python3.9/site-packages/skbuild/resources/cmake -DPYTHON_EXECUTABLE:PATH=/Users/anton/ALIGN-public/general/bin/python3 -DPYTHON_INCLUDE_DIR:PATH=/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -DPYTHON_LIBRARY:PATH=/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib -DPython_EXECUTABLE:PATH=/Users/anton/ALIGN-public/general/bin/python3 -DPython_ROOT_DIR:PATH=/Users/anton/ALIGN-public/general -DPython_FIND_REGISTRY:STRING=NEVER -DPython_INCLUDE_DIR:PATH=/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -DPython3_EXECUTABLE:PATH=/Users/anton/ALIGN-public/general/bin/python3 -DPython3_ROOT_DIR:PATH=/Users/anton/ALIGN-public/general -DPython3_FIND_REGISTRY:STRING=NEVER -DPython3_INCLUDE_DIR:PATH=/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -DCMAKE_MAKE_PROGRAM:FILEPATH=/private/var/folders/94/hbb4hd6w8xj3qb001s722w200000gq/T/pip-build-env-nyi8j0xv/overlay/lib/python3.9/site-packages/ninja/data/bin/ninja -DALIGN_VERSION:string=0.9.8 -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.15 -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64 -DCMAKE_BUILD_TYPE:STRING=Release

Thanks for pointing out, that you are using ALIGN. They provide an outdated SuperLU version. In 5.2.2 slu_sdefs.h did not provide the necessary function declaration. This was fixed in 6.0.

  1. Short term, your editing of the SuperLU file is the only fix. Stick to it, for the time being.
  2. Mid term, ALIGN should update their SuperLU version they include as a third-party library. I opened an according issue, ALIGN-analoglayout/ALIGN-public#1282.

I think this issue can be closed, as it is fixed in 6.0 and we cannot fix it inside of ALIGN. Nevertheless, thanks for reporting and giving us the chance to improve SuperLU.

I updated ALIGN to use SuperLU 6.0 instead of 5.2, see ALIGN-analoglayout/ALIGN-public#1287 / ALIGN-analoglayout/ALIGN-public#1288. The merge request is already accepted. This issue is fixed with ALIGN main and their next release.