Skip to content

Commit 2bbd4cd

Browse files
authored
add pareval script to handle running all pareval tasks (#49)
1 parent 9c15d30 commit 2bbd4cd

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

bin/pareval

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/bin/bash
2+
# Wrapper script to run the components of ParEval.
3+
# It can be run as:
4+
# pareval <command> [options]
5+
#
6+
# Commands:
7+
# generate - Generate LLM outputs for ParEval. See generate/generate.py for full argument list.
8+
# evaluate - Evaluate LLM outputs for ParEval. See evaluate/evaluate.py for full argument list.
9+
# help | -h | --help - Show a help message.
10+
# version | -v | --version - Show the version of ParEval.
11+
12+
VERSION="v1.1"
13+
14+
if [[ "$#" -eq 0 ]]; then
15+
echo "No command provided. Use 'pareval help' for usage information."
16+
exit 1
17+
fi
18+
19+
command="$1"
20+
shift
21+
22+
MODE=""
23+
case "$command" in
24+
generate)
25+
MODE="generate"
26+
;;
27+
evaluate)
28+
MODE="evaluate"
29+
;;
30+
help | -h | --help)
31+
echo "ParEval - A framework for evaluating LLMs on parallel code generation tasks."
32+
echo "Usage: pareval <command> [options]"
33+
echo ""
34+
echo "Commands:"
35+
echo " generate Generate LLM outputs for ParEval. See generate/generate.py for full argument list."
36+
echo " evaluate Evaluate LLM outputs for ParEval. See evaluate/evaluate.py for full argument list."
37+
echo " help Show this help message."
38+
echo " -h, --help Show this help message."
39+
echo " version Show the version of ParEval."
40+
echo " -v, --version Show the version of ParEval."
41+
echo ""
42+
echo "For detailed usage of each command, run 'pareval <command> --help'."
43+
echo ""
44+
echo "For more information, visit the ParEval GitHub repository: https://github.com/parallelcodefoundry/ParEval"
45+
echo ""
46+
exit 0
47+
;;
48+
version | -v | --version)
49+
echo "ParEval version: $VERSION"
50+
exit 0
51+
;;
52+
*)
53+
echo "Unknown command: $command. Use 'pareval help' for usage information."
54+
exit 1
55+
;;
56+
esac
57+
58+
# check that mode is valid
59+
if [[ "$MODE" != "generate" && "$MODE" != "evaluate" ]]; then
60+
echo "Invalid mode: $MODE. Use 'pareval help' for usage information."
61+
exit 1
62+
fi
63+
64+
# generate mode
65+
if [[ "$MODE" == "generate" ]]; then
66+
# Check if the generate script exists
67+
if [[ ! -f "generate/generate.py" ]]; then
68+
echo "Error: generate script not found. Please ensure you are in the correct directory."
69+
exit 1
70+
fi
71+
72+
python generate/generate.py "$@"
73+
fi
74+
75+
# evaluate mode
76+
if [[ "$MODE" == "evaluate" ]]; then
77+
# Check if the evaluate script exists
78+
if [[ ! -f "drivers/run-all.py" ]]; then
79+
echo "Error: evaluate script not found. Please ensure you are in the correct directory."
80+
exit 1
81+
fi
82+
83+
python3 drivers/run-all.py "$@"
84+
fi

0 commit comments

Comments
 (0)