Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CNMeM support #11

Closed

Conversation

slayton58
Copy link

Add support for the CNMeM memory pool by abstracting out cudaMalloc and cudaFree operations into calls to the singleton (Caffe::mallocGPU and Caffe::freeGPU). Memory pools are lazily initialized on first allocation.

Notes:

  • Currently takes 90% of available GPU memory at memory pool initialization - this value can be tweaked
  • Serializes backwards convolution calls to simplify memory management - instead of running all groups in parallel and bgrad, dgrad and wgrad in parallel within each group (all using streams), now uses a single stream. This allows all remaining memory in the pool to be used for any given convolution instead of sharing. This is easy to change back if desired.
  • Enable using Caffe::set_memory_pool(true, gpus); call (gpus is of type std::vector), currently only enabled in the main caffe executable
  • Currently tests do not use the memory pool (they could be added for tests that use GPUDeviceTest)

@lukeyeager
Copy link
Member

Added to the caffe-0.13 branch in version v0.13.1
https://github.com/NVIDIA/caffe/commits/v0.13.1

@lukeyeager lukeyeager closed this Aug 10, 2015
pooyadavoodi pushed a commit to pooyadavoodi/caffe that referenced this pull request Jul 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants