Git Product home page Git Product logo

Comments (7)

benjamindkilleen avatar benjamindkilleen commented on May 26, 2024 1

Yeah, I am continuing to have issues getting torch and pycuda to play nicely together. The easiest solution so far, if you have the resources for it, is to cordon them off from one another using two GPUs. PyCUDA will by default grab GPU 0, and you can specify `model.to("cuda:1") to tell PyTorch to use the other device. If anyone has better solutions, I'd love to incorporate them.

from deepdrr.

benjamindkilleen avatar benjamindkilleen commented on May 26, 2024 1

Adding this summary:

  • Use import pycuda.autoprimaryctx instead of import pycuda.autoinit, as this uses the existing context. This change has been made in the most recent DeepDRR releases.
  • If possible, give PyCuda its own GPU device. By default it will take device 0. You can change the "virtual order" with CUDA_VISIBLE_DEVICES=1,0. The PyTorch model can be directed to a particular device with model.to(torch.device("cuda:1")), for example.
  • If not possible, try allocating pytorch tensors, including the model with all backprop, before initializing a DeepDRR projector.
  • Consider this related thread on this issue.

from deepdrr.

benjamindkilleen avatar benjamindkilleen commented on May 26, 2024

Running pycuda (which deepdrr depends on) and pytorch at the same time is tricky, as these libraries don't play nicely with one another. If it is feasible, it is usually easier to save images offline for later training.

from deepdrr.

antal-huck avatar antal-huck commented on May 26, 2024

Yes, this is feasible, but it would also be cool to generate training data on the fly.
I receive the same error with the snipped at https://github.com/arcadelab/deepdrr#using-deepdrr-simultaneously-with-pytorch.
So my question is: With which setup did this snipped work?

from deepdrr.

antal-huck avatar antal-huck commented on May 26, 2024

Turns out I cannot import for example Volume from deepdrr or Point3D from deepdrr.geo. Such imports already lead to the error from above.
I would heavily need to refactor my project code to separate deepdrr from the dataset.

from deepdrr.

antal-huck avatar antal-huck commented on May 26, 2024
  • pycuda==2018.1.1 seems to work together with torch==1.7.1
  • needed to downgrade from torch==1.11.0 to 1.7.1, other combinations did not work
  • didn't manage to get pycuda==2021.1 to work with newer versions of torch

from deepdrr.

benjamindkilleen avatar benjamindkilleen commented on May 26, 2024

Closing this issue, as the dev branch has now dropped Pycuda in favor of Cupy across DeepDRR.

from deepdrr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.