Skip to content

Use Legion with CMake's native CUDA language#725

Closed
trxcllnt wants to merge 99 commits intonv-legate:branch-23.09from
trxcllnt:fea/legion-with-cmake-cuda-language
Closed

Use Legion with CMake's native CUDA language#725
trxcllnt wants to merge 99 commits intonv-legate:branch-23.09from
trxcllnt:fea/legion-with-cmake-cuda-language

Conversation

@trxcllnt
Copy link
Contributor

This PR updates legate.core to use a Legion branch that incorporates the changes in the drop-find-cuda PR.

@trxcllnt trxcllnt added the category:improvement PR introduces an improvement and will be classified as such in release notes label May 12, 2023
@trxcllnt trxcllnt requested a review from jjwilke May 12, 2023 21:03
LIBRARY_OUTPUT_DIRECTORY lib)

if(Legion_USE_CUDA)
set_property(TARGET legate_core PROPERTY CUDA_ARCHITECTURES ${Legion_CUDA_ARCH})
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like we now have a potential conflict between CMAKE_CUDA_ARCHITECTURES and Legion_CUDA_ARCH. If someone were to specify -DCMAKE_CUDA_ARCHITECTURES=80, e.g., it will just be silently ignored because of this line.

Or is this okay because of the new line in Legion:

    if(CMAKE_CUDA_ARCHITECTURES)
      set(Legion_CUDA_ARCH ${CMAKE_CUDA_ARCHITECTURES})

?

Copy link
Contributor Author

@trxcllnt trxcllnt May 15, 2023

Choose a reason for hiding this comment

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

Yeah right now if someone sets -DCMAKE_CUDA_ARCHITECTURES= (or has set it before add_subdirectory(./legion)), then I made Legion use it instead of -DLegion_CUDA_ARCH=. It feels a bit backward at first since -DLegion_CUDA_ARCH seems more project-specific than -DCMAKE_CUDA_ARCHITECTURES=.

But Legion_CUDA_ARCH is parsed (commas -> semis) and defaults to all-major if unset, so I wanted to have an "escape hatch" if someone wants to force an exact list of GPU architectures that skips (or resets) all of Legion's arch logic.

Copy link
Contributor Author

@trxcllnt trxcllnt May 15, 2023

Choose a reason for hiding this comment

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

Oh but you're right in the find_package(Legion) case. Now legate.core ignores the -DCMAKE_CUDA_ARCHITECTURES argument and use whatever archs Legion used. This mirrors how if we find a Legion that built with -DLegion_USE_CUDA=OFF, legate.core uses that value even if the user configures with -DLegion_USE_CUDA=ON.

Copy link
Contributor

@jjwilke jjwilke May 15, 2023

Choose a reason for hiding this comment

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

Hmm... I think that's fine. I guess we might at least want a warning in that situation. Or do we want to FATAL_ERROR if someone tries to set CMAKE_CUDA_ARCHITECTURES in that situation and it's totally disallowed?

"git_url" : "https://gitlab.com/StanfordLegion/legion.git",
"git_tag" : "915f481e5daa9485344866062441d4ce4d7fb365"
"git_url" : "https://gitlab.com/inlineptx/legion.git",
"git_tag" : "0de432af68dc8a8274dd5412945e946cea08f3bc"
Copy link
Contributor

Choose a reason for hiding this comment

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

Just putting a reminder here to reset this before merging with mainline.

@marcinz marcinz changed the base branch from branch-23.05 to branch-23.07 May 18, 2023 20:10
@trxcllnt trxcllnt force-pushed the fea/legion-with-cmake-cuda-language branch from 3b328a4 to 15f1359 Compare June 24, 2023 02:22
@trxcllnt trxcllnt force-pushed the fea/legion-with-cmake-cuda-language branch from 15f1359 to 15cf543 Compare June 24, 2023 02:24
@trxcllnt trxcllnt force-pushed the fea/legion-with-cmake-cuda-language branch from 151c1b8 to 018a200 Compare July 25, 2023 23:19
@trxcllnt
Copy link
Contributor Author

Closing in favor of #828.

@trxcllnt trxcllnt closed this Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:improvement PR introduces an improvement and will be classified as such in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants