ComputationalRadiationPhysics / redGrapes

Resource-based, Declarative task-Graphs for Parallel, Event-driven Scheduling :grapes:

Home Page:https://redgrapes.rtfd.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set affinity for worker threads

michaelsippel opened this issue · comments

I would be interested in this for adding redGrapes to applications that use OpenGL, where the OpenGL calls must always be executed in the same thread.

I would be interested in this for adding redGrapes to applications that use OpenGL, where the OpenGL calls must always be executed in the same thread.

@russellsch Is there a requirement for your case that the thread where OpenGL is executed is pinned to a core or a group of cores or is the requirement that all OpenGL calls were executed from the same thread?

For one of our codes where @michaelsippel is working on a prototype for integration of redGrapes we have for CUDA the requirement that all CUDA calls were executed from the same thread. @michaelsippel could you point to an example or code!

While I'm certainly no expert, I believe my use case of OpenGL is very similar to the CUDA use case (executing in same thread), @michaelsippel any examples would be much appreciated!

Hi @russellsch ,
I strongly suspect that you want certain OpenGL operations on the same (OS-) thread, not necessarily the same physical core.
(which is what this issue is about, pinning worker threads to physical cores)
This is already possible with RedGrapes, you can look at the MPI example. There we create a separate scheduler that handles all tasks tagged with SCHED_MPI. They are executed by the main-thread through the idle-functor (L82) whenever the mainthread waits for a task result.
You can do something similar for OpenGL tasks. Maybe you even want to create a separate worker thread for OpenGL tasks. Write me if you need any help with how to use RedGrapes in your application :)