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 with -DENABLE_CUDA=NO -DNSTATIC=YES still builds static and CUDA libraries #308

Closed
fxcoudert opened this issue Mar 9, 2023 · 8 comments
Assignees

Comments

@fxcoudert
Copy link

Describe the bug
Building with -DENABLE_CUDA=NO -DNSTATIC=YES still some CUDA libraries, including static ones, for libcholmod and libspqr:

Capture d’écran 2023-03-09 à 10 05 52

To Reproduce
Build is performed on julia's Yggdrasil: JuliaPackaging/Yggdrasil#6296
cmake flags are:

    cmake .. -DCMAKE_BUILD_TYPE=Release \
              -DCMAKE_INSTALL_PREFIX=${prefix} \
              -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
              -DENABLE_CUDA=NO \
              -DNFORTRAN=YES \
              -DNOPENMP=YES \
              -DNPARTITION=YES \
              -DNSTATIC=YES \
              -DBLAS_FOUND=1 \
              -DBLAS_LIBRARIES="${libdir}/lib${BLAS_NAME}.${dlext}" \
              -DBLAS_LINKER_FLAGS="${BLAS_NAME}" \
              -DBLAS_UNDERSCORE=ON \
              -DBLA_VENDOR="${BLAS_NAME}" \
              -DBLAS64_SUFFIX="_64" \
              -DALLOW_64BIT_BLAS=YES \
              -DLAPACK_FOUND=1 \
              -DLAPACK_LIBRARIES="${libdir}/lib${BLAS_NAME}.${dlext}" \
              -DLAPACK_LINKER_FLAGS="${BLAS_NAME}"

Expected behavior
No CUDA, no static libraries.

Desktop (please complete the following information):
Occurs on both Linux and macOS (all versions tested).

@fxcoudert
Copy link
Author

Something is inconsistent:

  | [09:01:29] -- Found LAPACK: /workspace/destdir/lib/libblastrampoline.so
  | [09:01:29] -- Building CHOLMOD_CUDA version: v4.0.3 (Jan 17, 2023)
  | [09:01:29] -- Source:        /workspace/srcdir/SuiteSparse/CHOLMOD
  | [09:01:29] -- Build:         /workspace/srcdir/SuiteSparse/CHOLMOD/build
  | [09:01:29] -- Install lib:     lib
  | [09:01:29] -- Install include: include
  | [09:01:29] -- Install bin:     bin
  | [09:01:29] -- Install rpath:
  | [09:01:29] -- Build   rpath:   /workspace/srcdir/SuiteSparse/CHOLMOD/build;/workspace/srcdir/SuiteSparse/CHOLMOD/build
  | [09:01:29] -- Build type:    Release
  | [09:01:29] -- Fortran: not enabled
  | [09:01:29] -- CUDA: not enabled

and

    [09:01:33] -- Found LAPACK: /workspace/destdir/lib/libblastrampoline.so
  | [09:01:33] -- Building SPQR_CUDA version: v3.0.3 (Jan 17, 2023)
  | [09:01:33] -- Source:        /workspace/srcdir/SuiteSparse/SPQR
  | [09:01:33] -- Build:         /workspace/srcdir/SuiteSparse/SPQR/build
  | [09:01:33] -- Install lib:     lib
  | [09:01:33] -- Install include: include
  | [09:01:33] -- Install bin:     bin
  | [09:01:33] -- Install rpath:
  | [09:01:33] -- Build   rpath:   /workspace/srcdir/SuiteSparse/SPQR/build;/workspace/srcdir/SuiteSparse/SPQR/build
  | [09:01:33] -- Build type:    Release
  | [09:01:33] -- Fortran: not enabled
  | [09:01:33] -- CUDA: not enabled
  | [09:01:33] -- BLAS libraries:      /workspace/destdir/lib/libblastrampoline.so
  | [09:01:33] -- BLAS include:
  | [09:01:33] -- BLAS linker flags:   blastrampoline
  | [09:01:33] -- LAPACK libraries:    /workspace/destdir/lib/libblastrampoline.so
  | [09:01:33] -- LAPACK include:
  | [09:01:33] -- LAPACK linker flags: blastrampoline
  | [09:01:33] -- SPQR cuda:  spqr_cuda
  | [09:01:33] -- Skipping the demos in SPQR/Demo

@rayegun
Copy link
Contributor

rayegun commented Mar 9, 2023

What does it look like with SUITESPARSE_CUDA=false?

@fxcoudert
Copy link
Author

Wait, it seems actually building and shipping empty CUDA-named libraries when CUDA is not enabled is not a bug, but a feature: 788eee6

🤯

@mmuetzel
Copy link
Contributor

This is probably a duplicate of #285.

@fxcoudert
Copy link
Author

Part is indeed duplicate. Part is not: in any case, static libraries should not be built.

@DrTimothyAldenDavis
Copy link
Owner

Thanks for the feedback.

The static issue should now be resolved in SuiteSparse v7.1.0.

I'm working on the empty-cuda library issue. That was a workaround for a build issue I had, where I couldn't get my internal tests to work without building the empty cholmod_cuda.so and spqr_cuda.so libraries. I'm trying to fix that; see #285.

I think I can close this as a duplicate of #285, now that the other part is resolved, but let me know if you see something here that isn't covered by #285.

@DrTimothyAldenDavis
Copy link
Owner

I think this is now resolved on the latest dev2 branch. Testing it now to make sure that's the case.

@DrTimothyAldenDavis
Copy link
Owner

OK -- this is now fixed in the dev2 branch, which will shortly become SuiteSparse v7.2.0.beta.

The only minor remaining issue is that if you don't have CUDA, and you build the SuiteSparse_GPURuntime or GPUQREngine libraries, then something gets built (libraries with nothing in them). That's odd, of course; it would be better not to create them at all. However, if you don't have CUDA, none of the other libraries will link against those to libraries (SPQR, specifically, which is the only one that uses those 2 libraries).

Those 2 libraries are built by the top-level Makefile, with a mere "make". But that top-level Makefile is optional anyway. I'm guessing a linux distro packaging mechanism would just use each individual CMake build system for each library, and then that mechanism could just skip building those libraries if CUDA is not available or not desired.

Two of the libraries that are subdirectories in CHOLMOD or SPQR (CHOLMOD_CUDA and SPQR_CUDA) are not built at all.

So this issue is essentially resolved now, and now I think I can close this issue. If there's something I'm missing I can reopen it, or a new issue could be posted. Just let me know. Thanks again for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

No branches or pull requests

4 participants