Skip to content

Commit b2eb685

Browse files
committed
2 parents eea01a1 + aa486ba commit b2eb685

File tree

3 files changed

+55
-5
lines changed

3 files changed

+55
-5
lines changed

build.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,5 +383,7 @@ def main(build, list_builds, _auto_push):
383383

384384
build_kernel('vendor/ngc-rapids', '0.5-rapids-py3')
385385

386+
build_kernel('vendor/ngc-matlab', 'r2019b')
387+
386388
if __name__ == '__main__':
387389
main()

vendor/ngc-matlab/Dockerfile renamed to vendor/ngc-matlab/Dockerfile.r2019b

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ FROM nvcr.io/partners/matlab:r2019b
22

33
ENV PYTHONUNBUFFERED=1 \
44
LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64" \
5-
PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH \
6-
LIBRARY_PATH="/usr/local/cuda/lib64/stubs" \
5+
PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
76
LANG=C.UTF-8
87

98
# Backend.AI specifics
9+
USER root
10+
1011
COPY policy.yml /etc/backend.ai/jail/policy.yml
1112
LABEL ai.backend.kernelspec="1" \
1213
ai.backend.envs.corecount="OPENBLAS_NUM_THREADS,OMP_NUM_THREADS,NPROC" \
@@ -18,9 +19,11 @@ LABEL ai.backend.kernelspec="1" \
1819
ai.backend.resource.min.cuda.device=1 \
1920
ai.backend.resource.min.cuda.shares=0.1 \
2021
ai.backend.base-distro="ubuntu16.04" \
21-
ai.backend.runtime-type="matlab" \
22-
ai.backend.runtime-path="/usr/local/bin/matlab" \
23-
ai.backend.service-ports="vnc:tcp:5901,matlab:http:6080"
22+
ai.backend.runtime-type="vendor.ngc_matlab" \
23+
ai.backend.runtime-path="/usr/bin/python" \
24+
ai.backend.service-ports="vnc-web:http:6080"
25+
26+
COPY bootstrap.sh /opt/container/bootstrap.sh
2427

2528
WORKDIR /home/work
2629
# vim: ft=dockerfile

vendor/ngc-matlab/bootstrap.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#! /bin/sh
2+
# reference: /bin/run.sh
3+
4+
echo ">> Setting up MATLAB environment"
5+
export USAGE=cloud
6+
export VARIANTmatlab=matlabLNU
7+
8+
mkdir -p /home/work/Desktop
9+
cat >/home/work/Desktop/MATLAB.desktop <<EOF
10+
[Desktop Entry]
11+
Version=1.0
12+
Type=Application
13+
Name=MATLAB R2019b
14+
Comment=
15+
Exec=/opt/matlab/R2019b/bin/matlab
16+
Icon=/opt/matlab/R2019b/bin/glnxa64/cef_resources/matlab_icon.png
17+
Path=
18+
Terminal=true
19+
StartupNotify=false
20+
Path=/home/matlab/Documents/MATLAB
21+
EOF
22+
chmod +x /home/work/Desktop/MATLAB.desktop
23+
24+
echo ">> Setting up noVNC auto-connection"
25+
rm /opt/noVNC/index.html
26+
ln -s /opt/noVNC/redirect.html /opt/noVNC/index.html
27+
28+
rm -rf /tmp/.X*
29+
30+
echo ">> Starting background VNC server"
31+
printf "backendai\nbackendai\n\n" | /opt/kernel/su-exec $LOCAL_USER_ID:$LOCAL_GROUP_ID vncpasswd >/dev/null 2>&1
32+
33+
cp -R /home/matlab/.config /home/work
34+
cp -R /home/matlab/Documents /home/work
35+
cp /home/matlab/.vnc/xstartup /home/work/.vnc/xstartup
36+
chown -R $LOCAL_USER_ID:$LOCAL_GROUP_ID /home/work
37+
/opt/kernel/su-exec $LOCAL_USER_ID:$LOCAL_GROUP_ID /usr/bin/vncserver -geometry 1600x1200
38+
cat >/home/work/.xscreensaver <<EOF
39+
mode: off
40+
EOF
41+
42+
echo ">> VNC server is started."
43+
44+
# The next line is executed by the kernel runner's service port handler.
45+
# "$SUEXEC" /opt/noVNC/utils/launch.sh --listen 6080 --vnc localhost:5901 > /dev/null 2>&1 &

0 commit comments

Comments
 (0)