Unverified Commit 5784ffe7 authored by Chip Kerchner's avatar Chip Kerchner Committed by GitHub
Browse files

Ensure CUDA vector length is consistent with AlignedSize (#3748)

parent 1abc2e06
...@@ -42,6 +42,7 @@ struct CHAllocator { ...@@ -42,6 +42,7 @@ struct CHAllocator {
T* allocate(std::size_t n) { T* allocate(std::size_t n) {
T* ptr; T* ptr;
if (n == 0) return NULL; if (n == 0) return NULL;
n = (n + kAlignedSize - 1) & -kAlignedSize;
#ifdef USE_CUDA #ifdef USE_CUDA
if (LGBM_config_::current_device == lgbm_device_cuda) { if (LGBM_config_::current_device == lgbm_device_cuda) {
cudaError_t ret = cudaHostAlloc(&ptr, n*sizeof(T), cudaHostAllocPortable); cudaError_t ret = cudaHostAlloc(&ptr, n*sizeof(T), cudaHostAllocPortable);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment