JuliaMath / IntelVectorMath.jl

Julia bindings for the Intel Vector Math Library
Other
73 stars 18 forks source link

Change the amout of threads used for a computation #50

Open David-Berghaus opened 3 years ago

David-Berghaus commented 3 years ago

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.

Crown421 commented 3 years ago

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.

David-Berghaus commented 3 years ago

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

David-Berghaus commented 3 years ago

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

mcabbott commented 3 years ago

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.