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

Cannot select the GPU index #22

Closed
v-iashin opened this issue May 19, 2019 · 1 comment
Closed

Cannot select the GPU index #22

v-iashin opened this issue May 19, 2019 · 1 comment

Comments

@v-iashin
Copy link

Hi.

It seems that I cannot make the code to run on another GPU rather than 0-th. The following line doesn't make any difference in my case

torch.cuda.device(1) # change this if you have a multiple graphics cards and you want to utilize them

I managed to solve it by introducing the device variable instead and adding torch.cuda.set_device(device) right after the FunctionCorrelation signature

def FunctionCorrelation(tensorFirst, tensorSecond):
return _FunctionCorrelation.apply(tensorFirst, tensorSecond)

and also passing this variable as an argument here
tensorVolume = torch.nn.functional.leaky_relu(input=correlation.FunctionCorrelation(tensorFirst=tensorFirst, tensorSecond=tensorSecond), negative_slope=0.1, inplace=False)

and here
tensorVolume = torch.nn.functional.leaky_relu(input=correlation.FunctionCorrelation(tensorFirst=tensorFirst, tensorSecond=Backward(tensorInput=tensorSecond, tensorFlow=tensorFlow * self.dblBackward)), negative_slope=0.1, inplace=False)

If this is a bug do you want me to form a Pull Request?

Anyway, thanks a lot for sharing the code. It is really helpful when the official version is on CUDA 8 and PyTorch 0.2!

@sniklaus
Copy link
Owner

You are correct, it should be set_device instead of just device. Thank you for letting me know! No need to issue a pull request, I just updated it and removed that line altogether. It is usually better to set CUDA_VISIBLE_DEVICES and I only had this line to avoid issues with multi-GPU systems.

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