-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hardcoded assumption about numa domains and threads IDs #16
Comments
Any specific reason why BandwidthBenchmark.jl/src/bwscaling.jl Line 56 in 96cd0e8
length(cpuids) ?
|
Well, not really. But the assumption is that we want to scan over |
It changes with my definition of cpuids = @views reduce(vcat, numacpuids[i][1:nt] for i in 1:(nn - min_nnuma + 1)) 😅 |
FWIW, I think it would be better to directly support selecting specific NUMA domains for the benchmark than keeping the assumption that they are contiguous. |
But |
Does the following work for you? If yes, I'll push it to master. """
Similar to `bwscaling` but measures the memory bandwidth scaling within and across
memory domains. Returns a `DataFrame` in which each row contains the kernel name,
the number of threads per memory domain, the number of domains considered, and the
measured memory bandwidth (in MB/s).
**Keyword arguments**
- `domains`: memory domains to consider (logical indices, i.e. starting at 1)
- `max_nthreads`: maximal number of threads per memory domain to consider
"""
function bwscaling_memory_domains(; domains=1:nnuma(),
max_nthreads=maximum(ncores_per_numa()), kwargs...)
if !all(i->i>0 && i<=nnuma(), domains)
throw(ArgumentError("Invalid argument `numas` (out of bounds)."))
end
# query system information
numacpuids = cpuids_per_numa()[domains]
filter!.(!ishyperthread, numacpuids) # drop hyperthreads
if !all(x->length(x) >= max_nthreads, numacpuids)
throw(ArgumentError("Some memory domains don't have enough CPU-cores. Please provide a smaller value for `max_nthreads`."))
end
if Threads.nthreads() < length(domains) * max_nthreads
throw(ErrorException("Not enough Julia threads. Please start Julia with at least " *
"$(length(domains) * max_nthreads) threads."))
end
results = DataFrame(;
Function=String[],
var"# Threads per domain"=Int64[],
var"# Memory domains"=Int64[],
var"Rate (MB/s)"=Float64[]
)
for nn in 1:length(domains) # how many domains to use
for nt in 1:max_nthreads # how many threads/cores to use per domain
println("domain=$(domains[nn]), nthreads_per_numa=$nt")
total_nthreads = nn * nt
# select cpuids
cpuids = @views reduce(vcat, numacpuids[i][1:nt] for i in 1:nn)
# @show cpuids
# pin threads
pinthreads(cpuids)
# run benchmark (all kernels)
df = bwbench(; nthreads=total_nthreads, kwargs...)
# store and print result
for row in eachrow(df)
push!(results, [row.Function, nt, nn, row.var"Rate (MB/s)"])
end
println("Bandwidths (MB/s): ", join([round(bw, digits=2) for bw in df.var"Rate (MB/s)"], ", "))
flush(stdout)
end
end
return results
end Use as |
No, that causes the error
|
Does my code above work for you? |
No:
Edit: ah, wait, I forgot to pass the right arguments and it discarded the wrong ones. |
Ok, yes, |
Great (closed by e70ec27) |
In the memory domain scaling function there are some hardcoded assumptions about the fact numa domains and thread ids start from 1. They don't hold on Fugaku, where the cores reserved to users are
12:59
, and the corresponding NUMA domains are3:6
. I redefinedbwscaling_memory_domains
as(and this is still assuming numa domains IDs are consecutive, which in other cases may not be true) but this is still crashing with
Edit:
may help, running again now.
The text was updated successfully, but these errors were encountered: