-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbash_software.sh
56 lines (43 loc) · 1.72 KB
/
bash_software.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
# Philipp Bucher, part of "bash scripts"
alias git_master_merges='git log --first-parent master --pretty=format:"%H %<(10,trunc)%an %<(15)%ar %s"'
gitDeleteAllOtherBranches() {
git branch -D `git branch | grep -v \* | xargs`
}
export OMP_NUM_THREADS=2 # setting the number of OMP threads to one on shell startup
ompsetthreads() {
if [[ $# = 0 ]]; then
export OMP_NUM_THREADS=1 && echo "No input, setting 1 thread"
else
export OMP_NUM_THREADS=$1 && echo "Set $1 OpenMP thread"
fi
}
export -f ompsetthreads
alias ompgetthreads='echo "Using $OMP_NUM_THREADS OpenMP threads"'
runvalgrind() {
local valgrind_options="--leak-check=full --show-leak-kinds=all --track-origins=yes"
eval local valgrind_out_file="valgrindout_$1.log"
echo "===== VALGRIND ====="
echo "Command: $1"
echo "with options: $valgrind_options"
echo "Valgrind output written to \"$valgrind_out_file\""
sleep 0.3
valgrind $valgrind_options ./$1 "${@:2}" 2> $valgrind_out_file # passing all the arguments
}
gdbmpipython3() {
if [[ $# < 2 ]]; then
echo "At least inputfile and number of processes have to be given"
return 1
else
if ! [[ $2 =~ ^[0-9]+$ ]] # checking if the second argument is an integer
then
throwerror "the second argument has to be the number of processes"
fi
echo "===== gdb python3 mpi execution ====="
echo "with $2 processes"
local omp_num_threads=$OMP_NUM_THREADS
export OMP_NUM_THREADS=1
mpiexec -np $2 xterm -hold -fa 'Monospace' -fs 12 -e gdb -ex run --args python3 $1 "${@:3}" # passing all the arguments
export OMP_NUM_THREADS=$omp_num_threads
fi
}
export -f gdbmpipython3