Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Change cub::DeviceCount to not define static variable in host/device function #1217

Closed
dkolsen-pgi opened this issue Jul 1, 2020 · 0 comments · Fixed by brycelelbach/cub_historical_2019_2020#39
Assignees
Labels
nvbug Has an associated internal NVIDIA NVBug.
Milestone

Comments

@dkolsen-pgi
Copy link
Collaborator

The function cub::DeviceCount in file cub/util_device.cuh defines a static variable in a host-only region within a host/device function. NVC++ is being changed to report a compiler error when a device function or a host/device function defines any static variables. NVC++ is currently not smart enough to figure out that the static variable is defined in a host-only region, so it reports an error in DeviceCount. Fixing NVC++ to recognize this situation will take a while. In the meantime, cub::DeviceCount should be changed to not define a static variable. The definition of the static variable should be moved to a separate host-only function.

@dkolsen-pgi dkolsen-pgi added the nvbug Has an associated internal NVIDIA NVBug. label Jul 1, 2020
@dkolsen-pgi dkolsen-pgi added this to the 1.9.10-1 milestone Jul 1, 2020
@dkolsen-pgi dkolsen-pgi self-assigned this Jul 1, 2020
kshitij12345 pushed a commit to kshitij12345/thrust that referenced this issue Mar 24, 2022
A future release of NVC++ will report an error for local static variables
that are defined in device functions and host/device functions, even if
the variable is defined within a host-only region of the function.  To
avoid errors, move the local static variable that stores the device count
from cub::DeviceCount() to a separate host-only function.

Fix NVIDIA#1217
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
nvbug Has an associated internal NVIDIA NVBug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant