Skip to content

Commit fdf98e6

Browse files
committed
Merge branch 'master' of github.com:lablup/backend.ai-kernels
2 parents 97df9f2 + eaa401a commit fdf98e6

File tree

6 files changed

+167
-0
lines changed

6 files changed

+167
-0
lines changed

julia/Dockerfile.1.8-ubuntu20.04

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
FROM ubuntu:20.04
2+
# Ubuntu 20.04 comes with Python 3.8
3+
ENV DEBIAN_FRONTEND noninteractive
4+
RUN apt-get update && \
5+
apt-get install -y \
6+
ca-certificates \
7+
wget curl git-core \
8+
vim-tiny zip unzip \
9+
python3 python3-pip \
10+
libssl-dev \
11+
libmpdec2 \
12+
proj-bin libproj-dev \
13+
libgeos-dev libgeos++-dev \
14+
mime-support \
15+
gcc g++ \
16+
cmake \
17+
ncurses-term && \
18+
apt-get clean && \
19+
rm -rf /var/lib/apt/lists/
20+
21+
RUN ln -sf /usr/share/terminfo/x/xterm-color /usr/share/terminfo/x/xterm-256color
22+
23+
ENV PYTHONUNBUFFERED=1 \
24+
PATH=/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
25+
LANG=C.UTF-8
26+
27+
RUN curl https://bootstrap.pypa.io/get-pip.py | python3 && \
28+
python3 -m pip install --no-cache-dir -U setuptools && \
29+
python3 -m pip install --no-cache-dir h5py && \
30+
python3 -m pip install --no-cache-dir Cython && \
31+
python3 -m pip install --no-cache-dir matplotlib bokeh && \
32+
python3 -m pip install --no-cache-dir versioneer && \
33+
python3 -m pip install --no-cache-dir pyproj cartopy==0.19.0.post1 && \
34+
python3 -m pip install --no-cache-dir pandas && \
35+
python3 -m pip install --no-cache-dir seaborn && \
36+
python3 -m pip install --no-cache-dir pillow && \
37+
python3 -m pip install --no-cache-dir networkx cvxpy && \
38+
python3 -m pip install --no-cache-dir scikit-learn scikit-image && \
39+
python3 -m pip install --no-cache-dir pygments && \
40+
python3 -m pip install --no-cache-dir ipython && \
41+
python3 -m pip install --no-cache-dir jupyter && \
42+
python3 -m pip install --no-cache-dir jupyterlab && \
43+
rm -rf /root/.cache && \
44+
rm -f /tmp/*.whl
45+
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 2
46+
47+
# Install jupyter & Julia
48+
ARG JULIA_VERSION
49+
ENV JULIA_VERSION ${JULIA_VERSION:-1.8.5}
50+
ARG JULIA_MAJOR_VERSION
51+
ENV JULIA_MAJOR_VERSION ${JULIA_MAJOR_VERSION:-1.8}
52+
ENV JULIA_PATH "/usr/local/julia"
53+
ENV PATH $JULIA_PATH:$JULIA_PATH/bin:$PATH
54+
55+
RUN dpkgArch="$(dpkg --print-architecture)"; \
56+
case "${dpkgArch##*-}" in \
57+
amd64) tarArch='x86_64'; dirArch='x64';; \
58+
armhf) tarArch='arm'; dirArch='arm';; \
59+
arm64) tarArch='aarch64'; dirArch='aarch64';; \
60+
i386) tarArch='i686'; dirArch='x86';; \
61+
*) echo >&2 "error: current architecture ($dpkgArch) does not have a corresponding Julia binary release"; exit 1 ;; \
62+
esac; \
63+
\
64+
curl -fL -o julia.tar.gz "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${JULIA_VERSION%[.-]*}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz"; \
65+
\
66+
mkdir "$JULIA_PATH"; \
67+
tar -xzf julia.tar.gz -C "$JULIA_PATH" --strip-components 1; \
68+
rm julia.tar.gz
69+
70+
#add IJulia package to make Julia kernel available in jupyter
71+
ENV JULIA_PKG_LOC /opt/julia
72+
ENV JULIA_LOAD_PATH :/opt/julia
73+
ENV JULIA_DEPOT_PATH /opt/julia
74+
RUN mkdir ${JULIA_PKG_LOC}
75+
RUN julia -e 'ENV["JUPYTER"]="jupyter"' && \
76+
julia -e 'ENV["PYTHON"]="python3"' && \
77+
julia -e 'ENV["JULIA_DEPOT_PATH"]="/opt/julia"' && \
78+
julia -e 'using Pkg; Pkg.add("IJulia");'
79+
80+
RUN julia -e 'using Pkg; Pkg.add("Plots"); using Plots;'
81+
RUN julia -e 'using Pkg; Pkg.add("DataFrames");' && \
82+
julia -e 'using Pkg; Pkg.add("RDatasets");' && \
83+
julia -e 'using Pkg; Pkg.add("PyPlot");' && \
84+
julia -e 'using Pkg; Pkg.add("CSV");' && \
85+
julia -e 'using Pkg; Pkg.add("Pandas"); using Pandas;'
86+
87+
SHELL ["/bin/bash", "-c"]
88+
RUN julia -e 'using IJulia' && \
89+
chmod -R 755 /opt/julia/compiled
90+
SHELL ["/bin/sh", "-c"]
91+
# Install ipython kernelspec
92+
COPY replace_placeholder.sh /etc/backend.ai/replace_placeholder.sh
93+
COPY kernel.json /usr/local/share/jupyter/kernels/julia-${JULIA_MAJOR_VERSION}/kernel.json
94+
RUN /etc/backend.ai/replace_placeholder.sh ${JULIA_MAJOR_VERSION} && \
95+
rm /etc/backend.ai/replace_placeholder.sh
96+
COPY logo-32x32.png /usr/local/share/jupyter/kernels/julia-${JULIA_MAJOR_VERSION}/logo-32x32.png
97+
COPY logo-64x64.png /usr/local/share/jupyter/kernels/julia-${JULIA_MAJOR_VERSION}/logo-64x64.png
98+
99+
# Backend.AI specifics
100+
LABEL ai.backend.kernelspec="1" \
101+
ai.backend.envs.corecount="OPENBLAS_NUM_THREADS,OMP_NUM_THREADS,NPROC" \
102+
ai.backend.features="batch query uid-match user-input" \
103+
ai.backend.resource.min.cpu="1" \
104+
ai.backend.resource.min.mem="1g" \
105+
ai.backend.base-distro="ubuntu20.04" \
106+
ai.backend.runtime-type="python" \
107+
ai.backend.runtime-path="/usr/bin/python3" \
108+
ai.backend.service-ports="ipython:pty:3000,jupyter:http:8070,jupyterlab:http:8090"
109+
COPY policy.yml /etc/backend.ai/jail/policy.yml
110+
ENV JULIA_DEPOT_PATH /home/work/.julia:/opt/julia
111+
ENV JULIA_PROJECT /home/work/.julia
112+
# vim: ft=dockerfile
113+

julia/kernel.flux.013.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"display_name": "FluxML 0.13 on Backend.AI",
3+
"argv": [
4+
"/usr/local/julia/bin/julia",
5+
"-i",
6+
"--startup-file=yes",
7+
"--color=yes",
8+
"/opt/julia/packages/IJulia/[PLACEHOLDER]/src/kernel.jl",
9+
"{connection_file}"
10+
],
11+
"language": "julia",
12+
"env": {}
13+
}

julia/kernel.flux.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"display_name": "FluxML 0.13 on Backend.AI",
3+
"argv": [
4+
"/usr/local/julia/bin/julia",
5+
"-i",
6+
"--startup-file=yes",
7+
"--color=yes",
8+
"/opt/julia/packages/IJulia/PLACEHOLDER/src/kernel.jl",
9+
"{connection_file}"
10+
],
11+
"language": "julia",
12+
"env": {}
13+
}

julia/kernel.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"display_name": "Julia 1.8 on Backend.AI",
3+
"argv": [
4+
"/usr/local/julia/bin/julia",
5+
"-i",
6+
"--startup-file=yes",
7+
"--color=yes",
8+
"/opt/julia/packages/IJulia/PLACEHOLDER/src/kernel.jl",
9+
"{connection_file}"
10+
],
11+
"language": "julia",
12+
"env": {}
13+
}

julia/replace_placeholder.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
path="/opt/julia/packages/IJulia"
3+
first_dir=$(ls -1 "$path" | head -1)
4+
if [ -z "$1" ]
5+
then
6+
version="1.5"
7+
else
8+
version=$1
9+
fi
10+
file="/usr/local/share/jupyter/kernels/julia-${version}/kernel.json"
11+
old_string="PLACEHOLDER"
12+
sed -i "s/$old_string/$first_dir/g" $file

python/Dockerfile.3.10-ubuntu20.04

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
6262
RUN python3.10 -m ipykernel install --display-name "Python 3.10 on Backend.AI" && \
6363
cat /usr/local/share/jupyter/kernels/python3/kernel.json
6464

65+
# Copy Backend.AI multi-node support
66+
COPY ./runner-scripts/bootstrap.sh runner-scripts/setup_multinode.py /opt/container/
67+
6568
# Backend.AI specifics
6669
COPY ./service-defs /etc/backend.ai/service-defs
6770
LABEL ai.backend.kernelspec="1" \

0 commit comments

Comments
 (0)