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

Create include wrappers for algorithm and memory #1218

Closed
dkolsen-pgi opened this issue Jul 1, 2020 · 0 comments · Fixed by #1219
Closed

Create include wrappers for algorithm and memory #1218

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

Comments

@dkolsen-pgi
Copy link
Collaborator

When compiling with NVC++, it is possible that #include <thrust/host_vector.h> will result in circular includes, in thrust::host_vector being used before it is defined, and in a cascading series of meaningless compilation errors. The fix for this requires cooperation between NVC++ and Thrust. On the Thrust, side all includes of <algorithm>, <numeric>, and <memory> need to be replaced by <thrust/detail/algorithm.h> (or similar) which wraps the include of the real file with a define/undef of a macro than NVC++ can look for.

@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
dkolsen-pgi added a commit that referenced this issue Jul 2, 2020
Accommodate compilers that use Thrust in their implementations of
C++ Standard algorithms.  To avoid cycles of include files, the
compiler needs to know when an include of an algorithms-related header
(<algorithm>, <numeric>, or <memory>) is coming from Thrust vs from
user code.  Create wrapper files to use when including <algorithm> or
<memory> that defines a macro that the compiler can check to know
where the include is coming from.  Change all includes of those files
within Thrust code to include the wrapper file instead.  (The same
change would also be made for <numeric> if Thrust files included
<numeric> anywhere.)

Fix #1218
alliepiper pushed a commit that referenced this issue Jul 3, 2020
Accommodate compilers that use Thrust in their implementations of
C++ Standard algorithms.  To avoid cycles of include files, the
compiler needs to know when an include of an algorithms-related header
(<algorithm>, <numeric>, or <memory>) is coming from Thrust vs from
user code.  Create wrapper files to use when including <algorithm> or
<memory> that defines a macro that the compiler can check to know
where the include is coming from.  Change all includes of those files
within Thrust code to include the wrapper file instead.  (The same
change would also be made for <numeric> if Thrust files included
<numeric> anywhere.)

Fix #1218
alliepiper pushed a commit that referenced this issue Jul 3, 2020
Accommodate compilers that use Thrust in their implementations of
C++ Standard algorithms.  To avoid cycles of include files, the
compiler needs to know when an include of an algorithms-related header
(<algorithm>, <numeric>, or <memory>) is coming from Thrust vs from
user code.  Create wrapper files to use when including <algorithm> or
<memory> that defines a macro that the compiler can check to know
where the include is coming from.  Change all includes of those files
within Thrust code to include the wrapper file instead.  (The same
change would also be made for <numeric> if Thrust files included
<numeric> anywhere.)

Fix #1218
dkolsen-pgi added a commit that referenced this issue Jul 10, 2020
Yesterday "#include <memory>" was added to
thrust/detail/allocator/allocator_traits.inl.  That caused a regression
when compiling with NVC++, breaking #1218.  This fix changes that include
to be "#include <thrust/detail/memory_wrapper.h>".  (And it makes the
same change to a different include of <memory> that I seem to have missed
in my earlier commit.)
alliepiper pushed a commit that referenced this issue Jul 10, 2020
Yesterday "#include <memory>" was added to
thrust/detail/allocator/allocator_traits.inl.  That caused a regression
when compiling with NVC++, breaking #1218.  This fix changes that include
to be "#include <thrust/detail/memory_wrapper.h>".  (And it makes the
same change to a different include of <memory> that I seem to have missed
in my earlier commit.)
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