JuliaGPU / JuliaGPU/KernelAbstractions.jl
[FR] Add nthreads argument to CPU backend
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 523
- Forks
- 88
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 25
Description
Hi! First of all congratulations on the fantastic package :)
Sometimes, seeing how the speed scales as a function of the number of threads is helpful.
My understanding is that right now the only way to change this is to run Julia differently julia --nthreads=X, and KA uses Julia's Threads.nthreads() (L95 here) to launch different processes:
Could this be an argument of the CPU backend? For example, launching a kernel with CPU(8) would run with 8 threads (if 8 <= Threads.nthreads()). So we don't need to restart Julia with a different number of threads.
Obviously it doesn't need to be an argument in the backend, there might be a better way to implement this
Forgive me if there is a way to do this that I haven't realized.
Cheers!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/cpu.jl around lines 93-100 and review how Julia's Threads.nthreads() is used to launch CPU processes. Determine how a CPU backend thread-count argument could limit execution without restarting Julia, including the stated constraint that it must not exceed Threads.nthreads(); done means the behavior is implemented and validated for CPU(8).
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend, hpc
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100