Comments (4)
Thanks for the suggestion!
Some people suggested me to use JAX, cupy, pytorch etc instead of numpy to speed up calculations with a GPU. I tested using GPU backend pytorch tensors, but the main problem I see is that although it runs faster for single calls, for multiple calls kills the performance due the function call overhead.
I read that JAX can compile several functions using a jit compiler, so it is likely that some parts can be optimized. But the main problem I'm going to face is that my source code has a lot recursion and branching because it's made to be as readable as possible. But definitely when I have time I have to give it a try.
from python-raytracer.
But the main problem I'm going to face is that my source code has a lot recursion and branching
Yup, that makes sense.
from python-raytracer.
So this means that multiprocessing is also complicated to implement?
I've seen it done here: https://github.com/NMVHS/PyTracer
from python-raytracer.
So this means that multiprocessing is also complicated to implement?
Multiprocessing works on CPU cores so it doesn't have these GPU limitations. What happens it's that my raytracer already uses multiple cores because lot of Numpy methods uses multithreading so it cannot be made faster using multiprocessing.
About the PyTracer project I already have talked with the author and made some tests. It's also a cool project.
But a pure Python implementation with multiprocessing isn't faster than a Numpy implementation on an usual PC. (~4 cores)
The reason is because Python loops are very slow even running on multiple cores. So throwing the pixel loop to Numpy and make use of their multithreaded compiled methods is the best idea I've seen.
from python-raytracer.
Related Issues (10)
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 python-raytracer.