JuliaMath/IntelVectorMath.jl

Change the amout of threads used for a computation

Opened this issue · 4 comments

It seems like IVM is using all threads available on a machine per default. When sharing resources on a cluster with multiple users this is not something that you want, because different jobs would have to fight for the same cores.

Is there a way to change this behavior? The amount of threads used does not seem to be related to julia-multithreading or blas.

This is a very good point, I had not noticed this yet. I will run a few tests to see of something can be done by setting environment flags.

I expect that there will be differences between OSs, but I think Linux is probably the most pressing under the circumstances you describe.

Yes, indeed, our cluster is running Linux (and probably most clusters too, although I often get surprised how many windows-clusters exist).

I think I found the env-var that determines the amount of threads used: https://stackoverflow.com/a/60298394

Maybe you want to add this wrapper to the package

I think these are the same functions as BLAS.set_num_threads(n) will call, if BLAS.vendor() is MKL. For get_num_threads you need Julia 1.6 or Compat.jl.