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

CMake CUDA flags for MinSizeRel RelWithDebInfo #798

Closed
ptheywood opened this issue Feb 14, 2022 · 1 comment · Fixed by #849
Closed

CMake CUDA flags for MinSizeRel RelWithDebInfo #798

ptheywood opened this issue Feb 14, 2022 · 1 comment · Fixed by #849
Labels

Comments

@ptheywood
Copy link
Member

We may wish to adjust our CMake to set certain values for MinSizeRel and RelWithDebInfo builds which are currently only set for Debug or Release builds as appropriate.

I.e. the default value of SEATBELTS, use of -lineinfo and -G etc.

This is unlikely to effect most users (who will likely use Debug or Release exclusively) but would be nice to improve (at least RelWithDebInfo).

We probably always want to set -lineinfo, unless -G is set.

It's less clear when (_)DEBUG/(_)NDEBUG should be set which might need some thought / reading.

The easiest way to find current non-default cmake config specific options is to search for CONFIG:. Due to IDE style tools such as Visual Studio, we should only use generator expressions for this type of thing rather than using CMAKE_BUILD_TYPE anywhere.

ptheywood added a commit that referenced this issue May 9, 2022
Includes a couple of other very minor CMake tweaks

Closes #798
@ptheywood
Copy link
Member Author

By default, CMake's CUDA integration sets:

//Flags used by the CUDA compiler during DEBUG builds.
CMAKE_CUDA_FLAGS_DEBUG:STRING=-g

//Flags used by the CUDA compiler during MINSIZEREL builds.
CMAKE_CUDA_FLAGS_MINSIZEREL:STRING=-O1 -DNDEBUG

//Flags used by the CUDA compiler during RELEASE builds.
CMAKE_CUDA_FLAGS_RELEASE:STRING=-O3 -DNDEBUG

//Flags used by the CUDA compiler during RELWITHDEBINFO builds.
CMAKE_CUDA_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG

So this resolves the DEBUG/NDEBUG setting for us.

--device-debug/-G disabled all optimisations, so doesn't make sense for RelWithDebInfo. Adding -lineinfo would make profiling useful and might provide better info from cuda tools, but device code won't be debuggable.

Seatbelts being always on for debug only makes sense, otherwise it is up to the user already (and defaults to enabled), which seems sane to me.


I'll chuck a quick PR in enabling -lineinfo for MinSizeRel and RelWithDebInfo, otherwise we have no other relevant settings to change.

ptheywood added a commit that referenced this issue May 9, 2022
Includes a couple of other very minor CMake tweaks

Unfortunately cannot use the multi-argument form of $<CONFIG: as this requires CMake >= 3.19

Closes #798
mondus pushed a commit that referenced this issue May 11, 2022
Includes a couple of other very minor CMake tweaks

Unfortunately cannot use the multi-argument form of $<CONFIG: as this requires CMake >= 3.19

Closes #798
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant