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

Move imported CMake targets to SuiteSparse:: namespace #352

Merged
merged 42 commits into from
Aug 25, 2023

Conversation

mmuetzel
Copy link
Contributor

@mmuetzel mmuetzel commented Jul 4, 2023

This is a first proposal for how to move the imported CMake targets to a SuiteSparse:: namespace.
For the time being it only touches the suitesparseconfig target. I'd like to get feedback on this first to avoid more changes later on.

Target names in CMake are case sensitive. There are no central guidelines for the letter case of namespaces and target names. But most projects seem to use CamelCase for the namespace and target and underscore _ to separate "variants". E.g., OpenMP uses imported targets with names like OpenMP::OpenMP_C or OpenMP::OpenMP_Fortran.

The target names have been entirely internal until recently (#267). Currently, they are all lower-case. If we'd like to change that, now is the time for that. A version of SuiteSparse with #267 hasn't been released yet and we don't need to worry about backward compatibility yet.

In the current version of this PR, I used CamelCase for the name of the namespace. But I didn't touch the letter-case of the target itself.
Should the targets themselves be renamed to be CamelCase, too? I'd be slightly in favor of that, i.e., changing it to SuiteSparseConfig and SuiteSparseConfig_static. Even if that means a little more effort now, it might be the "nicer" solution in the long run. But I'd be happy with whatever you prefer.

@DrTimothyAldenDavis: What do you think?

@mmuetzel mmuetzel force-pushed the cmake branch 2 times, most recently from 018def1 to 21cd2b4 Compare July 4, 2023 17:29
@mmuetzel
Copy link
Contributor Author

Since there was no reaction in more than a week, I'm assuming that renaming those targets is OK.

I'm planning to rename the imported targets as follows:
amd -> SuiteSparse::AMD
btf -> SuiteSparse::BTF
camd -> SuiteSparse::CAMD
ccolamd -> SuiteSparse::CCOLAMD
cholmod -> SuiteSparse::CHOLMOD
colamd -> SuiteSparse::COLAMD
cxsparse -> SuiteSparse::CXSparse
gpuqrengine -> SuiteSparse::GPUQREngine
graphblas -> SuiteSparse::GraphBLAS
klu -> SuiteSparse::KLU
ldl -> SuiteSparse::LDL
mongoose -> SuiteSparse::Mongoose
rbio -> SuiteSparse::RBio
spex -> SuiteSparse::SPEX
spqr -> SuiteSparse::SPQR
suitesparse_gpuruntime -> SuiteSparse::GPURuntime
umfpack -> SuiteSparse::UMFPACK

I also plan to use the suffix _static for a target that links to the respective static library if applicable.

Please, let me know if you prefer to use different target names.

@DrTimothyAldenDavis
Copy link
Owner

I've been on vacation the past 2 weeks so I'm a bit behind, but the name space changes look good at first glance.

@mmuetzel mmuetzel marked this pull request as ready for review July 22, 2023 14:04
@mmuetzel
Copy link
Contributor Author

No worries.
I've finished renaming the targets and moving them to the SuiteSparse:: namespace.
It should be ready for review now.

@mmuetzel
Copy link
Contributor Author

Rebased to a current head to resolve conflict.

@DrTimothyAldenDavis DrTimothyAldenDavis merged commit c3cb273 into DrTimothyAldenDavis:dev2 Aug 25, 2023
13 checks passed
@DrTimothyAldenDavis
Copy link
Owner

@mmuetzel : I'm getting an error when trying to build SPQR with CUDA enabled, with this update to dev2 for the SuiteSparse:: namespace. The SPQR build says the following:

-- CHOLMOD version: 4.0.4
-- CHOLMOD include: /home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/Include
-- CHOLMOD library: /home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build/libcholmod.so.4.0.4
-- CHOLMOD static:  /home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build/libcholmod.a
CMake Warning at CMakeLists.txt:85 (find_package):
  Found package configuration file:

    /home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build/CHOLMODConfig.cmake

  but it set CHOLMOD_FOUND to FALSE so package "CHOLMOD" is considered to be
  NOT FOUND.  Reason given by package:

  The following imported targets are referenced, but are missing:
  SuiteSparse::CHOLMOD_CUDA_static

Is this because the libcholmod_cuda.so file is in CHOLMOD/build/GPU perhaps?

This report from the SPQR build also looks strange:

-- SuiteSparse_GPURuntime version: 2.0.4
-- SuiteSparse_GPURuntime include: $<TARGET_PROPERTY:SuiteSparse::SuiteSparseConfig,INTERFACE_INCLUDE_DIRECTORIES>
-- SuiteSparse_GPURuntime library: /home/faculty/d/davis/dev2/SuiteSparse/SuiteSparse_GPURuntime/build/libsuitesparse_gpuruntime.so.2.0.4
-- SuiteSparse_GPURuntime static:  /home/faculty/d/davis/dev2/SuiteSparse/SuiteSparse_GPURuntime/build/libsuitesparse_gpuruntime.a

The include report is broken.

I think this might be a flaw in the use of "TARGET_PROPERTY". I see in most places it is used, the whole thing is encapulated in a double-quoted string. But in GPUQREngine, SPQR/SPQRGPU, and SuiteSparse_GPURuntime, the double qoutes are missing.

I fixed the double quotes but I still get errors when (for example) building UMFPACK, which looks for CHOLMOD as an optional dependency. It still reports the error that SuiteSparse::CHOLMOD_CUDA_static is not found. I also still get the TARGET_PROPERTY:... message above for the include file.

The library is present:


hypersparse $ pwd
/home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build/GPU
hypersparse $ ls
CMakeFiles  cmake_install.cmake  libcholmod_cuda.a  libcholmod_cuda.so  libcholmod_cuda.so.4  libcholmod_cuda.so.4.0.4  Makefile

The CHOLMOD build (after building it already) says that the library libcholmod_cuda.a and *so exists:

hypersparse $ make
( cd build && cmake  .. && cmake --build . --config Release -j8 )
-- Building CHOLMOD version: v4.0.4 (June 16, 2023)
-- Source:        /home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD 
-- Build:         /home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build 
-- Install lib:     lib
-- Install include: include
-- Install bin:     bin
-- Install rpath:   
-- Build   rpath:   /home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build
-- Build type:    Release 
-- Fortran: /usr/bin/f95
-- Looking for CUDA
-- Find CUDA tool kit:
-- CUDA toolkit found:   TRUE
-- CUDA toolkit version: 11.7.99
-- CUDA toolkit include: /usr/local/cuda/include
-- CUDA toolkit lib dir: /usr/local/cuda/lib64
-- CUDA: enabled
-- #include <sys/types.h> and ssize_t: OK
-- SuiteSparse_config version: 7.1.0
-- SuiteSparse_config include: /home/faculty/d/davis/dev2/SuiteSparse/SuiteSparse_config
-- SuiteSparse_config library: /home/faculty/d/davis/dev2/SuiteSparse/SuiteSparse_config/build/libsuitesparseconfig.so.7.1.0
-- SuiteSparse_config static:  /home/faculty/d/davis/dev2/SuiteSparse/SuiteSparse_config/build/libsuitesparseconfig.a
-- COLAMD version: 3.0.4
-- COLAMD include: /home/faculty/d/davis/dev2/SuiteSparse/COLAMD/Include
-- COLAMD library: /home/faculty/d/davis/dev2/SuiteSparse/COLAMD/build/libcolamd.so.3.0.4
-- COLAMD static:  /home/faculty/d/davis/dev2/SuiteSparse/COLAMD/build/libcolamd.a
-- AMD version: 3.0.4
-- AMD include: /home/faculty/d/davis/dev2/SuiteSparse/AMD/Include
-- AMD library: /home/faculty/d/davis/dev2/SuiteSparse/AMD/build/libamd.so.3.0.4
-- AMD static:  /home/faculty/d/davis/dev2/SuiteSparse/AMD/build/libamd.a
-- CAMD version: 3.0.4
-- CAMD include: /home/faculty/d/davis/dev2/SuiteSparse/CAMD/Include
-- CAMD library: /home/faculty/d/davis/dev2/SuiteSparse/CAMD/build/libcamd.so.3.0.4
-- CAMD static:  /home/faculty/d/davis/dev2/SuiteSparse/CAMD/build/libcamd.a
-- CCOLAMD version: 3.0.4
-- CCOLAMD include: /home/faculty/d/davis/dev2/SuiteSparse/CCOLAMD/Include
-- CCOLAMD library: /home/faculty/d/davis/dev2/SuiteSparse/CCOLAMD/build/libccolamd.so.3.0.4
-- CCOLAMD static:  /home/faculty/d/davis/dev2/SuiteSparse/CCOLAMD/build/libccolamd.a
-- Looking for Intel 32-bit BLAS
-- Found Intel10_64lp 32-bit BLAS
-- Building CHOLMOD_CUDA version: v4.0.4 (June 16, 2023)
-- Source:        /home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD 
-- Build:         /home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build 
-- Install lib:     lib
-- Install include: include
-- Install bin:     bin
-- Install rpath:   
-- Build   rpath:   /home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build;/home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build
-- Build type:    Release 
-- Fortran: /usr/bin/f95
-- Looking for CUDA
-- Find CUDA tool kit:
-- CUDA toolkit found:   TRUE
-- CUDA toolkit version: 11.7.99
-- CUDA toolkit include: /usr/local/cuda/include
-- CUDA toolkit lib dir: /usr/local/cuda/lib64
-- CUDA: enabled
-- C++ flags for CUDA:   -DSUITESPARSE_CUDA
-- nvcc flags for CUDA: -cudart=static -lineinfo -DSUITESPARSE_CUDA
-- OpenMP C libraries:      /usr/lib/gcc/x86_64-linux-gnu/9/libgomp.so;/usr/lib/x86_64-linux-gnu/libpthread.so 
-- OpenMP C include:         
-- OpenMP C flags:          -fopenmp 
-- BLAS libraries:      /usr/lib/x86_64-linux-gnu/libmkl_gf_lp64.so;/usr/lib/x86_64-linux-gnu/libmkl_gnu_thread.so;/usr/lib/x86_64-linux-gnu/libmkl_core.so;/usr/lib/gcc/x86_64-linux-gnu/9/libgomp.so;-lpthread;-lm;-ldl 
-- BLAS include:         
-- BLAS linker flags:    
-- LAPACK libraries:    /usr/lib/x86_64-linux-gnu/libmkl_gf_lp64.so;/usr/lib/x86_64-linux-gnu/libmkl_gnu_thread.so;/usr/lib/x86_64-linux-gnu/libmkl_core.so;/usr/lib/gcc/x86_64-linux-gnu/9/libgomp.so;-lpthread;-lm;-ldl;-lpthread;-lm;-ldl 
-- LAPACK include:       
-- LAPACK linker flags:  
-- CHOLMOD cuda: CHOLMOD_CUDA
-- Skipping the demos in CHOLMOD/Demo
-- ------------------------------------------------------------------------
-- SuiteSparse CMAKE report for: cholmod
-- ------------------------------------------------------------------------
-- inside common SuiteSparse root:  false
-- install in SuiteSparse/lib and SuiteSparse/include: OFF
-- build type:           Release
-- NSTATIC:              false (build static library)
-- use OpenMP:           yes 
-- C compiler:           /usr/bin/cc 
-- C flags:                 -fopenmp 
-- C++ compiler:         /usr/bin/c++
-- C++ flags:             -fopenmp 
-- C Flags release:      -O3 -DNDEBUG 
-- C++ Flags release:    -O3 -DNDEBUG 
-- Fortran compiler:     /usr/bin/f95 
-- compile definitions:  SUITESPARSE_CUDA;BLAS_Intel10_64lp
-- BLAS integer:         int32_t
-- CUDA architectures:   52;75;80
-- ------------------------------------------------------------------------
-- Configuring done (1.0s)
-- Generating done (0.1s)
-- Build files have been written to: /home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build
make[1]: Entering directory '/home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build'
make[2]: Entering directory '/home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build'
make[3]: Entering directory '/home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build'
make[3]: Entering directory '/home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build'
make[3]: Leaving directory '/home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build'
make[3]: Leaving directory '/home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build'
[  2%] Built target CHOLMOD_CUDA_static
[  5%] Built target CHOLMOD_CUDA
make[3]: Entering directory '/home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build'
make[3]: Entering directory '/home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build'
make[3]: Leaving directory '/home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build'
make[3]: Leaving directory '/home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build'
[ 53%] Built target CHOLMOD_static
[100%] Built target CHOLMOD
make[2]: Leaving directory '/home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build'
make[1]: Leaving directory '/home/faculty/d/davis/dev2/SuiteSparse/CHOLMOD/build'

Any ideas?

@DrTimothyAldenDavis
Copy link
Owner

See the build output (after building once, first), attached.

build.txt

@mmuetzel
Copy link
Contributor Author

I'm getting an error when trying to build SPQR with CUDA enabled, with this update to dev2 for the SuiteSparse:: namespace.

I don't know how to use CUDA. But I'll try to look into it.

This report from the SPQR build also looks strange:

-- SuiteSparse_GPURuntime version: 2.0.4
-- SuiteSparse_GPURuntime include: $<TARGET_PROPERTY:SuiteSparse::SuiteSparseConfig,INTERFACE_INCLUDE_DIRECTORIES>
-- SuiteSparse_GPURuntime library: /home/faculty/d/davis/dev2/SuiteSparse/SuiteSparse_GPURuntime/build/libsuitesparse_gpuruntime.so.2.0.4
-- SuiteSparse_GPURuntime static:  /home/faculty/d/davis/dev2/Sui

That's a CMake generator expression. I guess the generator didn't expand that expression yet. Do you see actual errors because of this? If not, this is mostly cosmetic imho.

@mmuetzel
Copy link
Contributor Author

Could you please upload your generated CHOLMODConfig.cmake and CHOLMODTargets.cmake files from your CHOLMOD/build folder?

@mmuetzel
Copy link
Contributor Author

Maybe, #357 resolves the build issue with CUDA.

@DrTimothyAldenDavis
Copy link
Owner

Thanks for taking a look.

Here's a folder with all of CHOLMOD/build/*cmake, and also the CHOLMOD/build/GPU/*cmake.

cholmod_build_files.zip

I'll try out #357 now.

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

Successfully merging this pull request may close these issues.

2 participants