35 lines
892 B
Bash
35 lines
892 B
Bash
|
#!/usr/bin/env sh
|
||
|
|
||
|
venv_dir=.venv
|
||
|
|
||
|
run_tests() (
|
||
|
echo "py $("${venv_dir}/bin/python" py/feed_forward.py "$1")"
|
||
|
echo "jl $(julia jl/feed_forward.jl "$1")"
|
||
|
echo "go $(go/target/feed_forward "$1")"
|
||
|
echo "rs $(rs/target/release/feed_forward "$1")"
|
||
|
)
|
||
|
|
||
|
num_times=$1
|
||
|
shift 1
|
||
|
|
||
|
echo 'Compiling Rust binaries' >&2
|
||
|
cargo build -q --release --manifest-path rs/Cargo.toml
|
||
|
|
||
|
echo 'Compiling Go binary' >&2
|
||
|
cd go && go get && go build -o target/feed_forward feed_forward.go && cd ..
|
||
|
|
||
|
[ -d "${venv_dir}" ] || (
|
||
|
echo 'Creating Python virtual environment' &&
|
||
|
python -m venv "${venv_dir}" &&
|
||
|
"${venv_dir}/bin/pip" install -r py/requirements.txt &> /dev/null
|
||
|
)
|
||
|
|
||
|
old="$IFS"
|
||
|
IFS='-'
|
||
|
echo "Generating $*-network test data" >&2
|
||
|
IFS=$old
|
||
|
"${venv_dir}/bin/python" py/gen_data.py -q -Y "$@"
|
||
|
|
||
|
echo "Running feed forward $num_times times" >&2
|
||
|
run_tests "$num_times"
|