Skip to content

Add cmake option for CAMP_USE_PLATFORM_DEFAULT_STREAM#205

Open
helloworld922 wants to merge 11 commits into
llnl:mainfrom
helloworld922:feature/default_stream
Open

Add cmake option for CAMP_USE_PLATFORM_DEFAULT_STREAM#205
helloworld922 wants to merge 11 commits into
llnl:mainfrom
helloworld922:feature/default_stream

Conversation

@helloworld922

Copy link
Copy Markdown

No description provided.

Riyaz Haque and others added 2 commits May 29, 2026 10:57
Changes to the cmake option for default stream
Comment thread CMakeLists.txt Outdated
@artv3

artv3 commented Jun 9, 2026

Copy link
Copy Markdown
Member

Used internally: https://github.com/llnl/camp/blob/56b194f3ea3d0e9d6e2f236de39a4886063e4968/include/camp/resource/hip.hpp#L187C5-L187C37

@helloworld922 , is the issue that we do not have a CMAKE variable to define it?

@helloworld922

Copy link
Copy Markdown
Author

Yes, the define is supposed to be user defined if they want to use default streams, but unless you properly forward the compiler define to all downstream dependencies you either end up with an ODR violation and/or not having the correct behavior of which stream kernels are being run on. This just makes sure that the define is baked into the installed RAJA headers so everyone picks up a consistent definition.

Comment thread include/camp/config.in.hpp Outdated
MrBurmark
MrBurmark previously approved these changes Jun 23, 2026
adayton1
adayton1 previously approved these changes Jun 23, 2026
Comment thread include/camp/config.in.hpp Outdated
@helloworld922 helloworld922 dismissed stale reviews from adayton1 and MrBurmark via 100158d June 23, 2026 17:52
rhornung67
rhornung67 previously approved these changes Jun 23, 2026
Comment thread include/camp/config.in.hpp Outdated
@adayton1 adayton1 requested a review from rhornung67 June 23, 2026 19:54
MrBurmark
MrBurmark previously approved these changes Jun 23, 2026
adayton1
adayton1 previously approved these changes Jun 23, 2026
rhornung67
rhornung67 previously approved these changes Jun 23, 2026
Comment thread include/camp/config.in.hpp Outdated
#else
#cmakedefine01 CAMP_USE_PLATFORM_DEFAULT_STREAM_INTERNAL_CHECK
#if CAMP_USE_PLATFORM_DEFAULT_STREAM != CAMP_USE_PLATFORM_DEFAULT_STREAM_INTERNAL_CHECK
#warning "CAMP_USE_PLATFORM_DEFAULT_STREAM mismatch, potential ODR violation"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Make this an error

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@helloworld922 If you no longer will need to define CAMP_USE_PLATFORM_DEFAULT_STREAM from outside of this header we were thinking about disallowing that to avoid ODR violations.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think that would be ideal. I moved the check to a part of config.in.hpp which should only be defined once. It still supports users having manually defined CAMP_USE_PLATFORM_DEFAULT_STREAM for backwards compatibility, but it must match how RAJA is configured to be built.

Alternatively, I could just remove this and force all users to not have CAMP_USE_PLATFORM_DEFAULT_STREAM externally defined at all.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I like the idea of a hard error if users have CAMP_USE_PLATFORM_DEFAULT_STREAM externally defined:

#if defined(CAMP_USE_PLATFORM_DEFAULT_STREAM)
#error "Manually defining CAMP_USE_PLATFORM_DEFAULT_STREAM is not allowed because of the potential for ODR violations. CAMP now supports a CMake configuration option that should be used instead."
#endif

#cmakedefine01 CAMP_USE_PLATFORM_DEFAULT_STREAM

@helloworld922 helloworld922 dismissed stale reviews from rhornung67 and adayton1 via 59a36de June 30, 2026 16:06
#define CAMP_DLL_EXPORT
#endif

#ifndef CAMP_CONFIG_HPP

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@trws, @MrBurmark should this header guard be at the beginning of the file or after the CAMP_CONFIG_OVERRIDE section?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Previously there was no header guard at all, so it would make sense to me to add one around everything. @trws was there a specific reason not to guard this header?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I assume that even if you are using the override you can only want to config camp once per translation unit.

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.

7 participants