This problem prevents me from using thread pinning. I wonder how Julia threads (implemented on top of pthreads, IIUC), mess with OpenMP threads?
OpenMP and Julia both pthreads. So ThreadPinning.jl may not account for the OpenMP threads and it is not guaranteed what the mapping of pthreads to OpenMP threads is.
I appreciate that both Julia and OpenMP may use pthreads. This still does not explain why pinning some threads would make it impossible for an OpenMP code to run in parallel. There are definitely many threads left unspoken for. For instance, I run this on a machine with 64 hardware threads, and I start Julia with four threads. Yet, the OpenMP code does not achieve any speedup when I initially pin the threads. If I don’t pin the threads, the OpenMP code reports speedups as expected.