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

Use proper include path for cholmod.h. #364

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

stellaraccident
Copy link

It appears that the SuiteSparse::CHOLMOD CMake library advertises its include directory as $PREFIX/include/suitesparse, making the proper way to include it #include <cholmod.h>. When installed in the system /usr prefix, the suitesparse/cholmod.h path works by accident. When using a custom built suitesparse at a custom location, this is not so.

I believe that this change is the correct way to do it for all configurations, based on how the SuiteSparse library is set up.

amd-jnovotny and others added 3 commits January 8, 2025 10:14
…2025 (ROCm#350) (ROCm#352)

Update license file for 2025 (ROCm#350)

(cherry picked from commit 8e02445)
…n BUILD_WITH_SPARSE flag (ROCm#354)

Conditionally include sparse source files based on BUILD_WITH_SPARSE flag (ROCm#353)

Refactor CMakeLists.txt to conditionally include sparse source files based on BUILD_WITH_SPARSE flag

Co-authored-by: Huanran Wang <[email protected]>
It appears that the `SuiteSparse::CHOLMOD` CMake library advertises its include directory as `$PREFIX/include/suitesparse`, making the proper way to include it `#include <cholmod.h>`. When installed in the system `/usr` prefix, the `suitesparse/cholmod.h` path works by accident. When using a custom built suitesparse at a custom location, this is not so.

I believe that this change is the correct way to do it for all configurations, based on how the SuiteSparse library is set up.
@stellaraccident stellaraccident changed the base branch from develop to mainline February 12, 2025 01:51
@jmachado-amd
Copy link
Collaborator

Hi @stellaraccident, thanks! I'll have a look at your PR tomorrow, in the meantime, please target the fix at the develop branch.

stellaraccident added a commit to nod-ai/TheRock that referenced this pull request Feb 12, 2025
* Adds host-math group and includes OpenBLAS and SuiteSparse in it to
provide libcholmod (so that we have the option to avoid system deps for
these).
* Includes upstream patch ROCm/hipSOLVER#364
* Includes upstream patch ROCm/rocminfo#97

Includes workarounds for #82, #83

---------

Co-authored-by: Stella Laurenzo <[email protected]>
Copy link
Collaborator

@jmachado-amd jmachado-amd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @stellaraccident, it looks like my week was far busier than anticipated -- apologies for the delay. I see two other changes that are required in order to allow hipSOLVER to find its Suitesparse dependencies in a general setting:

find_path(CHOLMOD_INCLUDE_DIR suitesparse/cholmod.h)

should be updated into:

find_path(CHOLMOD_INCLUDE_DIR
    NAMES cholmod.h
    PATH_SUFFIXES suitesparse
    )

find_path(SUITESPARSE_CONFIG_INCLUDE_DIR suitesparse/SuiteSparse_config.h)

should be updated into:

find_path(SUITESPARSE_CONFIG_INCLUDE_DIR
    NAMES SuiteSparse_config.h
    PATH_SUFFIXES suitesparse
    )

Thanks again for taking the time to make the PR, and please let me know if this works for you.

Copy link
Collaborator

@cgmb cgmb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is wrong, then mea culpa. I'd hoped that Spack would catch this sort of error, but I guess they had a patch for an earlier problem which ended up sidestepping this issue. :(

The bit that confuses me is that the SuiteSparse::CHOLMOD target is actually quite a new thing in the upstream SuiteSparse project. It didn't exist in older versions, so it's weird that there's an expectation that the user will add an include path to their build flags just to use the OS-provided SuiteSparse headers.

@stellaraccident
Copy link
Author

Yeah, it's kind of a head scratcher if trying to unwind how this got this way and ever worked right. The details on this are context switched out of my head, but I have an easy repro to try changes with a local built SuiteSparse.

@jmachado-amd
Copy link
Collaborator

@stellaraccident, I've opened a pr with the changes I suggested last week. They work in my own tests, but please let me know if you can try them in your reproducer.

hipSOLVER's find module scripts (for suitesparse) were using `find_path`
on name `suitesparse/cholmod.h` instead of `cholmod.h`, which allowed
hipSOLVER to `#include <suitesparse/cholmod.h>`.

This commit updates the aforementioned cmake scripts, to honour the way
`Suitesparse::CHOLMOD` advertises its include directories.
@jmachado-amd
Copy link
Collaborator

Hello @renjithravindrankannath, we would be very grateful if you could test this PR in spack. Many thanks in advance!

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.

5 participants