Skip to content

Commit

Permalink
Workflow running as intended, tested for multiple Julia versions, cas…
Browse files Browse the repository at this point in the history
…e configuration, backends.

Reverted the dependencies added in WaterLily, and these are now included in the benchmarks environment.
To run the benchmarks, the benchmarks environment is activated, while WaterLily is marked as a development package.
  • Loading branch information
b-fg committed Dec 16, 2023
1 parent d555e1b commit 564937b
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 33 deletions.
3 changes: 0 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ version = "1.0.3"

[deps]
AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
OutMacro = "0ae4d431-9932-4135-a8f1-51ee5e017775"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Expand Down
7 changes: 7 additions & 0 deletions benchmark/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
OutMacro = "0ae4d431-9932-4135-a8f1-51ee5e017775"
WaterLily = "ed894a53-35f9-47f1-b17f-85db9237eebd"
94 changes: 64 additions & 30 deletions benchmark/launch_bernchmarks.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,55 @@
#!/bin/bash
# Usage example
# sh launch_bernchmarks.sh -v "1.8.5 1.10.0-rc1" --threads 6 --backends "Array CuArray" --cases "tgv.jl" --log2n "(3,4)"

# Grep current julia version
julia_version () {
julia_v=($(julia -v))
echo "${julia_v[2]}"
}

# Update project environment with new Julia version
update_environment () {
echo "Updating environment to Julia v$version"
# juliaup default $version
julia --project -e "using Pkg; Pkg.update(); Pkg.precompile()"
echo "Updating environment to Julia v$version"
juliaup default $version
# Mark WaterLily as a development package. Then update dependencies and precompile.
julia --project -e "using Pkg; Pkg.develop(PackageSpec(path=join(split(pwd(), '/')[1:end-1], '/'))); Pkg.update();"
}

run_benchmark () {
echo "Running: julia --projects $args"
julia --project $args
}

# Print benchamrks info
display_info () {
echo "--------------------------------------"
echo "Running benchmark tests for:
- Julia: ${VERSIONS[@]}
- Backends: ${BACKENDS[@]}"
- Julia: ${VERSIONS[@]}
- Backends: ${BACKENDS[@]}"
if [[ " ${BACKENDS[*]} " =~ [[:space:]]'Array'[[:space:]] ]]; then
echo " - CPU threads: ${THREADS[@]}"
echo " - CPU threads: ${THREADS[@]}"
fi
echo " - Cases: ${CASES[@]}
- Size: ${LOG2N[@]}
- Sim. time: ${TEND[@]}
- Max. steps: ${MAXSTEPS[@]}"
echo " - Cases: ${CASES[@]}
- Size: ${LOG2N[@]}
- Sim. time: ${TEND[@]}
- Max. steps: ${MAXSTEPS[@]}
- Data type: ${DTYPE[@]}
- Num. samples: ${SAMPLES[@]}"
echo "--------------------------------------"; echo
}

# Defaults
# VERSIONS=('1.8.5' '1.10.0-rc2')
VERSIONS=('1.8.5')
# Default backends
VERSIONS=($(julia_version))
BACKENDS=('Array' 'CuArray')
THREADS=('1' '6')
# Default cases. Arrays below must be same length (specify each case individually)
CASES=('tgv.jl' 'donut.jl')
LOG2N=('(4,5,6)' '(7,8,9)')
LOG2N=('(5,6,7)' '(5,6,7)')
TEND=('10.0' '10.0')
MAXSTEPS=('100' '100')
DTYPE=('Float32' 'Float32')
SAMPLES=('1' '1')

# Parse arguments
while [ $# -gt 0 ]; do
Expand All @@ -56,13 +75,21 @@ case "$1" in
shift
;;
--t_end|-tend)
MAXSTEPS=($2)
TEND=($2)
shift
;;
--max_steps|-ms)
--max_steps|-maxsteps)
MAXSTEPS=($2)
shift
;;
--data_type|-dtype)
DTYPE=($2)
shift
;;
--samples|-s)
SAMPLES=($2)
shift
;;
*)
printf "ERROR: Invalid argument\n"
exit 1
Expand All @@ -84,19 +111,26 @@ display_info
# Benchmarks
for version in "${VERSIONS[@]}" ; do
echo "Julia v$version benchmaks"
for backend in "${BACKENDS[@]}" ; do
if [ "${backend}" == "Array" ]; then
for thread in "${THREADS[@]}" ; do
args="-t $thread "
done
else
echo "Backend is not Array"
fi
done
# update_environment
for case in "${CASES[@]}" ; do
for log2n in "${LOG2N[@]}" ; do

update_environment
for i in "${!CASES[@]}"; do
args_case="${CASES[$i]} --log2n=${LOG2N[$i]} --t_end=${TEND[$i]} --max_steps=${MAXSTEPS[$i]} --dtype=${DTYPE[$i]} --samples=${SAMPLES[$i]}"
for backend in "${BACKENDS[@]}" ; do
if [ "${backend}" == "Array" ]; then
for thread in "${THREADS[@]}" ; do
args="-t $thread "$args_case" --backend=$backend"
run_benchmark
done
else
args=$args_case" --backend=$backend"
run_benchmark
fi
done
done
done
done

# Run comparison [ToDo]


# Restore julia system version to default one and exit
juliaup default $(julia_version)
exit 0

0 comments on commit 564937b

Please sign in to comment.