-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscriptCpu.sh
executable file
·96 lines (82 loc) · 1.94 KB
/
scriptCpu.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
#Use screen to launch script
# screen -S name // create new session
# screen -r name // attach to a session
# inside screen
# ./script 1> /dev/null 2> log.txt &
# CTRL + A then D // detach from screen session
make clean && make acocpu -j4
tspBase="tsp/"
tspArray=(
"bays29.tsp"
"d198.tsp"
"pcb442.tsp"
"rat783.tsp"
"pr1002.tsp"
"pcb1173.tsp"
"rl1889.tsp"
"pr2392.tsp"
"fl3795.tsp"
)
nThreads=(
0
1
2
4
8
16
32
64
128
)
for problem in "${tspArray[@]}"
do
echo $problem;
for i in "${nThreads[@]}"
do
for k in `seq 1 10`;
do
# ./acocpu file.tsp alpha beta q rho maxEpoch mapThreads farmThreads
./acocpu $tspBase$problem 1 2 1 0.5 10 $i $i
done
done
done
# PARALLEL AND SEQUENTIAL VERSION
# THERE IS THE ISSUE OF OVERLAPPING COUTs
# threadsParallel=(
# 0
# 1
# 2
# 4
# 8
# )
# threadsSequential=(
# 16
# 32
# 64
# 128
# )
# for problem in "${tspArray[@]}"
# do
# for i in "${threadsParallel[@]}"
# do
# for k in `seq 1 10`
# do
# # ./acocpu file.tsp alpha beta q rho maxEpoch mapThreads farmThreads
# ./acocpu $tspBase$problem 1 2 1 0.5 10 $i $i 1> "/dev/null" 2>> log.txt &
# pids[${i}]=$!
# done
# # wait for all pids
# for pid in ${pids[*]}; do
# wait $pid
# done
# done
# for i in "${threadsParallel[@]}"
# do
# for k in `seq 1 10`
# do
# # ./acocpu file.tsp alpha beta q rho maxEpoch mapThreads farmThreads
# ./acocpu $tspBase$problem 1 2 1 0.5 10 $i $i 1> "/dev/null" 2>> log.txt
# done
# done
# done