Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 5 additions & 63 deletions CheckENV/run.sh
Original file line number Diff line number Diff line change
@@ -1,67 +1,9 @@
#! /bin/bash
# run.sh <number of repetitions>
compiler="g++"
flags="-fopenmp -std=c++11 -Wall -Wextra -Werror"
src="./src/main.cpp"
build="./build"
exe="$build/task"
tests_dir="./tests"

echo "[CLEAR]"
echo " rm $build -r"
rm $build -rf
# Set script directory for the check performed in openmp_run.inc
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

echo "[BUILD]"
echo " mkdir $build"
mkdir $build
echo " $compiler $src -o $exe $flags"
$compiler $src -o $exe $flags
# Set a variable to ensure that openmp_run.inc is not ran directly
RUN=1

if [ ! $? -eq 0 ]; then
echo "[ERROR] Can't compile $src"
exit 1
fi

SUCCESS_TESTS=()
FAIL_TESTS=()

for test_dir in $tests_dir/*; do
test=$(basename $test_dir)
printf "\n[TEST $test]\n"
echo " $exe $test_dir/input.txt $build/$test.txt"
START=$(date +%s%N)
$exe $test_dir/input.txt $build/$test.txt
END=$(date +%s%N)
DIFF=$((($END - $START)/1000000))
if [ ! $? -eq 0 ]; then
echo "[TEST $test] RUNTIME FAIL"
continue;
fi
if cmp -s $build/$test.txt $test_dir/output.txt; then
echo "[TEST $test] OK ($DIFF ms)"
RES="OK"
if [ -n "$1" ]; then
for ((i=1; i < $1; i++)); do
START=$(date +%s%N)
$exe $test_dir/input.txt $build/${test}_$i.txt
END=$(date +%s%N)
DIFF=$(($DIFF + ($END - $START)/1000000))
if ! cmp -s $build/${test}_$i.txt $test_dir/output.txt; then
RES="FAIL"
echo "DIFF FAIL: vimdiff $build/${test}_$i.txt $test_dir/output.txt"
FAIL_TESTS+=($test)
fi
done
echo "[TEST ${test}x$1] $RES ($DIFF ms)"
fi
if [[ $RES=="OK" ]]; then
SUCCESS_TESTS+=($test)
fi
else
echo "[TEST $test] DIFF FAIL($DIFF ms): vimdiff $build/$test.txt $test_dir/output.txt"
FAIL_TESTS+=($test)
fi
done
echo "==========="
echo "SUCCESSFUL: ${SUCCESS_TESTS[@]}"
echo "FAIL: ${FAIL_TESTS[@]}"
. $SCRIPTDIR/../openmp_run.inc
68 changes: 5 additions & 63 deletions OpenMP2/run.sh
Original file line number Diff line number Diff line change
@@ -1,67 +1,9 @@
#! /bin/bash
# run.sh <number of repetitions>
compiler="g++"
flags="-fopenmp -std=c++11 -Wall -Wextra -Werror"
src="./src/main.cpp"
build="./build"
exe="$build/task"
tests_dir="./tests"

echo "[CLEAR]"
echo " rm $build -r"
rm $build -rf
# Set script directory for the check performed in openmp_run.inc
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

echo "[BUILD]"
echo " mkdir $build"
mkdir $build
echo " $compiler $src -o $exe $flags"
$compiler $src -o $exe $flags
# Set a variable to ensure that openmp_run.inc is not ran directly
RUN=1

if [ ! $? -eq 0 ]; then
echo "[ERROR] Can't compile $src"
exit 1
fi

SUCCESS_TESTS=()
FAIL_TESTS=()

for test_dir in $tests_dir/*; do
test=$(basename $test_dir)
printf "\n[TEST $test]\n"
echo " $exe $test_dir/input.txt $build/$test.txt"
START=$(date +%s%N)
$exe $test_dir/input.txt $build/$test.txt
END=$(date +%s%N)
DIFF=$((($END - $START)/1000000))
if [ ! $? -eq 0 ]; then
echo "[TEST $test] RUNTIME FAIL"
continue;
fi
if cmp -s $build/$test.txt $test_dir/output.txt; then
echo "[TEST $test] OK ($DIFF ms)"
RES="OK"
if [ -n "$1" ]; then
for ((i=1; i < $1; i++)); do
START=$(date +%s%N)
$exe $test_dir/input.txt $build/${test}_$i.txt
END=$(date +%s%N)
DIFF=$(($DIFF + ($END - $START)/1000000))
if ! cmp -s $build/${test}_$i.txt $test_dir/output.txt; then
RES="FAIL"
echo "DIFF FAIL: vimdiff $build/${test}_$i.txt $test_dir/output.txt"
FAIL_TESTS+=($test)
fi
done
echo "[TEST ${test}x$1] $RES ($DIFF ms)"
fi
if [[ $RES=="OK" ]]; then
SUCCESS_TESTS+=($test)
fi
else
echo "[TEST $test] DIFF FAIL($DIFF ms): vimdiff $build/$test.txt $test_dir/output.txt"
FAIL_TESTS+=($test)
fi
done
echo "==========="
echo "SUCCESSFUL: ${SUCCESS_TESTS[@]}"
echo "FAIL: ${FAIL_TESTS[@]}"
. $SCRIPTDIR/../openmp_run.inc
68 changes: 5 additions & 63 deletions OpenMP3/run.sh
Original file line number Diff line number Diff line change
@@ -1,67 +1,9 @@
#! /bin/bash
# run.sh <number of repetitions>
compiler="g++"
flags="-fopenmp -std=c++11 -Wall -Wextra -Werror"
src="./src/main.cpp"
build="./build"
exe="$build/task"
tests_dir="./tests"

echo "[CLEAR]"
echo " rm $build -r"
rm $build -rf
# Set script directory for the check performed in openmp_run.inc
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

echo "[BUILD]"
echo " mkdir $build"
mkdir $build
echo " $compiler $src -o $exe $flags"
$compiler $src -o $exe $flags
# Set a variable to ensure that openmp_run.inc is not ran directly
RUN=1

if [ ! $? -eq 0 ]; then
echo "[ERROR] Can't compile $src"
exit 1
fi

SUCCESS_TESTS=()
FAIL_TESTS=()

for test_dir in $tests_dir/*; do
test=$(basename $test_dir)
printf "\n[TEST $test]\n"
echo " $exe $test_dir/input.txt $build/$test.txt"
START=$(date +%s%N)
$exe $test_dir/input.txt $build/$test.txt
END=$(date +%s%N)
DIFF=$((($END - $START)/1000000))
if [ ! $? -eq 0 ]; then
echo "[TEST $test] RUNTIME FAIL"
continue;
fi
if cmp -s $build/$test.txt $test_dir/output.txt; then
echo "[TEST $test] OK ($DIFF ms)"
RES="OK"
if [ -n "$1" ]; then
for ((i=1; i < $1; i++)); do
START=$(date +%s%N)
$exe $test_dir/input.txt $build/${test}_$i.txt
END=$(date +%s%N)
DIFF=$(($DIFF + ($END - $START)/1000000))
if ! cmp -s $build/${test}_$i.txt $test_dir/output.txt; then
RES="FAIL"
echo "DIFF FAIL: vimdiff $build/${test}_$i.txt $test_dir/output.txt"
FAIL_TESTS+=($test)
fi
done
echo "[TEST ${test}x$1] $RES ($DIFF ms)"
fi
if [[ $RES=="OK" ]]; then
SUCCESS_TESTS+=($test)
fi
else
echo "[TEST $test] DIFF FAIL($DIFF ms): vimdiff $build/$test.txt $test_dir/output.txt"
FAIL_TESTS+=($test)
fi
done
echo "==========="
echo "SUCCESSFUL: ${SUCCESS_TESTS[@]}"
echo "FAIL: ${FAIL_TESTS[@]}"
. $SCRIPTDIR/../openmp_run.inc
68 changes: 5 additions & 63 deletions OpenMP4/run.sh
Original file line number Diff line number Diff line change
@@ -1,67 +1,9 @@
#! /bin/bash
# run.sh <number of repetitions>
compiler="g++"
flags="-fopenmp -std=c++11 -Wall -Wextra -Werror"
src="./src/main.cpp"
build="./build"
exe="$build/task"
tests_dir="./tests"

echo "[CLEAR]"
echo " rm $build -r"
rm $build -rf
# Set script directory for the check performed in openmp_run.inc
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

echo "[BUILD]"
echo " mkdir $build"
mkdir $build
echo " $compiler $src -o $exe $flags"
$compiler $src -o $exe $flags
# Set a variable to ensure that openmp_run.inc is not ran directly
RUN=1

if [ ! $? -eq 0 ]; then
echo "[ERROR] Can't compile $src"
exit 1
fi

SUCCESS_TESTS=()
FAIL_TESTS=()

for test_dir in $tests_dir/*; do
test=$(basename $test_dir)
printf "\n[TEST $test]\n"
echo " $exe $test_dir/input.txt $build/$test.txt"
START=$(date +%s%N)
$exe $test_dir/input.txt $build/$test.txt
END=$(date +%s%N)
DIFF=$((($END - $START)/1000000))
if [ ! $? -eq 0 ]; then
echo "[TEST $test] RUNTIME FAIL"
continue;
fi
if cmp -s $build/$test.txt $test_dir/output.txt; then
echo "[TEST $test] OK ($DIFF ms)"
RES="OK"
if [ -n "$1" ]; then
for ((i=1; i < $1; i++)); do
START=$(date +%s%N)
$exe $test_dir/input.txt $build/${test}_$i.txt
END=$(date +%s%N)
DIFF=$(($DIFF + ($END - $START)/1000000))
if ! cmp -s $build/${test}_$i.txt $test_dir/output.txt; then
RES="FAIL"
echo "DIFF FAIL: vimdiff $build/${test}_$i.txt $test_dir/output.txt"
FAIL_TESTS+=($test)
fi
done
echo "[TEST ${test}x$1] $RES ($DIFF ms)"
fi
if [[ $RES=="OK" ]]; then
SUCCESS_TESTS+=($test)
fi
else
echo "[TEST $test] DIFF FAIL($DIFF ms): vimdiff $build/$test.txt $test_dir/output.txt"
FAIL_TESTS+=($test)
fi
done
echo "==========="
echo "SUCCESSFUL: ${SUCCESS_TESTS[@]}"
echo "FAIL: ${FAIL_TESTS[@]}"
. $SCRIPTDIR/../openmp_run.inc
68 changes: 5 additions & 63 deletions OpenMP5/run.sh
Original file line number Diff line number Diff line change
@@ -1,67 +1,9 @@
#! /bin/bash
# run.sh <number of repetitions>
compiler="g++"
flags="-fopenmp -std=c++11 -Wall -Wextra -Werror"
src="./src/main.cpp"
build="./build"
exe="$build/task"
tests_dir="./tests"

echo "[CLEAR]"
echo " rm $build -r"
rm $build -rf
# Set script directory for the check performed in openmp_run.inc
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

echo "[BUILD]"
echo " mkdir $build"
mkdir $build
echo " $compiler $src -o $exe $flags"
$compiler $src -o $exe $flags
# Set a variable to ensure that openmp_run.inc is not ran directly
RUN=1

if [ ! $? -eq 0 ]; then
echo "[ERROR] Can't compile $src"
exit 1
fi

SUCCESS_TESTS=()
FAIL_TESTS=()

for test_dir in $tests_dir/*; do
test=$(basename $test_dir)
printf "\n[TEST $test]\n"
echo " $exe $test_dir/input.txt $build/$test.txt"
START=$(date +%s%N)
$exe $test_dir/input.txt $build/$test.txt
END=$(date +%s%N)
DIFF=$((($END - $START)/1000000))
if [ ! $? -eq 0 ]; then
echo "[TEST $test] RUNTIME FAIL"
continue;
fi
if cmp -s $build/$test.txt $test_dir/output.txt; then
echo "[TEST $test] OK ($DIFF ms)"
RES="OK"
if [ -n "$1" ]; then
for ((i=1; i < $1; i++)); do
START=$(date +%s%N)
$exe $test_dir/input.txt $build/${test}_$i.txt
END=$(date +%s%N)
DIFF=$(($DIFF + ($END - $START)/1000000))
if ! cmp -s $build/${test}_$i.txt $test_dir/output.txt; then
RES="FAIL"
echo "DIFF FAIL: vimdiff $build/${test}_$i.txt $test_dir/output.txt"
FAIL_TESTS+=($test)
fi
done
echo "[TEST ${test}x$1] $RES ($DIFF ms)"
fi
if [[ $RES=="OK" ]]; then
SUCCESS_TESTS+=($test)
fi
else
echo "[TEST $test] DIFF FAIL($DIFF ms): vimdiff $build/$test.txt $test_dir/output.txt"
FAIL_TESTS+=($test)
fi
done
echo "==========="
echo "SUCCESSFUL: ${SUCCESS_TESTS[@]}"
echo "FAIL: ${FAIL_TESTS[@]}"
. $SCRIPTDIR/../openmp_run.inc
Loading