1
1
/* !
2
- * Copyright 2017 XGBoost contributors
2
+ * Copyright 2017-2019 XGBoost contributors
3
3
*/
4
4
#pragma once
5
5
#include < thrust/device_ptr.h>
@@ -183,11 +183,6 @@ __device__ void BlockFill(IterT begin, size_t n, ValueT value) {
183
183
* Kernel launcher
184
184
*/
185
185
186
- template <typename T1, typename T2>
187
- T1 DivRoundUp (const T1 a, const T2 b) {
188
- return static_cast <T1>(ceil (static_cast <double >(a) / b));
189
- }
190
-
191
186
template <typename L>
192
187
__global__ void LaunchNKernel (size_t begin, size_t end, L lambda) {
193
188
for (auto i : GridStrideRange (begin, end)) {
@@ -211,7 +206,7 @@ inline void LaunchN(int device_idx, size_t n, cudaStream_t stream, L lambda) {
211
206
safe_cuda (cudaSetDevice (device_idx));
212
207
213
208
const int GRID_SIZE =
214
- static_cast <int >(DivRoundUp (n, ITEMS_PER_THREAD * BLOCK_THREADS));
209
+ static_cast <int >(xgboost::common:: DivRoundUp (n, ITEMS_PER_THREAD * BLOCK_THREADS));
215
210
LaunchNKernel<<<GRID_SIZE, BLOCK_THREADS, 0 , stream>>> (static_cast <size_t >(0 ),
216
211
n, lambda);
217
212
}
@@ -619,7 +614,7 @@ struct CubMemory {
619
614
if (this ->IsAllocated ()) {
620
615
XGBDeviceAllocator<uint8_t > allocator;
621
616
allocator.deallocate (thrust::device_ptr<uint8_t >(static_cast <uint8_t *>(d_temp_storage)),
622
- temp_storage_bytes);
617
+ temp_storage_bytes);
623
618
d_temp_storage = nullptr ;
624
619
temp_storage_bytes = 0 ;
625
620
}
@@ -738,7 +733,7 @@ void SparseTransformLbs(int device_idx, dh::CubMemory *temp_memory,
738
733
const int BLOCK_THREADS = 256 ;
739
734
const int ITEMS_PER_THREAD = 1 ;
740
735
const int TILE_SIZE = BLOCK_THREADS * ITEMS_PER_THREAD;
741
- auto num_tiles = dh ::DivRoundUp (count + num_segments, BLOCK_THREADS);
736
+ auto num_tiles = xgboost::common ::DivRoundUp (count + num_segments, BLOCK_THREADS);
742
737
CHECK (num_tiles < std::numeric_limits<unsigned int >::max ());
743
738
744
739
temp_memory->LazyAllocate (sizeof (CoordinateT) * (num_tiles + 1 ));
@@ -1158,7 +1153,7 @@ class AllReducer {
1158
1153
};
1159
1154
1160
1155
/* *
1161
- * \brief Synchronizes the device
1156
+ * \brief Synchronizes the device
1162
1157
*
1163
1158
* \param device_id Identifier for the device.
1164
1159
*/
0 commit comments