-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathlauncher.sh
More file actions
54 lines (43 loc) · 1.08 KB
/
launcher.sh
File metadata and controls
54 lines (43 loc) · 1.08 KB
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
#!/bin/bash
source "${0%/*}/launcher_lib.sh"
pre_launch
log "Args: $@"
PIDS=""
_PSI_J_PROCESS_COUNT="$1"
_PSI_J_NODE_COUNT="$2"
_PSI_J_PPN="$3"
shift 3
export _PSI_J_PROCESS_COUNT
export _PSI_J_NODE_COUNT
export _PSI_J_PPN
EXECUTABLE="$1"
shift
if [ "$EXECUTABLE" == "/bin/hostname" ]; then
EXECUTABLE="${0%/*}/hostname"
fi
log "Running stuff"
log "STDOUT: \"$_PSI_J_STDOUT\""
log "STDERR: \"$_PSI_J_STDERR\""
for NODE in $(seq 1 1 "$_PSI_J_NODE_COUNT"); do
log "Node: $NODE"
for NODE_PROC in $(seq 1 1 "$_PSI_J_PPN"); do
log "Node proc: $NODE_PROC"
INDEX=$(($NODE * $_PSI_J_PPN + $NODE_PROC))
log "Index: $INDEX"
_PSI_J_NODE_INDEX_=$NODE _PSI_J_PROCESS_INDEX_=$INDEX "$EXECUTABLE" "$@" 1>>"$_PSI_J_STDOUT" 2>>"$_PSI_J_STDERR" <"$_PSI_J_STDIN" &
PIDS="$PIDS $!"
done
done
for PID in $PIDS ; do
set +e
wait $PID
_PSI_J_EC=$?
set -e
if [ "$_PSI_J_EC" != "0" ]; then
log "Pid $PID failed with $_PSI_J_EC"
_PSI_J_FAILED_EC=$_PSI_J_EC
fi
done
log "All completed"
post_launch
exit $_PSI_J_FAILED_EC