Python on HPC(High Performance Computing)

HPC 上设置python
(详见https://www.stat.wisc.edu/services/hpc-cluster1/users-guide-software-paths)

简单操作

(第二次进入就只需要加粗的地方)

  1. module avail看哪些软件模块可用

  2. module load python/python3.6.4加载模块

  3. which python确认路径(/workspace/software/python-3.6.4/bin/python)
    (Python比较特殊,最好在自己的workspace中建立环境后用anaconda或者miniconda:)

  4. module load python/anaconda
    (Anaconda includes all python packages. There are many, so using anaconda will be large and have lots of extra packages you won’t need, however, it will have all the common things you’re looking for such as numpy, scipy, scikit-learn, etc. Miniconda is essentially an empty environment and you tell it which packages to include.)

  5. which python确认路径(/workspace/software/anaconda3/bin/python)

  6. conda create -p /workspace/NETID/myEnvironment anaconda

  7. source activate /workspace/NETID/myEnvironment (进入环境)

  8. python (直接运行)

  9. conda deactivate / source deactivate(退出环境)

python的sh文件内容

(详见http://www.stat.wisc.edu/services/hpc-cluster1/users-guide-tutorials的python部分)

#!/bin/bash                                                                       
#SBATCH --mail-user=NETID@stat.wisc.edu                                       
#SBATCH --mail-type=ALL                                                           
#SBATCH -p long                                                                   
#SBATCH -J compare                                                                
#SBATCH -t 70:00:00                                                               
#SBATCH --cpus-per-task=40                                                        
#SBATCH -n 1                                                                      
#SBATCH --mem-per-cpu=2500M     
                                                  
module load python/anaconda
source activate /workspace/NETID/myEnvironment
python compare.py
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值