Minor experiment fixes

This commit is contained in:
Anton Reinhard 2024-03-07 00:38:37 +01:00
parent d036f21862
commit 1d957bc128
2 changed files with 10 additions and 10 deletions

View File

@ -44,14 +44,14 @@ if isfile(results_filename)
df = CSV.read(results_filename, DataFrame)
end
nInputs = 2^24
nInputs = 2^20
function cpu_bench(compute_function, inputs)
bench = @benchmark begin
@inbounds Threads.@threads for i in eachindex($inputs)
@invokelatest $compute_function($inputs[i])
end
end gcsample = true seconds = 300
end gcsample = true samples = 20 evals = 1
time = median(bench.times) / 1e9
s = std(bench.times) / 1e9
@ -67,9 +67,9 @@ function gpu_bench(kernel!, inputs)
ts = 32
bs = Int(n / ts)
bench = @benchmark begin
@cuda threads = ts blocks = bs always_inline = true kernel!.($inputs, $outputs, $n)
@cuda threads = $ts blocks = $bs always_inline = true $kernel!($inputs, $outputs, $n)
CUDA.device_synchronize()
end gcsample = true seconds = 300
end gcsample = true samples = 20 evals = 1
time = median(bench.times) / 1e9
s = std(bench.times) / 1e9
@ -210,7 +210,7 @@ machine = Machine(
# sadly cannot put these in functions because the world age must increase after the function is created which happens only in the global scope
## -- WARMUP TO COMPILE FUNCTIONS first
#=
optimizer = RandomWalkOptimizer(MersenneTwister(0))
# 2-photon compton
@ -230,7 +230,7 @@ opt_time = @elapsed optimize_to_fixpoint!(optimizer, graph)
func_gen_time = @elapsed compute_func = get_compute_function(graph, process, machine)
kernel! = get_cuda_kernel(graph, process, machine)
bench_process(process, "warmup", graph, compute_func, kernel!, gen_time, opt_time, func_gen_time)
=#
## -- WARMUP END
optimizer = ReductionOptimizer()

View File

@ -19,10 +19,10 @@ lsblk > results/storage_$i.txt
lspci > results/pci_$i.txt
echo "Initiating julia..."
julia --threads=8 --project=./ -e 'using Pkg; Pkg.instantiate(); Pkg.add(url="https://github.com/QEDjl-project/QEDprocesses.jl/")' >> $LOG_FILE 2>&1 || exit 1 # need current dev version of QEDprocesses
julia --threads=8 --project=./ -e 'using Pkg; Pkg.instantiate(); Pkg.add(url="https://github.com/AntonReinhard/QEDbase.jl/tree/fix_bs_multiplication")' >> $LOG_FILE 2>&1 || exit 1 # need a specific fix for abs*bs multiplication for gpu
julia --threads=8 -e 'using Pkg; Pkg.add("CSV"); Pkg.add("DataFrames"); Pkg.add("LIKWID"); Pkg.add("CUDA"); Pkg.add("Random"); Pkg.add("BenchmarkTools"); Pkg.add("Dates")' >> $LOG_FILE 2>&1 || exit 1 # add requirements for the bench script
julia --project -e 'using CUDA; CUDA.set_runtime_version!(VersionNumber("12.1"))' >> $LOG_FILE 2>&1 || echo "Failed to set CUDA version number"
#julia --threads=8 --project=./ -e 'using Pkg; Pkg.instantiate(); Pkg.add(url="https://github.com/QEDjl-project/QEDprocesses.jl/")' >> $LOG_FILE 2>&1 || exit 1 # need current dev version of QEDprocesses
#julia --threads=8 --project=./ -e 'using Pkg; Pkg.instantiate(); Pkg.add(url="https://github.com/AntonReinhard/QEDbase.jl/tree/fix_bs_multiplication")' >> $LOG_FILE 2>&1 || exit 1 # need a specific fix for abs*bs multiplication for gpu
#julia --threads=8 -e 'using Pkg; Pkg.add("CSV"); Pkg.add("DataFrames"); Pkg.add("LIKWID"); Pkg.add("CUDA"); Pkg.add("Random"); Pkg.add("BenchmarkTools"); Pkg.add("Dates")' >> $LOG_FILE 2>&1 || exit 1 # add requirements for the bench script
#julia --project -e 'using CUDA; CUDA.set_runtime_version!(VersionNumber("12.1"))' >> $LOG_FILE 2>&1 || echo "Failed to set CUDA version number"
echo "Benchmarking $i Threads"
julia --project -O3 --threads=$i examples/qed_bench.jl >> $LOG_FILE 2>&1 || echo "-- Something went wrong, check logs --"