Open pylaterreur opened 3 years ago
Hi,
According to the reply in this thread, setting the environment variable MKL_NUM_THREADS
should prevent the MKL to overwrite the thread affinity mask. Could you confirm that it works for you?
Hi, I've tried that, it didn't work.
LD_PRELOAD to intercept calls to getenv() led to have these vars read:
getenv:MKL_CBWR=nullptr
getenv:MKL_DEBUG_CPU_TYPE=nullptr
getenv:MKL_ENABLE_INSTRUCTIONS=nullptr
getenv:MKL_DISABLE_FAST_MM=nullptr
getenv:MKL_FAST_MEMORY_LIMIT=nullptr
getenv:MKL_NUM_THREADS=nullptr
getenv:MKL_NUM_STRIPES=nullptr
getenv:MKL_DOMAIN_NUM_THREADS=nullptr
getenv:MKL_DYNAMIC=nullptr
getenv:OMP_NUM_THREADS=nullptr
getenv:MKL_MPI_PPN=nullptr
getenv:I_MPI_NUMBER_OF_MPI_PROCESSES_PER_NODE=nullptr
getenv:I_MPI_PIN_MAPPING=nullptr
getenv:OMPI_COMM_WORLD_LOCAL_SIZE=nullptr
getenv:MPI_LOCALNRANKS=nullptr
getenv:I_MPI_THREAD_LEVEL=nullptr
I've tried a few variations of setting these env vars but no luck.
Hi,
tl;dr: affinity goes from a mask 4 (that I've set myself) to a mask 20000 (that xtensor/mkl set down the line). I believe it is not a desirable behavior :) .
This is on GNU/Linux. Running inside a thread that has been pinned to a CPU with a taskset mask = 4. It then runs into some xtensor code (stack trace below, printed on a gdb
catch syscall sched_setaffinity
). A few of these later, my thread has an affinity mask of 20000.Is there a way to tell xtensor to ensure MKL / (or other backend?) to not change cpu affinities? If not, in my current setup, what can I do to leave the affinity as it is?
Cheers!