Skip to content

Commit a33734b

Browse files
committed
Miscellaneous warning cleanup.
This patch gets a clean build using recent internal nvcc and gcc 7.4.0, with the exception of Github NVIDIA#1049. We were adding `dependencies/cub/cub` to the include line, but including headers as `#include <cub/xxx.cuh>`. This caused builds to pull from the system cub headers installed with the toolkit. Templated utilites `has_member_construct1` and `contiguous_storage` were calling `__host__` only methods from `__host__ __device__` members. This was also calling some tricky to find "host from h/d" warnings.
1 parent 24d754d commit a33734b

File tree

5 files changed

+14
-28
lines changed

5 files changed

+14
-28
lines changed

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ foreach (THRUST_TEST_SOURCE IN LISTS THRUST_TESTS)
491491

492492
target_include_directories(
493493
${THRUST_TEST}
494-
PUBLIC ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies/cub/cub
494+
PUBLIC ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies/cub
495495
PRIVATE ${PROJECT_SOURCE_DIR}/testing
496496
)
497497

@@ -518,7 +518,7 @@ foreach (THRUST_TEST_SOURCE IN LISTS THRUST_TESTS)
518518

519519
target_include_directories(
520520
${THRUST_TEST_RDC}
521-
PUBLIC ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies/cub/cub
521+
PUBLIC ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies/cub
522522
PRIVATE ${PROJECT_SOURCE_DIR}/testing
523523
)
524524

@@ -617,7 +617,7 @@ foreach (THRUST_EXAMPLE_SOURCE IN LISTS THRUST_EXAMPLES)
617617

618618
target_include_directories(
619619
${THRUST_EXAMPLE}
620-
PUBLIC ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies/cub/cub
620+
PUBLIC ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies/cub
621621
PRIVATE ${PROJECT_SOURCE_DIR}/examples
622622
)
623623

@@ -640,7 +640,7 @@ foreach (THRUST_EXAMPLE_SOURCE IN LISTS THRUST_EXAMPLES)
640640

641641
target_include_directories(
642642
${THRUST_EXAMPLE_RDC}
643-
PUBLIC ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies/cub/cub
643+
PUBLIC ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/dependencies/cub
644644
PRIVATE ${PROJECT_SOURCE_DIR}/examples
645645
)
646646

dependencies/cub

Submodule cub updated from 6552e4d to 367ad9a

thrust/detail/allocator/allocator_traits.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ template<typename Alloc, typename T>
8787
a.construct(p);
8888
}
8989

90+
__thrust_exec_check_disable__
9091
template<typename Alloc, typename T>
9192
inline __host__ __device__
9293
typename disable_if<

thrust/detail/contiguous_storage.inl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ __host__ __device__
186186
return m_begin[n];
187187
} // end contiguous_storage::operator[]()
188188

189+
__thrust_exec_check_disable__
189190
template<typename T, typename Alloc>
190191
__host__ __device__
191192
typename contiguous_storage<T,Alloc>::allocator_type
@@ -340,6 +341,7 @@ __host__ __device__
340341
destroy_on_allocator_mismatch_dispatch(c, other, first, last);
341342
} // end contiguous_storage::destroy_on_allocator_mismatch
342343

344+
__thrust_exec_check_disable__
343345
template<typename T, typename Alloc>
344346
__host__ __device__
345347
void contiguous_storage<T,Alloc>
@@ -448,6 +450,7 @@ __host__ __device__
448450
return false;
449451
} // end contiguous_storage::is_allocator_not_equal_dispatch()
450452

453+
__thrust_exec_check_disable__
451454
template<typename T, typename Alloc>
452455
__host__ __device__
453456
bool contiguous_storage<T,Alloc>
@@ -456,6 +459,7 @@ __host__ __device__
456459
return m_allocator != other;
457460
} // end contiguous_storage::is_allocator_not_equal_dispatch()
458461

462+
__thrust_exec_check_disable__
459463
template<typename T, typename Alloc>
460464
__host__ __device__
461465
void contiguous_storage<T,Alloc>
@@ -474,6 +478,7 @@ __host__ __device__
474478
{
475479
} // end contiguous_storage::deallocate_on_allocator_mismatch()
476480

481+
__thrust_exec_check_disable__
477482
template<typename T, typename Alloc>
478483
__host__ __device__
479484
void contiguous_storage<T,Alloc>
@@ -494,6 +499,7 @@ __host__ __device__
494499
{
495500
} // end contiguous_storage::destroy_on_allocator_mismatch()
496501

502+
__thrust_exec_check_disable__
497503
template<typename T, typename Alloc>
498504
__host__ __device__
499505
void contiguous_storage<T,Alloc>
@@ -510,6 +516,7 @@ __host__ __device__
510516
} // end contiguous_storage::propagate_allocator()
511517

512518
#if __cplusplus >= 201103L
519+
__thrust_exec_check_disable__
513520
template<typename T, typename Alloc>
514521
__host__ __device__
515522
void contiguous_storage<T,Alloc>

thrust/device_vector.h

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -68,29 +68,25 @@ template<typename T, typename Alloc = thrust::device_allocator<T> >
6868

6969
/*! This constructor creates an empty \p device_vector.
7070
*/
71-
__host__
7271
device_vector(void)
7372
:Parent() {}
7473

7574
/*! This constructor creates an empty \p device_vector.
7675
* \param alloc The allocator to use by this device_vector.
7776
*/
78-
__host__
7977
device_vector(const Alloc &alloc)
8078
:Parent(alloc) {}
8179

8280
/*! The destructor erases the elements.
8381
*/
8482
// Define an empty destructor to explicitly specify
8583
// its execution space qualifier, as a workaround for nvcc warning
86-
__host__
8784
~device_vector(void) {}
8885

8986
/*! This constructor creates a \p device_vector with the given
9087
* size.
9188
* \param n The number of elements to initially create.
9289
*/
93-
__host__
9490
explicit device_vector(size_type n)
9591
:Parent(n) {}
9692

@@ -99,7 +95,6 @@ template<typename T, typename Alloc = thrust::device_allocator<T> >
9995
* \param n The number of elements to initially create.
10096
* \param alloc The allocator to use by this device_vector.
10197
*/
102-
__host__
10398
explicit device_vector(size_type n, const Alloc &alloc)
10499
:Parent(n,alloc) {}
105100

@@ -108,7 +103,6 @@ template<typename T, typename Alloc = thrust::device_allocator<T> >
108103
* \param n The number of elements to initially create.
109104
* \param value An element to copy.
110105
*/
111-
__host__
112106
explicit device_vector(size_type n, const value_type &value)
113107
:Parent(n,value) {}
114108

@@ -118,54 +112,47 @@ template<typename T, typename Alloc = thrust::device_allocator<T> >
118112
* \param value An element to copy.
119113
* \param alloc The allocator to use by this device_vector.
120114
*/
121-
__host__
122115
explicit device_vector(size_type n, const value_type &value, const Alloc &alloc)
123116
:Parent(n,value,alloc) {}
124117

125118
/*! Copy constructor copies from an exemplar \p device_vector.
126119
* \param v The \p device_vector to copy.
127120
*/
128-
__host__
129121
device_vector(const device_vector &v)
130122
:Parent(v) {}
131123

132124
/*! Copy constructor copies from an exemplar \p device_vector.
133125
* \param v The \p device_vector to copy.
134126
* \param alloc The allocator to use by this device_vector.
135127
*/
136-
__host__
137128
device_vector(const device_vector &v, const Alloc &alloc)
138129
:Parent(v,alloc) {}
139130

140131
#if THRUST_CPP_DIALECT >= 2011
141132
/*! Move constructor moves from another \p device_vector.
142133
* \param v The device_vector to move.
143134
*/
144-
__host__
145135
device_vector(device_vector &&v)
146136
:Parent(std::move(v)) {}
147137

148138
/*! Move constructor moves from another \p device_vector.
149139
* \param v The device_vector to move.
150140
* \param alloc The allocator to use by this device_vector.
151141
*/
152-
__host__
153142
device_vector(device_vector &&v, const Alloc &alloc)
154143
:Parent(std::move(v), alloc) {}
155144
#endif // THRUST_CPP_DIALECT >= 2011
156145

157146
/*! Copy assign operator copies another \p device_vector with the same type.
158147
* \param v The \p device_vector to copy.
159148
*/
160-
__host__
161149
device_vector &operator=(const device_vector &v)
162150
{ Parent::operator=(v); return *this; }
163151

164152
#if THRUST_CPP_DIALECT >= 2011
165153
/*! Move assign operator moves from another \p device_vector.
166154
* \param v The device_vector to move.
167155
*/
168-
__host__
169156
device_vector &operator=(device_vector &&v)
170157
{ Parent::operator=(std::move(v)); return *this; }
171158
#endif // THRUST_CPP_DIALECT >= 2011
@@ -174,47 +161,40 @@ template<typename T, typename Alloc = thrust::device_allocator<T> >
174161
* \param v The \p device_vector to copy.
175162
*/
176163
template<typename OtherT, typename OtherAlloc>
177-
__host__ explicit
178-
__device__
179-
device_vector(const device_vector<OtherT,OtherAlloc> &v)
164+
explicit device_vector(const device_vector<OtherT,OtherAlloc> &v)
180165
:Parent(v) {}
181166

182167
/*! Assign operator copies from an exemplar \p device_vector with different type.
183168
* \param v The \p device_vector to copy.
184169
*/
185170
template<typename OtherT, typename OtherAlloc>
186-
__host__
187171
device_vector &operator=(const device_vector<OtherT,OtherAlloc> &v)
188172
{ Parent::operator=(v); return *this; }
189173

190174
/*! Copy constructor copies from an exemplar \c std::vector.
191175
* \param v The <tt>std::vector</tt> to copy.
192176
*/
193177
template<typename OtherT, typename OtherAlloc>
194-
__host__
195178
device_vector(const std::vector<OtherT,OtherAlloc> &v)
196179
:Parent(v) {}
197180

198181
/*! Assign operator copies from an exemplar <tt>std::vector</tt>.
199182
* \param v The <tt>std::vector</tt> to copy.
200183
*/
201184
template<typename OtherT, typename OtherAlloc>
202-
__host__
203185
device_vector &operator=(const std::vector<OtherT,OtherAlloc> &v)
204186
{ Parent::operator=(v); return *this;}
205187

206188
/*! Copy constructor copies from an exemplar \p host_vector with possibly different type.
207189
* \param v The \p host_vector to copy.
208190
*/
209191
template<typename OtherT, typename OtherAlloc>
210-
__host__
211192
device_vector(const host_vector<OtherT,OtherAlloc> &v);
212193

213194
/*! Assign operator copies from an examplar \p host_vector.
214195
* \param v The \p host_vector to copy.
215196
*/
216197
template<typename OtherT, typename OtherAlloc>
217-
__host__
218198
device_vector &operator=(const host_vector<OtherT,OtherAlloc> &v)
219199
{ Parent::operator=(v); return *this; }
220200

@@ -223,7 +203,6 @@ template<typename T, typename Alloc = thrust::device_allocator<T> >
223203
* \param last The end of the range.
224204
*/
225205
template<typename InputIterator>
226-
__host__
227206
device_vector(InputIterator first, InputIterator last)
228207
:Parent(first,last) {}
229208

@@ -233,7 +212,6 @@ template<typename T, typename Alloc = thrust::device_allocator<T> >
233212
* \param alloc The allocator to use by this device_vector.
234213
*/
235214
template<typename InputIterator>
236-
__host__
237215
device_vector(InputIterator first, InputIterator last, const Alloc &alloc)
238216
:Parent(first,last,alloc) {}
239217

0 commit comments

Comments
 (0)