php网站开发都需要什么软件,衡水做网站推广的公司,个人怎样注册一家公司,wordpress 统计小工具简单记一下hpc的使用#xff1a;
hpc就是一些科研机构或者大学建立的服务器中心。我这大学的每一位学生#xff0c;可以轻松使用hpc批量跑数据#xff0c;也可以新建自己的server跑一些local data#xff0c;后者每个学生账号最大是32核512G的运行内存#xff0c;体验非常…简单记一下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_wokers32) a executor:results list(tqdm(executor.map(f. this_iter), totallen(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_wokers32) a p:results list(tqdm(p.imap(f. this_iter), totallen(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_THREADS30
subjectcat /data/test/sublist | head -n${SGE_TASK_ID} | tail -n-1singularityDir/data/test
...
...