Using CUDA backend of Enoki in a multithreaded environment
Microno95 opened this issue · comments
I attempted writing some code (specifically mitsuba rendering code) that parallelizes the task of queueing GPU rendering operations across multiple CPUs since the current implementation is single-threaded and thus CPU-bound (main for-loop runs on the CPU and thus leads to lower GPU utilisation).
From what I can tell, this leads to issues in the JIT compilation phase (specifically enqueueing computations in a given context) since the containers used to track tasks are not thread-safe.
I had two questions about this:
- Is this an intended use case that is a sensible way of utilising the enoki library?
- Will the upcoming refactoring of Enoki-JIT enable such a use case?
Hi @Microno95 ,
Indeed, the JIT compiler of the current version of enoki isn't thread safe. Our full rewrite of enoki/enoki-jit and refactoring of Mitsuba 2 will adress this issue so I would recommend you wait until the next release.