From e0169a3ebc12ebc33d83c0b7d606b64d7bb9a2d0 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Mon, 14 Jan 2019 13:28:30 +0100 Subject: [PATCH] Apply code checks reported in #25647 (#246) --- .../CUDAServices/src/CachingDeviceAllocator.h | 33 +++++++++---------- .../CUDAServices/src/CachingHostAllocator.h | 10 +++--- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/HeterogeneousCore/CUDAServices/src/CachingDeviceAllocator.h b/HeterogeneousCore/CUDAServices/src/CachingDeviceAllocator.h index 2dc2645a8d013..eb0b6686ef8d5 100644 --- a/HeterogeneousCore/CUDAServices/src/CachingDeviceAllocator.h +++ b/HeterogeneousCore/CUDAServices/src/CachingDeviceAllocator.h @@ -38,13 +38,12 @@ * thread-safe and capable of managing device allocations on multiple devices. ******************************************************************************/ -#include - -#include +#include #include +#include +#include #include -#include /// CUB namespace namespace notcub { @@ -139,18 +138,18 @@ struct CachingDeviceAllocator bytes(0), bin(INVALID_BIN), device(device), - associated_stream(0), - ready_event(0) + associated_stream(nullptr), + ready_event(nullptr) {} // Constructor (suitable for searching maps for a range of suitable blocks, given a device) BlockDescriptor(int device) : - d_ptr(NULL), + d_ptr(nullptr), bytes(0), bin(INVALID_BIN), device(device), - associated_stream(0), - ready_event(0) + associated_stream(nullptr), + ready_event(nullptr) {} // Comparison functor for comparing device pointers @@ -356,12 +355,12 @@ struct CachingDeviceAllocator * streams when all prior work submitted to \p active_stream has completed. */ cudaError_t DeviceAllocate( - int device, ///< [in] Device on which to place the allocation - void **d_ptr, ///< [out] Reference to pointer to the allocation - size_t bytes, ///< [in] Minimum number of bytes for the allocation - cudaStream_t active_stream = 0) ///< [in] The stream to be associated with this allocation + int device, ///< [in] Device on which to place the allocation + void **d_ptr, ///< [out] Reference to pointer to the allocation + size_t bytes, ///< [in] Minimum number of bytes for the allocation + cudaStream_t active_stream = nullptr) ///< [in] The stream to be associated with this allocation { - *d_ptr = NULL; + *d_ptr = nullptr; int entrypoint_device = INVALID_DEVICE_ORDINAL; cudaError_t error = cudaSuccess; @@ -529,9 +528,9 @@ struct CachingDeviceAllocator * streams when all prior work submitted to \p active_stream has completed. */ cudaError_t DeviceAllocate( - void **d_ptr, ///< [out] Reference to pointer to the allocation - size_t bytes, ///< [in] Minimum number of bytes for the allocation - cudaStream_t active_stream = 0) ///< [in] The stream to be associated with this allocation + void **d_ptr, ///< [out] Reference to pointer to the allocation + size_t bytes, ///< [in] Minimum number of bytes for the allocation + cudaStream_t active_stream = nullptr) ///< [in] The stream to be associated with this allocation { return DeviceAllocate(INVALID_DEVICE_ORDINAL, d_ptr, bytes, active_stream); } diff --git a/HeterogeneousCore/CUDAServices/src/CachingHostAllocator.h b/HeterogeneousCore/CUDAServices/src/CachingHostAllocator.h index abd12b1864c86..215e7be96a4d6 100644 --- a/HeterogeneousCore/CUDAServices/src/CachingHostAllocator.h +++ b/HeterogeneousCore/CUDAServices/src/CachingHostAllocator.h @@ -38,9 +38,9 @@ * thread-safe. ******************************************************************************/ -#include -#include #include +#include +#include #include #include @@ -343,9 +343,9 @@ struct CachingHostAllocator * Once freed, the allocation becomes available immediately for reuse. */ cudaError_t HostAllocate( - void **d_ptr, ///< [out] Reference to pointer to the allocation - size_t bytes, ///< [in] Minimum number of bytes for the allocation - cudaStream_t active_stream = nullptr) ///< [in] The stream to be associated with this allocation + void **d_ptr, ///< [out] Reference to pointer to the allocation + size_t bytes, ///< [in] Minimum number of bytes for the allocation + cudaStream_t active_stream = nullptr) ///< [in] The stream to be associated with this allocation { *d_ptr = nullptr; int device = INVALID_DEVICE_ORDINAL;