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

How to assign a different GPU? #60

Open
TangYiChing opened this issue Nov 14, 2023 · 1 comment
Open

How to assign a different GPU? #60

TangYiChing opened this issue Nov 14, 2023 · 1 comment

Comments

@TangYiChing
Copy link

Hi,

Due to the GPU-Out-Of-Memory problem, I have to change the default "cuda:0" to another empty GPU,
Here's what I did to set the GPU device by changing cuda:0 to cuda:1:

vim igfold/IgFoldRunner.py 

device = torch.device(
"cuda:0" if torch.cuda.is_available() and try_gpu else "cpu")  
print(f"Using device: {device}")

However, I got this error:
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:1 and cuda:0! (when checking argument for argument index in method wrapper_CUDA__index_select)

Can you tell me how to assign a GPU appropriately?
Thank you.

@aozalevsky
Copy link

@TangYiChing the easy hotfix is to:

  1. change the line

https://github.com/Graylab/IgFold/blob/85d9dcdbc7afb9c38c4427df656fc194a61bd6ee/igfold/IgFoldRunner.py#L61C35-L61C35

from cuda:1 to just cuda

  1. select just one cuda device with a few additional lines:
import os
os.enivron["CUDA_VISIBLE_DEVICES"]="0"

Here is an explanation of how this variable works.

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

No branches or pull requests

2 participants