larroy commented on a change in pull request #12804: CudnnFind() usage
improvements
URL: https://github.com/apache/incubator-mxnet/pull/12804#discussion_r228171789
##########
File path: src/storage/pooled_storage_manager.h
##########
@@ -80,20 +81,39 @@ class GPUPooledStorageManager final : public
StorageManager {
private:
void DirectFreeNoLock(Storage::Handle handle) {
cudaError_t err = cudaFree(handle.dptr);
- size_t size = std::max(handle.size, page_size_);
+ size_t size = RoundAllocSize(handle.size);
// ignore unloading error, as memory has already been recycled
if (err != cudaSuccess && err != cudaErrorCudartUnloading) {
LOG(FATAL) << "CUDA: " << cudaGetErrorString(err);
}
used_memory_ -= size;
}
+ // Round a value 'x' up to the next multiple of 'multiple'
+ size_t RoundToMultiple(size_t x, size_t multiple) {
+ size_t retVal = ((x + multiple - 1) / multiple) * multiple;
Review comment:
Shall we assert that multiple is > 0? otherwise we could underflow on -1 as
it's a user set parameter.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services