Skip to content

Instantly share code, notes, and snippets.

@drsnyder
Created August 24, 2012 20:47
Show Gist options
  • Select an option

  • Save drsnyder/3455441 to your computer and use it in GitHub Desktop.

Select an option

Save drsnyder/3455441 to your computer and use it in GitHub Desktop.
Grabs stream-scaling and runs it
#!/bin/bash
STREAM_SRC=https://raw.github.com/gregs1104/stream-scaling/master/stream-scaling
SCRATCH=/tmp/memory-test
mkdir /tmp/memory-test 2> /dev/null
if [[ "$1X" == "X" ]]; then
MINMEMORY=29000
else
MINMEMORY=$1
fi
function test_output_file() {
max=$(cat $SCRATCH/stream.out | grep Triad | awk '{ print $2 }' | sort -nr | head -1 | sed "s/\..*$//")
if [[ $max -gt $MINMEMORY ]]; then
echo "Good. Detected max @ $max which is > $MINMEMORY."
exit 0;
else
echo "Max memory bandwidth detected at $max. Looking for $MINMEMORY."
exit 1;
fi
}
echo "Downloading stream-scaling from $STREAM_SRC."
curl --silent -k $STREAM_SRC > $SCRATCH/stream-scaling
if [[ -e $SCRATCH/stream-scaling ]]; then
echo "Running test using $SCRATCH/stream-scaling."
chmod +x $SCRATCH/stream-scaling
$SCRATCH/stream-scaling &> $SCRATCH/stream.out
if [[ $? -ne 0 ]]; then
echo "First attempt failed. Changing NEEDED_SIZE."
# FIXME: add more thought to this. this is probably the reason, but we don't know
# for sure
sed -i 's/\(.*\)#NEEDED_SIZE=$MAX_ARRAY_SIZE/\1NEEDED_SIZE=$MAX_ARRAY_SIZE/' $SCRATCH/stream-scaling
$SCRATCH/stream-scaling &> $SCRATCH/stream.out
if [[ $? -eq 0 ]]; then
test_output_file
else
echo "Error running stream-scaling. See $SCRATCH/stream.out."
exit 1;
fi
else
test_output_file
fi
else
echo "Error, download from $STREAM_SRC seems to have failed."
exit 1;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment