# Course_useHPC **Repository Path**: ZhijunBioinf/Course_useHPC ## Basic Information - **Project Name**: Course_useHPC - **Description**: 生物信息系高性能计算集群 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: dzj - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-07-01 - **Last Updated**: 2023-09-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 生物信息高性能集群 ## 一、登录服务器 **说明:`$`后为命令,其他的为输出或说明。** 终端 Windows: Text terminal推荐[putty](https://the.earth.li/~sgtatham/putty/latest/w32/putty.exe), Xterm推荐使用[MobaXterm](https://mobaxterm.mobatek.net/download.html) Mac or Linux: 用自带终端直接登录。 登录服务器IP: 10.7.254.22 ```diff - 对于计算量较大的任务,请不要在登录节点上直接运行,以交互式方式qrsh登录到计算节点,或者用qsub提交任务 ``` ## 二、Linux基本操作 **掌握以下常用的Linux命令:** | | | | | | | | --- | --- | --- | --- | --- | --- | | ls | cd | mv | rm | pwd | top | | ps | grep | kill | file | tar | cat | | less | more | chmod | chown | vim (vi) | time | | cp | scp | ln | mkdir | wget | git | | find | export | source | mount | head | tail | ## 三、使用集群 尽量不要在登录节点(管理节点)上运行大型程序,集群已部署好SGE作业调度系统 **(一)交互式方式登录** 登录管理结点后,请用`qrsh`以交互式方式登录计算节点,系统会自动分配并登录到计算节点。一般普通的小的计算任务采取交互式方式登录 ```sh $ qstat job-ID prior name user state submit/start at queue slots ja-task-ID ----------------------------------------------------------------------------------------------------------------- 360 0.60500 P4b8da0fc1 wangys r 11/29/2018 15:12:48 all.q@cu05 4 364 0.60500 Pe5ba00728 wangys r 11/29/2018 15:12:48 all.q@cu03 4 366 0.60500 P42b37ecd2 wangys r 11/29/2018 15:12:48 all.q@cu01 4 370 0.60500 Pcf5d430df wangys r 11/29/2018 15:12:48 all.q@cu05 4 371 0.60500 P31028d02c wangys r 11/29/2018 15:12:48 all.q@cu01 4 374 0.60500 P3b88ad32c wangys r 11/29/2018 15:12:48 all.q@cu06 4 375 0.60500 Pdee72dde4 wangys r 11/29/2018 15:12:48 all.q@cu03 4 377 0.60500 P0c019e107 wangys r 11/29/2018 15:12:48 all.q@cu01 4 380 0.60500 P63cfc830b wangys r 11/29/2018 15:12:48 all.q@cu06 4 391 0.60500 P1aaabc6e3 wangys r 11/29/2018 15:12:48 all.q@cu04 4 392 0.60500 Pea85ae407 wangys r 11/29/2018 15:12:48 all.q@cu06 4 394 0.50500 QRLOGIN wangys r 11/30/2018 09:00:22 all.q@cu02 1 ``` 其中标记为QRLOGIN的便是刚才交互式登录的进程,可以看出系统自动分配到cu02节点上。 以交互式方式登录时,退出登录(logout命令)或关机后资源会被系统收回 **(二)用qsub递交批量任务** 较大的计算任务推荐使用SGE作业管理系统提交任务,先将任务脚本存放在一个文件中,然后用`qsub`提交任务,下面是一个简单的任务`work.sh`, 任务的脚本文件work.sh中包含以下内容: ```sh #!/bin/bash #$ -S /bin/bash #$ -N JobName #$ -cwd #$ -j y sleep 60 ``` **用`qsub`提交任务,`qstat`查看任务运行情况** ```sh $ qsub work.sh $ qstat job-ID prior name user state submit/start at queue slots ja-task-ID ----------------------------------------------------------------------------------------------------------------- 132 0.55500 P36f0869fb wangys r 11/29/2018 14:52:18 all.q@cu02 1 133 0.55500 JobName wangys r 11/29/2018 15:02:33 all.q@cu05 1 134 0.55500 JobName wangys r 11/29/2018 15:02:48 all.q@cu01 1 135 0.55500 JobName wangys r 11/29/2018 15:02:48 all.q@cu05 1 136 0.55500 JobName wangys t 11/29/2018 15:02:48 all.q@cu01 1 137 0.55500 JobName wangys r 11/29/2018 15:02:48 all.q@cu02 1 138 0.55500 JobName wangys t 11/29/2018 15:02:48 all.q@cu05 1 139 0.55500 JobName wangys r 11/29/2018 15:02:48 all.q@cu03 1 ``` **申请更多的内存资源** 系统默认申请的内存为2G,如果你需要申请更多的内存资源,需要指定 ```sh qsub -cwd -l mem_free=5G,h_vmem=6G batch.sh #申请5G,最多只能使用6G ``` **并行计算** 如果你的程序支持并行计算,你可以指定CPU数和计算核数。 ```sh qsub -pe smp 6 -R y -l mem_free=6G,h_vmem=6G myScript.sh ``` 1. Use the `-pe local K` option to request K slots on a single cluster node. 2. use the `-R y` option to turn on slot reservation. 3. Use the `mem_free=NG` option to specify N Gigabytes of memory your job. 4. Use `h_vmem= nG` to set the hard memory limit for your job. Important: the value, `n`, you set in `h_vmem` is the total memory you set via `mem_free` divided by the number of slots specified for `-pe`. In other words n=N/K. 或者把参数写到脚本里面 ```sh #!/bin/bash #$ -S /bin/bash #$ -N JobName #$ -cwd #$ -j y #$ -pe smp 5 #$ -l mem_free=6G,h_vmem=6G 需要执行的任务命令 ``` **删除任务** ```sh qdel 139 ``` ## 四、一些有用的资料 **Linux学习资料** [Linux command line](https://gitee.com/ZhijunBioinf/Linux_command_line) **生物信息学非常有用的一行代码集成** [Bioinformatics one-liners](https://gitee.com/ZhijunBioinf/oneliners)