Comments (7)
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.
Adding this summary:
- Use
import pycuda.autoprimaryctx
instead ofimport 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 withmodel.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.
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.
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.
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.
- 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.
Closing this issue, as the dev
branch has now dropped Pycuda in favor of Cupy across DeepDRR.
from deepdrr.
Related Issues (20)
- [Question]About parallel beam and cone beam HOT 1
- mapping 3D points to 2D points
- mapping 2Dpoint to 3Dpoint HOT 3
- Projection Matrix HOT 1
- FLIP AXIS HOT 5
- How to implement STL to DCM transformation in deepdrr HOT 1
- How to set up a simulation of an orthogonal projection? HOT 1
- Isocenter / origin question HOT 1
- Given extrinsic matrix and intrinsic matrix HOT 10
- Zooming out on the DRR HOT 1
- Error when trying out the main branch HOT 7
- `TypeError` always raised when calling `Volume.from_dicom` without a cache_path
- Where does the formula for HU to density come from? HOT 1
- gpu utilization and performances HOT 5
- DRR is white. HOT 7
- cuMemcpyHtoD failed! HOT 6
- Error when compiling kernel (using the example python script) HOT 3
- Dead link to test data (used in Jupyter notebook)
- DEEPDRR Achieve gradient projection HOT 1
- Unexpected DRR orientation HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepdrr.