-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.server
155 lines (125 loc) · 3.87 KB
/
README.server
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# How to configure a Basilisk server
~~~bash
sudo apt install task-spooler make gcc openmpi-bin libopenmpi-dev clang psmisc
~~~
Install the KDT library, [OpenGL utility libraries](gl/INSTALL) and
binaries in
~~~bash
$HOME/lib/libkdt.a
$HOME/lib/libglutils.a
$HOME/lib/libfb_osmesa.a
$HOME/include/kdt/kdt.h
$HOME/include/gl/framebuffer.h
$HOME/include/gl/utils.h
$HOME/include/gl/trackball.h
$HOME/include/gl/gl2ps/gl2ps.h
$HOME/bin/ppm2mpeg
$HOME/bin/ppm2mp4
$HOME/bin/ppm2gif
$HOME/bin/xyz2kdt
~~~
Append this to the start of `.bashrc`
~~~bash
# number of simultaneous Task Spooler jobs
export TS_SLOTS=8
# path to local binaries
export PATH=$PATH:/home/basilisk/bin
# workaround for openmpi warning message
export OMPI_MCA_btl=^openib
# allow oversubscribing
export OMPI_MCA_rmaps_base_oversubscribe=1
# howto compile C99 programs
export CC99="mpicc -O2 -Wall -fno-diagnostics-show-caret -Wno-unused-result -std=c99 -D_XOPEN_SOURCE=700 -DHAVE_GETOPT_H=1 -D_GNU_SOURCE=1"
# howto compile CADNA programs
export CADNACC="clang -D_CADNA=1 -x c++ -m64 \
-Wno-unused-function \
-Wno-unused-result \
-Wno-c++11-compat-deprecated-writable-strings \
-Wno-address-of-array-temporary"
# OpenGL libraries
export OPENGLIBS="-lfb_tiny"
# howto kill tests
killtest()
{
chksum=$1
if test -z "$chksum"; then
return 1
fi
if [[ -x /tmp/$chksum/$chksum ]]; then
# running
sudo -n -u basilisk-untrusted -- killall /tmp/$chksum/$chksum
else
# queued
id=$(tsp | sed "s/\([0-9]*\) queued .*$chksum\.sh/\1/;t;d")
if [[ -n "$id" ]]; then
tsp -r $id
fi
fi
rm -r -f ./$chksum*
sudo -n -u basilisk-untrusted -- rm -r -f /tmp/$chksum*
}
statustest()
{
chksum=$1
if [[ -x /tmp/$chksum/$chksum ]]; then
echo -n "The code is running.";
if [[ -s /tmp/$chksum/progress ]]; then
echo -n " "
tr '\r' '\n' < /tmp/$chksum/progress | tail -n 1
else
echo
fi
else
echo "The code is waiting to run.";
fi
}
~~~
If you also intend to generate graphics etc... on the server, do
~~~bash
sudo apt-get install gnuplot gnuplot-nox imagemagick ffmpeg smpeg-plaympeg graphviz valgrind gifsicle libglu1-mesa-dev libosmesa6-dev
~~~
## Creating the untrusted user
~~~bash
sudo -s
cat <<EOF > /etc/sudoers.d/basilisk
basilisk ALL=(basilisk-untrusted) NOPASSWD: ALL
EOF
chmod 0440 /etc/sudoers.d/basilisk
useradd basilisk-untrusted -d /nonexistent -s /bin/bash
service sudo restart
~~~
## Using the server
You first need to allow the client to connect to the server through
SSH. This implies adding the SSH public key of the client account to
the "authorized keys" on the server.
You can then do (on the client), something like:
~~~bash
[email protected] make simulation.tst
~~~
You should then get
~~~bash
qcc -g -O2 -g -Wall -o simulation/simulation simulation.c -lm
[simulation.tst on [email protected] (12725)]
running...
~~~
If you then do `ls simulation/*pid*`, you will see two files:
*pid.tst* and *tspid.tst*, they contain the PID of the process running
on the client and on the server respectively. When the simulation
completes on the server, data are copied to the client, both processes
terminate and these `*pid*` files are removed.
If you modify your simulation and redo `make` as above, before the old
simulation has completed, the old processes will be killed and only
the new simulation will run on the server.
The status of the completed simulation is indicated by either an
(empty) *pass* file (in the simulation directory), or a *fail* file
containing the error messages.
### Allowing shared SSH connections
On the client, it is a good idea to enable [shared SSH
connections](https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Multiplexing)
using something like (in `.ssh/config`):
~~~bash
Host server.domain.net
ControlPath ~/.ssh/controlmasters/%r@%h:%p
ControlMaster auto
ControlPersist 10m
~~~