-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·43 lines (40 loc) · 1.93 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
filename="${2:-"Fib"}"
runCProgram="${3:-"f"}"
numberOfRuns="${4:-"1"}"
sudo rm powerjoular.*
sudo gcc c_progs/"$2".c -o c_progs/"$2"
sudo gcc OrchestratorC.c -o OrchestratorC
javac -XDignore.symbol.file -cp /home/afonso/Documents/EnergyAwareProgramming/parser/lib/spoon-core-11.1.1-beta-18-jar-with-dependencies.jar -d out parser/src/OperatorExtractor.java parser/src/ASTFeatureExtractor.java java_progs/aux/WritePid.java Runner.java
if [ "$1" == "j" ]; then
sudo java -cp /home/afonso/Documents/EnergyAwareProgramming/parser/lib/spoon-core-11.1.1-beta-18-jar-with-dependencies.jar:/home/afonso/Documents/EnergyAwareProgramming/parser/lib/slf4j-simple-2.0.16.jar:out Runner $filename $runCProgram $numberOfRuns
elif [ "$1" == "p" ]; then
sudo python3 Pyrun.py $filename $runCProgram $numberOfRuns
elif [ "$1" == "b" ]; then
sudo ./OrchestratorBash.sh $filename $runCProgram $numberOfRuns
elif [ "$1" == "t" ]; then
search_dir=java_progs/progs
for entry in "$search_dir"/*
do
removed_prefix=${entry#*java_progs/progs/}
removed_suffix=${removed_prefix%.java*}
#echo "$removed_suffix"
sudo java -cp /home/afonso/Documents/EnergyAwareProgramming/parser/lib/spoon-core-11.1.1-beta-18-jar-with-dependencies.jar:/home/afonso/Documents/EnergyAwareProgramming/parser/lib/slf4j-simple-2.0.16.jar:out Runner $removed_suffix $runCProgram $numberOfRuns
done
elif [ "$1" == "c" ]; then
if [ "$3" == "f" ]; then
runCProgram=0
elif [ "$3" == "t" ]; then
runCProgram=1
fi
sudo ./OrchestratorC $filename $runCProgram $numberOfRuns
else
# If neither "j" nor "p" is provided, display a usage message
echo "Usage: $0 [j|p|c|b] [file name] [optional t to run c program or f to run Java program] [optional run n times]"
echo "j - Use Java orchestrator"
echo "p - Use Python orchestrator"
echo "c - Use C orchestrator"
echo "b - Use Bash orchestrator"
fi
sudo rm powerjoular.*
sudo rm tmp/*