-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile_fable
184 lines (163 loc) · 7.8 KB
/
Dockerfile_fable
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# * How to build
# docker build -f Dockerfile_fable --build-arg SSH_KEY="$(cat ~/.ssh/id_ed25519)" -t mplapack:fable .
# * How to run
# sudo sh -c 'echo -1 >/proc/sys/kernel/perf_event_paranoid' # to run perf
# or
# sudo sysctl -w kernel.perf_event_paranoid=-1 # to run perf
# docker run --privileged --gpus all -it mplapack:fable /bin/bash
#
# https://hub.docker.com/r/nvidia/cuda/tags
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
#git setting
ARG GIT_EMAIL="[email protected]"
ARG GIT_NAME="NAKATA Maho"
LABEL maintainer="[email protected]"
ARG DEBIAN_FRONTEND=noninteractive
RUN apt -y update
RUN apt -y upgrade
RUN apt install -y sudo
RUN apt install -y tzdata
# set your timezone
ENV TZ Asia/Tokyo
RUN echo "${TZ}" > /etc/timezone \
&& rm /etc/localtime \
&& ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \
&& dpkg-reconfigure -f noninteractive tzdata
RUN apt install -y build-essential python3 gcc g++ gfortran
RUN apt install -y autotools-dev automake libtool libtool-bin gnuplot
RUN apt install -y gdb valgrind linux-tools-`uname -r` google-perftools linux-headers-`uname -r`
RUN apt install -y git wget ccache time parallel bc
RUN apt install -y pkg-config clangd clang-format unifdef octave
RUN apt install -y ng-common ng-cjk emacs-nox
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
### intel one api start ###
RUN wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
RUN apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
RUN echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
RUN apt update
RUN apt install -y intel-basekit
RUN apt install -y intel-hpckit
### intel one api end ###
### mingw start ###
RUN apt install -y mingw-w64 gfortran-mingw-w64 gdb-mingw-w64
RUN dpkg --add-architecture i386
RUN mkdir -pm755 /etc/apt/keyrings
RUN wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
RUN wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
RUN apt update -y
RUN apt install -y --install-recommends wine-stable
### mingw end ###
### cuda start ###
RUN apt install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" keyboard-configuration
RUN apt install -y cuda-drivers
### cuda end ###
ARG DOCKER_UID=1000
ARG DOCKER_USER=docker
ARG DOCKER_PASSWORD=docker
RUN useradd -u $DOCKER_UID -m $DOCKER_USER --shell /bin/bash && echo "$DOCKER_USER:$DOCKER_PASSWORD" | chpasswd && echo "$DOCKER_USER ALL=(ALL) ALL" >> /etc/sudoers
ARG WORK=/home/$DOCKER_USER
#install ctag
RUN cd ${WORK} && git clone https://github.com/universal-ctags/ctags.git
RUN cd ${WORK} && cd ctags && ./autogen.sh && ./configure --prefix=/usr/local && make && make install
USER docker
USER ${DOCKER_USER}
RUN echo "\n\
[user]\n\
email = ${GIT_EMAIL}\n\
name = ${GIT_NAME}\n\
" > /home/$DOCKER_USER/.gitconfig
SHELL ["/bin/bash", "-c"]
RUN cd ${WORK} && wget https://raw.githubusercontent.com/cctbx/cctbx_project/master/libtbx/auto_build/bootstrap.py --no-check-certificate
RUN cd ${WORK} && python bootstrap.py hot update --builder=cctbx
RUN cd ${WORK} && wget https://repo.anaconda.com/miniconda/Miniconda2-4.5.11-Linux-x86_64.sh
RUN cd ${WORK} && bash ./Miniconda2-4.5.11-Linux-x86_64.sh -b -p
RUN cd ${WORK} && source miniconda2/etc/profile.d/conda.sh && conda create -y --name fable38 python=3.8 && conda activate fable38 && conda install six future && mkdir build38 && cd ${WORK}/build38 && python ../modules/cctbx_project/libtbx/configure.py fable
RUN sed -i 's|#if PTHREAD_STACK_MIN > 0|#ifdef PTHREAD_STACK_MIN|g' ${WORK}/modules/boost/boost/thread/pthread/thread_data.hpp
RUN source ${WORK}/build38/setpaths.sh && cd ${WORK}/build38 && make && cd ${WORK} && cd ${WORK}/build38 && make ; cd ${WORK}
RUN cd ${WORK} && echo "source /home/docker/miniconda2/etc/profile.d/conda.sh" >> .bashrc
RUN cd ${WORK} && echo "conda activate fable38" >> .bashrc
RUN cd ${WORK} && echo "source /home/docker/build38/setpaths.sh" >> .bashrc
RUN echo -e "\n\
PROGRAM HELLO\n\
PRINT *, 'HELLO, WORLD!'\n\
END PROGRAM\n\
" >> ${WORK}/sample.f
#setting lsp mode for C++ https://emacs-lsp.github.io/lsp-mode/tutorials/CPP-guide/
RUN cd ${WORK} && mkdir -p .emacs.d
RUN echo -e "\n\
[user]\n\
email = ${GIT_EMAIL}\n\
name = ${GIT_NAME}\n\
" >> /home/$DOCKER_USER/.gitconfig
RUN echo -e "(require 'package)\n\
(add-to-list 'package-archives '(\"melpa\" . \"http://melpa.org/packages/\") t)\n\
(package-initialize)\n\
\n\
(setq package-selected-packages '(lsp-mode yasnippet lsp-treemacs helm-lsp\n\
projectile hydra flycheck company avy which-key helm-xref dap-mode))\n\
\n\
(when (cl-find-if-not #'package-installed-p package-selected-packages)\n\
(package-refresh-contents)\n\
(mapc #'package-install package-selected-packages))\n\
\n\
;; sample 'helm' configuration use https://github.com/emacs-helm/helm/ for details\n\
(helm-mode)\n\
(require 'helm-xref)\n\
(define-key global-map [remap find-file] #'helm-find-files)\n\
(define-key global-map [remap execute-extended-command] #'helm-M-x)\n\
(define-key global-map [remap switch-to-buffer] #'helm-mini)\n\
\n\
(which-key-mode)\n\
(add-hook 'c-mode-hook 'lsp)\n\
(add-hook 'c++-mode-hook 'lsp)\n\
\n\
(setq gc-cons-threshold (* 100 1024 1024)\n\
read-process-output-max (* 1024 1024)\n\
treemacs-space-between-root-nodes nil\n\
company-idle-delay 0.0\n\
company-minimum-prefix-length 1\n\
lsp-idle-delay 0.1) ;; clangd is fast\n\
\n\
(with-eval-after-load 'lsp-mode\n\
(add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration)\n\
(require 'dap-cpptools)\n\
(yas-global-mode))\n\
" >> ${WORK}/.emacs.d/init.el
RUN cd ${WORK} && echo "cd /home/$DOCKER_USER" >> .bashrc
RUN cd ${WORK} && echo 'eval "$(ssh-agent -s)"' >> .bashrc
RUN cd ${WORK} && echo 'ssh-add ~/.ssh/id_ed25519' >> .bashrc
## intel one api and wine settings start ###
RUN cd ${WORK} && echo "#source /opt/intel/oneapi/setvars.sh" >> .bashrc
RUN cd ${WORK} && echo "export WINEPATH=\"/usr/x86_64-w64-mingw32/lib/;/usr/lib/gcc/x86_64-w64-mingw32/10-win32/;/usr/lib/gcc/x86_64-w64-mingw32/10-posix;/home/$DOCKER_USER/MPLAPACK_MINGW/bin\"" >> .bashrc
RUN cd ${WORK} && echo "export PATH=\"$PATH:/opt/wine-stable/bin\"" >> .bashrc
RUN cd ${WORK} && echo "export WINEDEBUG=\"-all\"" >> .bashrc
## intel one api and wine settings end ###
### ssh ###
# Authorize SSH Host
RUN mkdir -p /home/$DOCKER_USER/.ssh && \
chmod 0700 /home/$DOCKER_USER/.ssh && \
ssh-keyscan github.com > /home/$DOCKER_USER/.ssh/known_hosts
# Add the keys and set permissions
ARG SSH_KEY
RUN echo "$SSH_KEY" > /home/$DOCKER_USER/.ssh/id_ed25519
RUN chmod 600 /home/$DOCKER_USER/.ssh/id_ed25519
RUN cd ${WORK} && git clone https://github.com/nakatamaho/libqd3.git
RUN cd ${WORK} && git clone https://github.com/nakatamaho/gmpfrxx.git
RUN cd ${WORK} && git clone https://github.com/nakatamaho/mplapack.git
RUN cd ${WORK}/mplapack && git remote set-url origin [email protected]:nakatamaho/mplapack.git
RUN cd ${WORK}/mplapack && git log -1
RUN cd ${WORK}/mplapack && bash -x misc/reconfig.ubuntu22.04.nvidia.sh
RUN cd ${WORK}/mplapack && make clean
RUN cd ${WORK}/mplapack && make -j`getconf _NPROCESSORS_ONLN`
RUN cd ${WORK}/mplapack && make install
ARG WINEPATH="/usr/x86_64-w64-mingw32/lib/;/usr/lib/gcc/x86_64-w64-mingw32/10-win32/;/usr/lib/gcc/x86_64-w64-mingw32/10-posix"
ARG WINEDEBUG="-all"
ENV PATH="$PATH:/opt/wine-stable/bin"
RUN cd ${WORK}/mplapack && bash -x misc/reconfig.ubuntu22.04.mingw64.sh
RUN cd ${WORK}/mplapack && make clean
RUN cd ${WORK}/mplapack && make -j`getconf _NPROCESSORS_ONLN`
RUN cd ${WORK}/mplapack && make install
RUN cd ${WORK}/mplapack && bash -x misc/reconfig.ubuntu22.04.sh
RUN cd ${WORK}/mplapack && make clean
RUN cd ${WORK}/mplapack && make -j`getconf _NPROCESSORS_ONLN`
RUN cd ${WORK}/mplapack && make install