carstenbauer / ThreadPinning.jl

Readily pin Julia threads to CPU-threads
https://carstenbauer.github.io/ThreadPinning.jl/
MIT License
106 stars 7 forks source link

Make `pinthreads` and co no-ops on Windows/macOS #79

Closed carstenbauer closed 1 year ago

carstenbauer commented 1 year ago

I decided to display a warning on using ThreadPinning on Windows and macOS as not informing the user at all that the package isn't going to work on these OSs doesn't seem right. The warning can be disabled by setting the preference os_warning=false. A helper function for this is ThreadPinning.Prefs.set_os_warning(false).

After using ThreadPinning, pinthreads and co will be no-ops (i.e. not show a warning!) on Windows and macOS.

As a package author that wants to specify a default pinning in a package, you can of course always load ThreadPinning conditionally if you don't like the warning, i.e. for example:

@static if Sys.islinux()
    using ThreadPinning
    pinthreads(:numa)
end

(cc @oschulz)

Closes #78