Skip to content

Commit

Permalink
Small local run scripts, wave_2d Operator type fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
PapyChacal committed Oct 4, 2023
1 parent 94b77fe commit 9c0f64c
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.pyc
*.npy
*.npz

*.json

Expand All @@ -11,4 +12,4 @@ docs/_build
.ipynb_checkpoints

devito.egg-info/*
venv
venv
31 changes: 31 additions & 0 deletions fast/openmp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

export DEVITO_LANGUAGE=openmp
export DEVITO_ARCH=cray
export DEVITO_LOGGING=DEBUG
unset DEVITO_AUTOTUNING

export OMP_PLACES=cores
export OMP_PROC_BIND=true

get_runtime() {
$@ |& grep 'Operator.*ran' | rev | cut -d ' ' -f2 | rev
}

echo bench_name,so,threads,Devito,xDSL
for bench in "wave2d_b.py -d 2048 2048 --nt 512" "wave3d_b.py -d 512 512 512 --nt 512" "diffusion_3D_wBCs.py -d 512 512 512 --nt 512" "diffusion_2D_wBCs.py -d 2048 2048 --nt 512"
do
bench_name=$(echo $bench | cut -d ' ' -f1)
for so in 2 4 8
do
for threads in 1 2 4 8 16 32
do
export OMP_NUM_THREADS=$threads
# echo OMP_NUM_THREADS=$threads
# python $bench -so $so --devito 1
devito_time=$(get_runtime python $bench -so $so --devito 1)
xdsl_time=$(get_runtime python $bench -so $so --xdsl 1)
echo $bench_name,$so,$threads,$devito_time,$xdsl_time
done
done
done
22 changes: 22 additions & 0 deletions fast/single_thread.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

unset DEVITO_LANGUAGE
export DEVITO_ARCH=cray
export DEVITO_LOGGING=DEBUG
export DEVITO_AUTOTUNING=aggressive

get_runtime() {
$@ |& grep 'Operator.*ran' | rev | cut -d ' ' -f2 | rev
}

echo bench_name,so,Devito,xDSL
for bench in "wave2d_b.py -d 2048 2048 --nt 512" "wave3d_b.py -d 512 512 512 --nt 512" "diffusion_3D_wBCs.py -d 512 512 512 --nt 512" "diffusion_2D_wBCs.py -d 2048 2048 --nt 512"
do
bench_name=$(echo $bench | cut -d ' ' -f1)
for so in 2 4 8
do
devito_time=$(get_runtime python $bench -so $so --devito 1)
xdsl_time=$(get_runtime python $bench -so $so --xdsl 1)
echo $bench_name,$so,$devito_time,$xdsl_time
done
done
4 changes: 1 addition & 3 deletions fast/wave2d_b.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

from devito import (TimeFunction, Eq, Operator, solve, norm,
XDSLOperator, configuration, Grid)
from examples.seismic import RickerSource
from examples.seismic import Model, TimeAxis, plot_image
from fast.bench_utils import plot_2dfunc
from devito.tools import as_tuple

Expand Down Expand Up @@ -116,7 +114,7 @@
# print("XDSL init linalg norm:", np.linalg.norm(u.data[2]))

# Run more with no sources now (Not supported in xdsl)
xdslop = Operator([stencil], name='xDSLOperator')
xdslop = XDSLOperator([stencil], name='xDSLOperator')
xdslop.apply(time=nt, dt=dt)

if len(shape) == 2 and args.plot:
Expand Down

0 comments on commit 9c0f64c

Please sign in to comment.