Fixed the bug with illegal memory access in test_large_sizes.py with 4 GPUs. (#3068)
- thrust::copy() called from dvec::copy() for gpairs invoked a GPU kernel instead of cudaMemcpy() - this resulted in illegal memory access if the GPU running the kernel could not access the data being copied - new version of dvec::copy() for thrust::device_ptr iterators calls cudaMemcpy(), avoiding the problem.
This commit is contained in:
parent
98be9aef9a
commit
24c2e41287
@ -369,6 +369,16 @@ class dvec {
|
||||
}
|
||||
thrust::copy(begin, end, this->tbegin());
|
||||
}
|
||||
|
||||
void copy(thrust::device_ptr<T> begin, thrust::device_ptr<T> end) {
|
||||
safe_cuda(cudaSetDevice(this->device_idx()));
|
||||
if (end - begin != size()) {
|
||||
throw std::runtime_error(
|
||||
"Cannot copy assign vector to dvec, sizes are different");
|
||||
}
|
||||
safe_cuda(cudaMemcpy(this->data(), begin.get(),
|
||||
size() * sizeof(T), cudaMemcpyDefault));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user