I was wondering whether there is a way to set the thread affinity (i.e. how threads bind to physical cores) when using Numba and prange.
For instance, let us assume that I am running an application which is parallelized with MPI, and then with prange for each MPI rank, and that I have access to, say, a compute node with 2 NUMA domains and 12 cores in each NUMA domains.
In that case, one reasonable choice would be to have 2 MPI ranks running 12 threads each, whereby each MPI rank runs on a different NUMA domain (I believe there are options in mpirun to do this), and whereby each thread runs on the same NUMA domain as the MPI rank that created them.
In OpenMP, setting this type of thread affinity is possible through environment variables:
export OMP_NUM_THREADS=12
export OMP_PLACES=cores
export OMP_PROC_BIND=close
(see e.g.
http://pages.tacc.utexas.edu/~eijkhout/pcse/html/omp-affinity.html)
Are there similar similar options in Numba, when using prange?
(I know only about `export NUMBA_NUM_THREADS=12`, but that does not control thread affinity.)
Thanks!