Skip to content

Instantly share code, notes, and snippets.

@rlan
Created July 5, 2018 07:38
Show Gist options
  • Select an option

  • Save rlan/61f0170298e9cb0bbd8ea208c6f1e7e4 to your computer and use it in GitHub Desktop.

Select an option

Save rlan/61f0170298e9cb0bbd8ea208c6f1e7e4 to your computer and use it in GitHub Desktop.
GPU selection in Jupyter

You can do it faster without any imports just by using magics:

%env CUDA_DEVICE_ORDER=PCI_BUS_ID
%env CUDA_VISIBLE_DEVICES=0

Notice that all env variable are strings, so no need to use ". You can verify that env-variable is set up by running: %env <name_of_var>. Or check all of them with %env.

https://stackoverflow.com/a/43732683/1704566

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment