# DeepBSA 流程

记录一下我装 DeepBSA 的流程。

首先想尝试使用 singularity 镜像,就还是使用了 miniconda3_base.sif 的镜像。

使用 yaml 去装:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
name: deepbsa
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- defaults
dependencies:
- python=3.10
- R=4.2.0
- pandas
- matplotlib
- statsmodels==0.13.2
- tensorflow==2.10.0
- tqdm

装上了,封装镜像,可以跑,就上传 HPC,但是!tensorflow 不能识别 GPU!!!

尝试使用 singularity --nv 选项,在 HPC 的 GPU 节点试一试。

1
singularity shell --nv deepbsa.sif

还是不行!后来差点就直接用 CPU 跑了,这个速度实在感人。

过了一晚上,炸裂的心态得到了回复。想着直接用 conda 装好了,正常配置环节,cudatoolkit,cudnn,tensorflow-gpu 一通安装。

结果 tensorflow-gpu 不能识别 cuda。这时候就很懵逼了,毕竟刚用 conda 装的。直到我看到了这样一个帖子,GPU enabled TensorFlow builds on conda-forge | conda-forge | community-driven packaging for conda

When installing the tensorflow package, the package resolution will now default to the GPU-enabled builds of tensorflow if the local machine has a GPU (these builds can be identified by “cuda” at the beginning of the version number). Note that GPU-enabled packages can also work on CPU-only machines, but one would need to override the enviornment variable CONDA_OVERRIDE_CUDA like below. This could be handy if you are in a situation where your current node (e.g. login node) on an HPC does not have GPUs, but the compute nodes with GPUs do not have internet access.

这… 就很神奇了,按照方法改了一下环境变量。

1
2
3
4
CONDA_OVERRIDE_CUDA="11.2" mamba install -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge \
-c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main \
-c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda \
-c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r tensorflower-gpu

然后就成了,后面再手动安装每个包。

然后就可以用了。

现在怀疑:

  1. singularity 没有按照这个流程装,所以镜像里面的 tf2 不能识别 GPU

下次有空再试一试。