Skip to content

Commit

Permalink
add script to set up ispc for benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
gnzlbg committed Sep 5, 2018
1 parent 37248c3 commit 4c5eaa3
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 5 deletions.
53 changes: 53 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,55 @@
Cargo.lock
target/

# llvm-ir and assembly
*.ll
*.d

# png files output by benchmarks
*.png

# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*

# Org-mode
.org-id-locations
*_archive

# flymake-mode
*_flymake.*

# eshell files
/eshell/history
/eshell/lastdir

# elpa packages
/elpa/

# reftex files
*.rel

# AUCTeX auto folder
/auto/

# cask packages
.cask/
dist/

# Flycheck
flycheck_*.el

# server auth directory
/server/

# projectiles files
.projectile

# directory configuration
.dir-locals.el
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ matrix:
osx_image: xcode9.4
# BENCHMARKS:
- name: "Benchmarks - x86_64-unknown-linux-gnu"
install: rustup component add rustfmt-preview
script: NORUN=1 FEATURES=coresimd,ispc,sleef-sys ci/benchmark.sh
install: TARGET=x86_64-unknown-linux-gnu ./ci/setup_benchmarks.sh
script: PATH=$(pwd):$PATH NORUN=1 FEATURES=coresimd,ispc,sleef-sys ci/benchmark.sh
- name: "Benchmarks - x86_64-apple-darwin"
install: rustup component add rustfmt-preview
script: NORUN=1 FEATURES=coresimd,ispc,sleef-sys ci/benchmark.sh
install: TARGET=x86_64-apple-darwin ./ci/setup_benchmarks.sh
script: PATH=$(pwd):$PATH NORUN=1 FEATURES=coresimd,ispc,sleef-sys ci/benchmark.sh
os: osx
osx_image: xcode9.4
# TOOLS:
Expand Down
9 changes: 8 additions & 1 deletion ci/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ set -ex

if [[ ${NORUN} != 1 ]]; then
# Most benchmarks require hyperfine; require it upfront.
hash hyperfine 2>/dev/null || { echo >&2 "hyperfine is not installed. Aborting."; exit 1; }
hash hyperfine 2>/dev/null || { echo >&2 "hyperfine is not in PATH."; exit 1; }
fi


# If the ispc benchmark feature is enabled, ispc must be in the path of the
# benchmarks.
if echo "$FEATURES" | grep -q "ispc"; then
hash ispc 2>/dev/null || { echo >&2 "ispc is not in PATH."; exit 1; }
fi

# An example with a benchmark.sh is a benchmark:
Expand Down
10 changes: 10 additions & 0 deletions ci/setup_benchmarks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -ex

# Get latest ISPC binary for the target and put it in the path
git clone https://github.com/gnzlbg/ispc-binaries
cp ispc-binaries/ispc-${TARGET} ispc

# Rust-bindgen requires RUSTFMT
rustup component add rustfmt-preview
5 changes: 5 additions & 0 deletions examples/aobench/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ set -ex
export WIDTH=800
export HEIGHT=600

if [[ ${NORUN} != 1 ]]; then
hash hyperfine 2>/dev/null || { echo >&2 "hyperfine is not in PATH."; exit 1; }
fi

ALGS=("scalar" "scalar_par" "vector" "vector_par" "tiled" "tiled_par")
if echo "$FEATURES" | grep -q "ispc"; then
hash ispc 2>/dev/null || { echo >&2 "ispc is not in PATH."; exit 1; }
ALGS+=("ispc" "ispc_tasks")
fi

Expand Down
8 changes: 8 additions & 0 deletions examples/mandelbrot/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ set -ex
WIDTH=800
HEIGHT=800

if [[ ${NORUN} != 1 ]]; then
hash hyperfine 2>/dev/null || { echo >&2 "hyperfine is not in PATH."; exit 1; }
fi

if echo "$FEATURES" | grep -q "ispc"; then
hash ispc 2>/dev/null || { echo >&2 "ispc is not in PATH."; exit 1; }
fi

RUSTFLAGS="-C target-cpu=native ${RUSTFLAGS}" \
cargo build --release --features="${FEATURES}"

Expand Down
5 changes: 5 additions & 0 deletions examples/stencil/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

set -ex

if [[ ${NORUN} != 1 ]]; then
hash hyperfine 2>/dev/null || { echo >&2 "hyperfine is not in PATH."; exit 1; }
fi

algs=("0" "1" "2")
if echo "$FEATURES" | grep -q "ispc"; then
hash ispc 2>/dev/null || { echo >&2 "ispc is not in PATH."; exit 1; }
algs+=( "3" "4" )
fi

Expand Down

0 comments on commit 4c5eaa3

Please sign in to comment.