Skip to content

Update functional.py #6

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

conti3000
Copy link

Green function and laplacion send to same device in case of using a cuda device

Green function and laplacion send to same device
@matt-baugh
Copy link
Owner

matt-baugh commented Jan 29, 2024

Thank you for your interest in this project!

I agree that this needs to be fixed (otherwise it won't run on GPU probably) but I don't think this is the way to do it.
Although this would temporarily patch the error, I think we can fix it properly:

  • Currently if green_function is passed in from the outside and it's on the wrong device, this would silently move it when we probably want to notify the user of the problem (as it could be a result of a bug somewhere else in their code).
    • Related, we should probably check the devices of all tensors at the start and give a nice error message if any mismatch
  • It would be nicer to directly create green_function on the GPU, which we could do by passing a device parameter to the helper functions which do that.

If you are already thinking about these sort of things you can edit this pull request to improve it further if you'd like, otherwise I will reject this one and add the above changes myself

@matt-baugh matt-baugh self-requested a review January 29, 2024 10:48
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