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

Non-destructive multi-gpu defaults #99

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

JBlaschke
Copy link
Contributor

@JBlaschke JBlaschke commented Feb 9, 2021

As it stands now, the way we are setting (and restoring) the gpu device id, we are always clobbering any local device contexts with the primary context. This is because cudaSetDevice will always make the primary context active. This PR is a way to avoid this. I propose we set a hierarchy of defaults:

  1. if a context is already current to the device, use that -- this can save a substantial amount of resources, and make interoperability with PyCUDA easier
  2. if the user wants to force the primary context, let them by setting opts.gpu_force_primary_ctx = 1
  3. if no context is currently bound to the device, use the primary context

TODO

  1. Detect currently active contexts and implement 1-3
  2. Finish implementing multi-gpu context policy on external functions: makeplan, setpoints and memory-management functions
  3. Test new implementation
  4. Document
  5. Update python example

@JBlaschke JBlaschke marked this pull request as draft February 9, 2021 06:40
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.

1 participant