当前位置: 首页 > news >正文

high perfermance computer usage

简单记一下hpc的使用:

hpc就是一些科研机构或者大学建立的服务器中心。我这大学的每一位学生,可以轻松使用hpc批量跑数据,也可以新建自己的server跑一些local data,后者每个学生账号最大是32核512G的运行内存,体验非常好,只不过只能使用jupyternote book或者R登录,也可以跑bash,总之非常nice。

新建自己的server跑jupyternote book就比较容易,例如:

from concurrent.futures import ProcessPoolExecutor
from tqdm import tqdm
# python
def my_func(x):return x**2
def run(f, this_iter):with ProcessPoolExecutor(max_wokers=32) a executor:results = list(tqdm(executor.map(f. this_iter), total=len(this_iter))return results
if name == '__main__':this_iter = [1,2,3,4,4,5,6]results = run(my_func, this_iter)# ipynb
from multiprocessing import Pool
from tqdm import tqdm
def my_func(x):return x**2
def run(f, this_iter):with Pool(max_wokers=32) a p:results = list(tqdm(p.imap(f. this_iter), total=len(this_iter))return results
if name == '__main__':this_iter = [1,2,3,4,4,5,6]results = run(my_func, this_iter)

两者区别就在于使用ProcessPoolExecutor 还是 Pool,还有map 和imap。其他都是一样的使用。
完全免费的32核512G云服务器,还可以加载2080Ti等显卡,我觉得这个科研资源算是非常好了,至少节省了自己2万左右资金。

第二个就是hpc节点的使用
hpc的集群节点主要是用来批量跑数据预处理,我主要是跑fmriprep和xcp-d。
首先是定义变量:

#!/bin/bash#$ -N sub-${subject}_fmriprep
#$ -pe smp 10
#$ -q UI
#$ -j y
#$ -o /Data/test/logs
#$ -t 1-29:1

这些是hpc的定义,例如-o表示output,-pe表示需求的核心数,-q是请求的节点端口等等。
然后可以自己自定义一些环境变量:

singularityDir=/Data/test
export TEMPLATEFLOW_HOME=${singularityDir}/TemplateFlow
export SINGULARITYENV_TEMPLATEFLOW_HOME=/templateflow

然后就可以使用fmriprep的脚本:

singularity run --cleanenv \
-B /Users/work:/work \
-B ${TEMPLATEFLOW_HOME:-$HOME/.cache/templateflow}:/templateflow \
${singularityDir}/fmriprep.sif \
/Data/test/BIDS/ /Data/test/fmriprep/ participant --participant-label ${subject} \
--skip_bids_validation \
--nprocs 8 --omp-nthreads 8 --mem 32000 \
-t rest \
-w work \
........
......

然后保存脚本,在服务器端口敲命令: qsub fmriprep_run.sh 即可。
可以用 qstat | grep ID 查看提交的作业是否正常在运行。
等运行结束以后,可以使用qacct -j {job_id} 查看fmriprep的运行过程。
以我这个为例,我的test脚本调用了8个核跑了一个被试,运行细节如下:
一个rest-state bold输出到2个空间,做体空间和皮层空间,cpu时间是84831s,最大内存是5.8G,运行时间是8小时30分钟。
一般来说,fmriprep只有几个步骤能跑满cpu,比如ants,还有一些步骤是跑不满的,所以假设同样8个被试,使用8个核心,一个一个跑,跟使用1个核心,8个一起跑,后者的时间应该是要短很多。
一种方法是,使用python脚本,建立Pool池,调用多个kernel,然后每个kernel去跑一个singularity。

## multiple subjects
#!/bin/bash
#$ -N sub-batchArray_fmriprep
#$ -pe smp 10
#$ -q PINC, CCOM, UI
#$ -j y
#$ -o /data/logs
#$ -t 1-27:1
OMP_NUM_THREADS=30
subject='cat /data/test/sublist | head -n+${SGE_TASK_ID} | tail -n-1'singularityDir=/data/test
...
...
http://www.lryc.cn/news/230262.html

相关文章:

  • 51单片机+DS1302设计一个电子钟(LCD1602显示时间)
  • vue项目中在scss代码中使用data中的变量
  • uni-app报错“本应用使用HBuilderX x.x.x 或对应的cli版本编译,而手机端SDK版本是x.x.x不匹配的版本可能造成应用异常”
  • [sd_scripts]之train
  • samba 共享目录write permission deny问题修复 可读取内容但不可修改 删除 新增文件
  • UDP主要丢包原因及具体问题分析
  • 647. 回文子串 516.最长回文子序列
  • 点云从入门到精通技术详解100篇-双传感器模式的非结构化环境检测与识别
  • Nginx-反向代理
  • Java封装一个根据指定的字段来获取子集的工具类
  • 【HUST】网安纳米|2023年研究生纳米技术考试参考
  • 【移远QuecPython】EC800M物联网开发板的MQTT协议腾讯云数据上报
  • 关灯游戏及扩展
  • 深度解析:用Python爬虫逆向破解dappradar的URL加密参数(最详细逆向实战教程,小白进阶高手之路)
  • 论文笔记:AttnMove: History Enhanced Trajectory Recovery via AttentionalNetwork
  • Django之视图层
  • DAY54 392.判断子序列 + 115.不同的子序列
  • 【Nginx】nginx | 微信小程序验证域名配置
  • 大数据Doris(二十二):数据查看导入
  • STM32 I2C详解
  • 软考 系统架构设计师系列知识点之云计算(1)
  • VS Code画流程图:draw.io插件
  • 计算机 - - - 浏览器网页打开本地exe程序,网页打开微信,网页打开迅雷
  • C_6练习题
  • XUbuntu22.04之安装pkg-config(一百九十二)
  • 【Proteus仿真】【51单片机】拔河游戏设计
  • 第3关:集合操作100
  • 八:ffmpeg命令提取像素格式和PCM数据
  • rinex3.04 导航文件
  • linux rsyslog日志采集格式设定二