Skip to content

Fix #153: Allow CPU fallback in forward_projection and add_noise - #189

Open
Paramveersingh-S wants to merge 1 commit into
CambridgeCIA:mainfrom
Paramveersingh-S:fix/lion-issue-153
Open

Fix #153: Allow CPU fallback in forward_projection and add_noise#189
Paramveersingh-S wants to merge 1 commit into
CambridgeCIA:mainfrom
Paramveersingh-S:fix/lion-issue-153

Conversation

@Paramveersingh-S

Copy link
Copy Markdown
Contributor

This PR replaces the hardcoded usage of torch.cuda.current_device() in forward_projection and _sinogram_add_noise with a dynamic device check (torch.device("cuda" if torch.cuda.is_available() else "cpu")). In addition, proj.cuda(dev) was refactored to use .to(dev) to prevent runtime crashes when running on a CPU-only host for local prototyping.

@AnderBiguri

Copy link
Copy Markdown
Member

Im not sure if your AI agent got confused here, as I think this breaks a feature: selecting the current device. Users may have chosen a specific device, if we set it to just cuda, pythorch may chose a different one. This is bad for shared computers or when the user has specifically chosen one gpu

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.

2 participants