xiaoyeli / superlu

Supernodal sparse direct solver. https://portal.nersc.gov/project/sparse/superlu/
Other
272 stars 95 forks source link

Compilation failure with latest updates #146

Closed dschmitz89 closed 1 month ago

dschmitz89 commented 1 month ago

The master branch of SuperLU does not compile with the flags used in the SciPy build. See an exemplary CI log here: https://github.com/scipy/scipy/actions/runs/9912930601/job/27388819521?pr=21172#step:9:386

Important to note: this occurs on all platforms with different OSes

FAILED: scipy/sparse/linalg/_dsolve/libsuperlu_lib.a.p/SuperLU_SRC_cdiagonal.c.o 
ccache cc -Iscipy/sparse/linalg/_dsolve/libsuperlu_lib.a.p -Iscipy/sparse/linalg/_dsolve -I../scipy/sparse/linalg/_dsolve -I../scipy/sparse/linalg/_dsolve/SuperLU/SRC -fvisibility=hidden -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -std=c17 -O2 -g -Wno-unused-but-set-variable -Wno-unused-function -Wno-conversion -Wno-misleading-indentation -fPIC -DUSE_VENDOR_BLAS=1 -Wno-unused-variable -Wno-parentheses -Wno-unused-label -Wno-implicit-function-declaration -Wno-switch -Wno-unused-result -Wno-maybe-uninitialized -MD -MQ scipy/sparse/linalg/_dsolve/libsuperlu_lib.a.p/SuperLU_SRC_cdiagonal.c.o -MF scipy/sparse/linalg/_dsolve/libsuperlu_lib.a.p/SuperLU_SRC_cdiagonal.c.o.d -o scipy/sparse/linalg/_dsolve/libsuperlu_lib.a.p/SuperLU_SRC_cdiagonal.c.o -c ../scipy/sparse/linalg/_dsolve/SuperLU/SRC/cdiagonal.c
../scipy/sparse/linalg/_dsolve/SuperLU/SRC/cdiagonal.c: In function ‘cfill_diag’:
../scipy/sparse/linalg/_dsolve/SuperLU/SRC/cdiagonal.c:47:19: error: assignment to ‘singlecomplex *’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
   47 |         nzval_new = singlecomplexMalloc(nnz + fill);
      |                   ^
../scipy/sparse/linalg/_dsolve/SuperLU/SRC/cdiagonal.c: In function ‘cdominate’:
../scipy/sparse/linalg/_dsolve/SuperLU/SRC/cdiagonal.c:97:19: error: assignment to ‘singlecomplex *’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
   97 |         nzval_new = singlecomplexMalloc(nnz + fill);
      |                   ^
cc1: all warnings being treated as errors
[264/1341] Compiling C object scipy/sparse/csgraph/_traversal.cpython-310-x86_64-linux-gnu.so.p/meson-generated__traversal.c.o
ninja: build stopped: subcommand failed.
Build failed!

CC the following PR in SciPy: https://github.com/scipy/scipy/pull/21172

For visibility CC @rgommers

gruenich commented 1 month ago

Is this a duplicate of #122? Or at least related?

adedner commented 1 month ago

I've run into a problem with singlecomplex as well yesterday with superlu build as part of petsc and using it in dune. This looks like a duplicate of #122.

Issue

After including the superlu header the usage of std::complex in the dune code fails with singlecomplex not a member of std.

Fix

I changed

#define complex singlecomplex  // backward compatibility

to

typedef singlecomplex complex;

in slu_complex.h. Which solved the problem for me.

Removing the define completely could lead to backward compatibility issues. In my case it caused problems with the usage of ::complex (no std) in parts of the dune code but this could be seen as a bug in the our code and fixed there.

gruenich commented 1 month ago

Thanks for the explanations @adedner and @wo80! I created #148 to remove the #define complex and add an optional typdef for people who need backwards compatibility. Can you please give it a try? I welcome feedback, including wording and naming of variables.

dschmitz89 commented 1 month ago

@gruenich : I will give your branch a test over at SciPy but will take a few days.

dschmitz89 commented 1 month ago

Thanks @gruenich @xiaoyeli : compilation works now, will SciPy's vendored SuperLU soon.