From d5323362396cadc8a7ae528374bbd70f52b72b82 Mon Sep 17 00:00:00 2001 From: Chip-Kerchner Date: Mon, 11 Jan 2021 14:38:40 +0000 Subject: [PATCH] Ensure CUDA vector length is consistent with AlignedSize --- include/LightGBM/cuda/vector_cudahost.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/LightGBM/cuda/vector_cudahost.h b/include/LightGBM/cuda/vector_cudahost.h index 03db3386d4c7..bd488d793d09 100644 --- a/include/LightGBM/cuda/vector_cudahost.h +++ b/include/LightGBM/cuda/vector_cudahost.h @@ -42,6 +42,7 @@ struct CHAllocator { T* allocate(std::size_t n) { T* ptr; if (n == 0) return NULL; + n = (n + kAlignedSize - 1) & -kAlignedSize; #ifdef USE_CUDA if (LGBM_config_::current_device == lgbm_device_cuda) { cudaError_t ret = cudaHostAlloc(&ptr, n*sizeof(T), cudaHostAllocPortable);