Open eustomaqua opened 19 hours ago
Singularity 内配置
Singularity> ls
miniconda3
Singularity> conda list
Singularity> conda env list
Singularity> source activate fmpar
(fmpar) Singularity> pip list
(fmpar) Singularity> pip install fairgbm # 0.9.14
(fmpar) Singularity> pip install lightgbm # 4.5.0
(fmpar) Singularity> pip install matplotlib seaborn # 3.9.3 # 0.13.2
(fmpar) Singularity> python
Python 3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fairgbm
>>> import lightgbm
>>> import numpy as np
>>> clf = fairgbm.FairGBMClassifier(n_estimators=7, constraint_type='FNR')
>>> X = np.random.rand(100, 4)
>>> y = np.random.randint(4, size=100)
>>> s = np.random.randint(2, size=100)
>>> clf.fit(X, y, constraint_group=s)
FairGBMClassifier(constraint_type='FNR', n_estimators=7)
>>> z = clf.predict(X)
>>> ans = (z==y).mean()
>>> ans
np.float64(0.52)
>>>
[1]+ Stopped python
(fmpar) Singularity> source deactivate
DeprecationWarning: 'source deactivate' is deprecated. Use 'conda deactivate'.
(/home/qgl539/Software/miniconda3) Singularity> exit
exit
There are stopped jobs.
(/home/qgl539/Software/miniconda3) Singularity> exit
exit
(base) [qgl539@hendrixgate03fl Singdocker]$
(base) [qgl539@hendrixgate03fl ~]$ screen -r
There are several suitable screens on:
2245933.pts-3.hendrixgate03fl (Detached)
2245734.pts-3.hendrixgate03fl (Detached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.
(base) [qgl539@hendrixgate03fl ~]$
(base) [qgl539@hendrixgate03fl ~]$ srun -p gpu --pty --time=4-00:00:00 --gres gpu:0 bash
srun: job 5292 queued and waiting for resources
srun: job 5292 has been allocated resources
(base) [qgl539@hendrixgpu17fl ~]$
以下废弃
$ singularity build --sandbox molspin library://library/default/ubuntu
$ singularity build --sandbox ubuntu2004/ docker://homebrew/ubuntu2004
$ singularity shell --writable ubuntu2004
$ singularity delete ubuntu2004
$ yes | rm -r ubuntu2004
singularity sif del <descriptorid> <containerfile> [flags]
singularity pull build区别 http://www.achelous.org/Container-Tech/Singularity-in-nutshell.html singularity 使用ubuntu anaconda https://sheng.geovbox.com/singularity/ https://hpc.pku.edu.cn/ug/guide/soft/singularity/
singularity container使用 https://hpc.cloud/d/252-singularity https://blog.csdn.net/lovebaby1689/article/details/124518443 singularity 删除 sif https://docs.sylabs.io/guides/3.2/user-guide/cli/singularity_sif_del.html https://cloud.tencent.com/developer/article/2322738 singularity 删除本地沙盒 https://hpc-help.jengcloud.com/docs/shanhe2/shanhe2-1ej659l63ii1i https://hpclib.com/hpc/soft/Singularity.html#help https://www.smooth-sysu.cn/software/singularity.html https://cloud.tencent.com/developer/article/2407661
本地和服务器 环境重置等同
Locally macOS
$ cd GitHubLab/ResearchWork
$ source activate ensem|fmpar|mcenn
$ pip list > reqs_ensem|fmpar|mcenn.txt
$ conda deactivate
$ conda remove -n ensem|fmpar|mcenn --all
$ conda create -n ensem python=3.8
$ conda create -n fpmar python=3.11
$ conda env list
Server clusters
$ module load miniconda/4.12.0
$ conda env list
[qgl539@hendrixgpu12fl ~]$ conda env list
# conda environments:
#
ensem /home/qgl539/.conda/envs/ensem
fmpar /home/qgl539/.conda/envs/fmpar
[qgl539@hendrixgpu12fl ~]$ conda env list
本地和服务器 环境重置等同 cont.
$ # conda activate ensem
$ pip install numpy==1.24.4 numba==0.58.1
$ pip install pathos==0.3.1
$ pip install scipy==1.10.1
$ pip install pandas==2.0.3 scikit-learn==1.3.0
$ pip install matplotlib==3.7.2 seaborn==0.12.2 pytest==7.4.0
$ pip install lightgbm==4.0.0 fairgbm==0.9.14
$ # pip install carbontracker==1.2.5
$ pip install openpyxl==3.1.2
$ pip install torch==2.3.0
$ pip install tqdm==4.66.4
$ pip install pyro-ppl==1.9.0
$ # conda activate fmpar
$ pip install numpy==2.0.2 numba==0.60.0
$ pip install pathos==0.3.3
$ pip install scipy==1.14.1
$ pip install pandas==2.2.2 scikit-learn==1.5.1
$ pip install matplotlib==3.9.3 seaborn==0.13.2 pytest==8.3.4
$ pip install lightgbm==4.5.0 fairgbm==0.9.14
$ # pip install carbontracker==2.0.1
Singularity 环境
$ cd Singdocker
$ singularity shell --writable miniconda3
Singularity> conda env list
Singularity> conda create -n ensem python=3.8
Singularity> source activate ensem
(ensem) Singularity> pip install ..
(ensem) Singularity> conda deactivate
Singularity> conda create -n fmpar python=3.11
Singularity> source activate fmpar
(fmpar) Singularity> pip list
(fmpar) Singularity> pip install ..
(fmpar) Singularity> conda deactivate
Singularity> exit
exit
$ singularity build enfair.sif miniconda3/ # ensfair, minifmpar
$ ssh hendrix
$ screen # screen -r
$ srun -p gpu --pty --time=4-00:00:00 --gres gpu:0 bash
$ # module load singularity
$ # singularity run enfair.sif
$ singularity shell enfair.sif
$ singularity instance list
$ python -m pytest tests
$ python -m pytest tests/fair
$ python -m pytest
之前的
$ ssh hendrix
$ # module load miniconda/4.12.0
$ module load singularity
$ mkdir Singdocker && cd Singdocker
$ singularity build --sandbox miniconda3 docker://continuumio/miniconda3
$ yes | rm -r ResearchWork
$ du -h --max-depth 2
$ stat <.-file-name>
[qgl539@hendrixgpu12fl Singdocker]
Docker on macOS
$ docker ps # -a
$ docker pull continuumio/miniconda3
$ docker run -it continuumio/miniconda3 /bin/bash
$ docker exec -it <container-id> /bin/bash
$ docker stop <container-id>
# cd home
# conda env list
conda environments:
base /home/miniconda3
ensem /home/miniconda3/envs/ensem
# source activate ensem
# pip list > reqs_docker_ensem.txt
# exit
$ docker cp <container-id>:/home/reqs_docker_ensem.txt ~/GitHubLab/ResearchWork/docs/
Successfully copied 4.61kB to /Users/elise/GitHubLab/ResearchWork/docs/
$ docker cp ~/ <tmp-id>:/home/ResearchWork
$ docker cp <tmp-id>:/home/ResearchWork ~/RW
$ docker --version
$ docker restart <container-id>
$ docker rm <container-id> <tmp-id>
$ docker images rm <image-id> # docker rmi <image-id>
Singularity 沙盒 服务器 Slurm 集群