[log] `installer.py` 執行過程
===
###### tags: `Parabricks-v3.5`
###### tags: `基因體`, `NVIDIA`, `Clara`, `Parabricks`, `二級分析`
<br>
[TOC]
<br>
## 使用 sudo 的原因
### 原因1

> Please check you have permissions to create parabricks folder in /opt/parabricks
> Contact Parabricks-Support@nvidia.com for troubleshooting
Documentation can be found at https://docs.nvidia.com/clara/#parabricks
- 看起來,只是為了建立資料夾 `/opt/parabricks`
- 不加 sudo 可以這樣解決:
```
sudo chown $(id -u):$(id -g) /opt/parabricks/
```
### 原因2

> Could not create symlink /usr/bin/pbrun. Permission denied
- 到這一步已經算成功,可以測試下面指令:
```bash=
$ /opt/parabricks/pbrun
Please visit https://docs.nvidia.com/clara/#parabricks for detailed documentation
usage: pbrun <command> [<args>]
Help: pbrun -h
pbrun: error: the following arguments are required: command
```
- 看起來,只是為了建立全域 pbrun 指令 `/usr/bin/pbrun`
- 不加 sudo 可以這樣解決:
```
sudo ln -s /opt/parabricks/pbrun /usr/bin/pbrun
```
<br>
## sudo python3 ./parabricks/installer.py
```=
$ sudo python3 ./parabricks/installer.py
END USER LICENSE AGREEMENT FOR PARABRICKS SOFTWARE
This end user license agreement, including the exhibit attached ("Agreement”) is a legal agreement between you and
NVIDIA Corporation ("NVIDIA") and governs your use of the NVIDIA Parabricks software and materials (“SOFTWARE”).
If you are entering into this Agreement on behalf of a company or other legal entity, you represent that you have the
legal authority to bind the entity to this Agreement, in which case “you” will mean the entity you represent.
If you don’t have the required authority to accept this Agreement, or if you don’t accept all the terms and conditions
of this Agreement, do not download, install or use the SOFTWARE.
You agree to use the SOFTWARE only for purposes that are permitted by (a) this Agreement, and (b) any applicable law,
regulation or generally accepted practices or guidelines in the relevant jurisdictions.
1. License.
2. Limitations.
3. Ownership.
4. No Warranties.
5. Limitations of Liability.
6. Termination.
7. Data Collection.
8. General.
(v. March 18, 2020)
PARABRICKS SOFTWARE SERVICES SUPPLEMENT
1. Scope.
2. Services.
3. Exclusions.
4. Your Responsibilities.
5. Service Fees; Payment Terms.
6. Definitions.
(v. March 18, 2020)
Online link for EULA
https://www.nvidia.com/content/dam/en-zz/Solutions/Data-Center/healthcare-parabricks-end-user-license-agreement.pdf
The software can be used only with the above End User License Agreement stated above.
Proceed with installation? Type yes or no only: yes
====================================
Installing Parabricks
Final Selection:
Install Directory: /opt/parabricks
Install Version: v3.5.0
Install Container Type: docker
Install Architecture: x86_64
Container Path: nvcr.io
====================================
Are the above installation parameters correct?
Proceed with installation? Type yes or no only: yes
Do you want to create a symlink to /usr/bin/pbrun ?
Proceed with installation? Type yes or no only: yes
Checking curl installation
Checking docker installation
Checking if image is already present
Downloading image
v3.5.0: Pulling from nvidia/clara/clara-parabricks
f22ccc0b8772: Pull complete
3cf8fb62ba5f: Pull complete
e80c964ece6a: Pull complete
a0afc6a19124: Pull complete
18287e0c259e: Pull complete
88c0e0db918c: Pull complete
cfd3cd3c12f6: Pull complete
6b47103d2bfc: Pull complete
Digest: sha256:85f6130e45d27c06ffe10da05b442b27b2a3b5168cb7b48bcd31a70bf3cc5b3a
Status: Downloaded newer image for nvcr.io/nvidia/clara/clara-parabricks:v3.5.0
nvcr.io/nvidia/clara/clara-parabricks:v3.5.0
Installing image
/mnt/parabricks/parabricks
Sending build context to Docker daemon 5.12kB
Step 1/12 : FROM nvcr.io/nvidia/clara/clara-parabricks:v3.5.0
Step 2/12 : RUN rm -rf /var/lib/apt/lists/*
Step 3/12 : RUN apt update
Step 4/12 : RUN DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y libssl-dev
Step 5/12 : RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
Step 6/12 : RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
Step 7/12 : RUN pip3 install Cython matplotlib
Step 8/12 : RUN pip install wheel
Step 9/12 : RUN pip install matplotlib
Step 10/12 : COPY installMantaAndStrelka.sh /parabricks
Step 11/12 : RUN /parabricks/installMantaAndStrelka.sh
Step 12/12 : RUN cp /parabricks/starfusion_req/TiedHash.pm /etc/perl/
Successfully built da882a2f26c9
Successfully tagged parabricks/release:v3.5.0
Image Installation successful.
Copying Scripts
Installation successful
```
<br>
## /opt/parabricks/Dockerfile
```dockerfile==
FROM nvcr.io/nvidia/clara/clara-parabricks:v3.5.0
##Install needed packages
RUN rm -rf /var/lib/apt/lists/*
RUN apt update
RUN DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y libssl-dev libcurl4-openssl-dev python3.7 default-jre libboost-iostreams-dev libboost-iostreams-dev libboost-filesystem-dev libboost-system-dev python3-pip python3-setuptools python3.7-dev python2.7 python-pip gcc g++ python-setuptools python-dev perl cmake
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
RUN pip3 install Cython matplotlib
RUN pip install wheel
RUN pip install matplotlib
COPY installMantaAndStrelka.sh /parabricks
RUN /parabricks/installMantaAndStrelka.sh
RUN cp /parabricks/starfusion_req/TiedHash.pm /etc/perl/
```
<br>
## docker configs
### if docker-gpus?
```bash=
# result=0: docker-gpus
$ docker run --gpus all --rm nvidia/cuda:9.0-base-ubuntu16.04 nvidia-smi
Mon Jul 5 03:46:46 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 465.19.01 Driver Version: 465.19.01 CUDA Version: 11.3 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA Tesla P1... On | 00000001:00:00.0 Off | 0 |
| N/A 30C P0 26W / 250W | 0MiB / 16280MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
...
```
- config 檔案
```bash=
$ cat /opt/parabricks/config.txt
nvidia-gpus
x86_64
```
<br>
### else-if docker?
```bash=
# result=0: docker
$ docker run --rm nvidia/cuda:9.0-base-ubuntu16.04 nvidia-smi
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "nvidia-smi": executable file not found in $PATH: unknown.
```
- option: no `--gpus`
<br>
### else-if docker-runtime?
```bash=
# result=0: docker-runtime
docker run --runtime=nvidia --rm nvidia/cuda:9.0-base-ubuntu16.04 nvidia-smi
docker: Error response from daemon: Unknown runtime specified nvidia.
See 'docker run --help'.
```
- option: `--runtime=nvidia`
- 啟用方式 ([參考資料](https://ithelp.ithome.com.tw/articles/10205391))

```bash=
$ sudo apt-get install -y nvidia-docker2
$ sudo pkill -SIGHUP dockerd
```
```bash=
$ docker run --runtime=nvidia --rm nvidia/cuda:9.0-base-ubuntu16.04 nvidia-smi
Mon Jul 5 06:58:15 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 465.19.01 Driver Version: 465.19.01 CUDA Version: 11.3 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA Tesla P1... On | 00000001:00:00.0 Off | 0 |
| N/A 30C P0 26W / 250W | 0MiB / 16280MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
```
- config 檔案
```bash=
$ cat /opt/parabricks/config.txt
nvidia-docker
x86_64
```
<br>
### docker configs 小結論
- ### docker-gpus (適用性質: docker >= 19.03)
- 由 nvidia-container-toolkit 套件啟用
- docker run 配上 --gpus all
- ### docker
- 無法啟用
可能跟 `--cpu-only` 有關 (目前 --cpu-only 有問題)
- ### docker-runtime (適用性質: docker < 19.03) (20.10 以上亦 OK)
- 由 nvidia-docker2 套件啟用
- docker run 配上 --runtime=nvidia
<br>
<hr>
<br>
## 指令測試
```bash=
$ pbrun version
Please visit https://docs.nvidia.com/clara/#parabricks for detailed documentation
pbrun: v3.5.0
```
```bash=
$ pbrun licenseinfo
Please visit https://docs.nvidia.com/clara/#parabricks for detailed documentation
This feature is only available for GPU-based licenses.
Please visit https://docs.nvidia.com/clara/#parabricks for detailed documentation
Please contact Parabricks-Support@nvidia.com for any questions
There is a forum for Q&A as well at https://forums.developer.nvidia.com/c/healthcare/Parabricks/290
Exiting...
Could not run licenseinfo
Exiting pbrun ...
```
```
$ pbrun licenseinfo
Please visit https://docs.nvidia.com/clara/#parabricks for detailed documentation
This feature is only available for GPU-based licenses using nvidia-docker or docker with nvidia runtime.
```