# \>64 HW threads under windows

**URL:** <https://discourse.julialang.org/t/64-hw-threads-under-windows/114124>\
**Category:** General Usage\
**Tags:** multithreading\
**Created:** [May 10, 2024, 9:44pm UTC](https://discourse.julialang.org/t/64-hw-threads-under-windows/114124 "2024-05-10T21:44:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Green](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chris_green/32/32265_2.png) [@Chris\_Green](https://discourse.julialang.org/u/Chris_Green)\
**Post date:** [May 10, 2024, 9:44pm UTC](https://discourse.julialang.org/t/64-hw-threads-under-windows/114124/1 "2024-05-10T21:44:07Z")

</div>

I haven’t checked in a while but has Julia fixed the problem with only using 1/2 or 1/4 of the available cpu threads on high-end (either \>64 HW threads or multi-socket) windows systems?

To be clear the issue isn’t with Julia but libuv. I fixed it myself a while back and sent them the fix but got a little frustrated with conforming to their formatting standard so didn’t follow up much after and kept it for my personal use. But now I’m thinking I should follow through unless it’s been fixed.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [May 11, 2024, 12:43am UTC](https://discourse.julialang.org/t/64-hw-threads-under-windows/114124/2 "2024-05-11T00:43:02Z")

</div>

I believe the issue isn’t libuv, but that windows doesn’t actually support more than 64 cores reasonably (but I’m not 100% usre). If you have that many cores you should be using Linux since it actually has proper schedulers and stuff IO system to work for big systems.

---

<div class="post-metadata">

**Author:** ![Chris\_Green](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chris_green/32/32265_2.png) [@Chris\_Green](https://discourse.julialang.org/u/Chris_Green)\
**Post date:** [May 11, 2024, 1:30am UTC](https://discourse.julialang.org/t/64-hw-threads-under-windows/114124/3 "2024-05-11T01:30:46Z")

</div>

No it supports 128 cores or more but you need a little tiny special codein your thread creation because of 64 bit thread masks. Ive fixed it in libuv and other libs plus my personal codebase. When i run with my modified libuv, i can max out any number of hw threads and get speedups past 64 threads (obviously its hard to get LINEAR speedups at that thread count :). Here’s an article i wrote about it with (slightly incomplete) sample code:

> **[Thread pools and Windows processor groups](https://chrisgreendevelopmentblog.wordpress.com/2017/08/29/thread-pools-and-windows-processor-groups/)**
>
> I needed to write a basic worker thread pool implementation. I needed a simple system that let me queue jobs, have those jobs executed by worker threads, and wait on job completion. I looked at a f…

---

<div class="post-metadata">

**Author:** ![Chris\_Green](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chris_green/32/32265_2.png) [@Chris\_Green](https://discourse.julialang.org/u/Chris_Green)\
**Post date:** [May 11, 2024, 1:33am UTC](https://discourse.julialang.org/t/64-hw-threads-under-windows/114124/4 "2024-05-11T01:33:55Z")

</div>

And heres the libuv fix: [Fix for win32 processor groups issue · libuv/libuv · Discussion #3457 · GitHub](https://github.com/libuv/libuv/discussions/3457)

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [May 11, 2024, 4:09am UTC](https://discourse.julialang.org/t/64-hw-threads-under-windows/114124/5 "2024-05-11T04:09:25Z")

</div>

I’m confused about why the code is stuffed into a Github discussion rather than as a pull request. It is very difficult to read and parse that way, especially since I would mostly be interested in the diff.

Note that there is a Julia fork of libuv:

> **[GitHub - JuliaLang/libuv: Cross-platform asynchronous I/O](https://github.com/JuliaLang/libuv)**
>
> Cross-platform asynchronous I/O. Contribute to JuliaLang/libuv development by creating an account on GitHub.

I’m aware of what you speak since I have a multisocket Windows machine at work. My usual solution is to run an individual Julia process for each socket, especially since I usually want to be explicit about memory transfers between NUMA nodes.

---

<div class="post-metadata">

**Author:** ![Chris\_Green](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chris_green/32/32265_2.png) [@Chris\_Green](https://discourse.julialang.org/u/Chris_Green)\
**Post date:** [May 11, 2024, 6:18am UTC](https://discourse.julialang.org/t/64-hw-threads-under-windows/114124/6 "2024-05-11T06:18:59Z")

</div>

Like i said git and github aren’t really a thing in my work and i was very unfamiliar - perforce has a more dominant position in aaa game dev.

I have since released some code (threading extensions to eigen [GitHub - ValveSoftware/eigen: Fork of Eigen release version 3.4. Adds ability to use alternate threading systems from Open MP.](https://github.com/ValveSoftware/eigen)) to github and am a little familiar now, another reason to follow up. Seems kind of selfish of me to be running the only julia on windows without this problem :). Plus it’s a pain to have to build my own libuv.  
Ill see if i can put together a fixed version of the julia fork of libuv and submit a patch properly

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [May 13, 2024, 6:09am UTC](https://discourse.julialang.org/t/64-hw-threads-under-windows/114124/7 "2024-05-13T06:09:51Z")

</div>

Can you zip or tar up the modified source code and post it somewhere?

---

<div class="post-metadata">

**Author:** ![Chris\_Green](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chris_green/32/32265_2.png) [@Chris\_Green](https://discourse.julialang.org/u/Chris_Green)\
**Post date:** [May 13, 2024, 1:30pm UTC](https://discourse.julialang.org/t/64-hw-threads-under-windows/114124/8 "2024-05-13T13:30:35Z")

</div>

yes.  
Give me a little bit, I need to update to the latest and merge+test the changes.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [May 13, 2024, 1:48pm UTC](https://discourse.julialang.org/t/64-hw-threads-under-windows/114124/9 "2024-05-13T13:48:22Z")

</div>

If you would like, but you seem to be having a lof of challenges with `git`.
