carstenbauer / ThreadPinning.jl

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

Question: Recommended way to add to package that could run on Windows #92

Closed ejmeitz closed 2 months ago

ejmeitz commented 7 months ago

Is there a recommended way to only load and pin threads if my package is loaded by someone using Linux? e.g. If my package is loaded on Windows nothing bad should happen.

carstenbauer commented 7 months ago

Hi @ejmeitz, there shouldn't be anything you need to do. That is, by default, nothing bad should happen on Windows 😉

On Windows:

using ThreadPinning # will throw a informative warning, see https://github.com/carstenbauer/ThreadPinning.jl/blob/599835342ce509d6fd35a17d4b49cedfa0c6ccd8/src/ThreadPinning.jl#L93-L95
pinthreads(:cores) # will be a no-op

If you observe something different, or have any suggestions on how it should behave differently, please let me know.