7.9 HEPS

7.9.1 新用户

  • 申请计算集群账号

    请参考第2章内容,得到HEPS实验负责人同意后,用户可获得afs账号;

  • 计算环境初始化

    初次登录后在终端输入如下命令完成初始化:

      $ ln -s /sharefs/heps/data/opt/config/bash_profile  ~/.bash_profile
      $ source ~/.bash_profile
    

7.9.2 计算资源

HEPS实验的计算资源列表如下:
节点IP 每个节点逻辑CPU核数 节点类型 任务调度系统 其他说明
acc-ap01.ihep.a.cn ~ acc-ap09.ihep.ac.cn 56 登录节点 acc-ap02逻辑CPU核数为28
acc-ap10.ihep.a.cn ~ acc-ap15.ihep.ac.cn 72 登录节点
acc-ap16.ihep.a.cn ~ acc-ap17.ihep.ac.cn 88 登录节点
accap019.ihep.a.cn ~ accap053.ihep.ac.cn 36 计算节点 SLURM 不能通过ssh登录

注意:经过2020年暑期的系统升级,acc-ap2、lxslc7及计算节点accap019 ~ accap053均已经升级为SLC7.8操作系统,而acc-ap01,acc-ap03 ~ acc-ap18仍然保持之前的SLC6.5操作系统。目前需要进行的额外设置包括:

  • 重新设置登录设置文件
    $ rm ~/.bash_profile
    $ ln -s /sharefs/heps/data/opt/config/bash_profile  ~/.bash_profile
    
    然后退出登录,再次登录服务器完成设置。
  • 通过vnc访问acc-ap02,需要在登录后关闭屏保,即在Applications -> System Tools -> Settings -> Power 中勾选 Blank Screen Never。

7.9.3 存储目录

HEPS实验用户可以使用的存储目录列表如下:
磁盘名称 空间限额/文件数限额 查看使用份额的命令
/afs/ihep.ac.cn/users/a-z/username 500MB/none fs listquota /afs/ihep.ac.cn/users/a-z/username
/workfs/heps/username 1 5GB/5万 lfs quota -u username /workfs
/scratchfs/heps/username 2 500GB/none(数据只保存2周) lfs quota -u username /scratchfs
/sharefs/heps/user/username 3TB/none lfs quota -u username /sharefs

1 部分用户的workfs个人目录为/workfs/csns/username或/workfs/others/username 2 部分用户的scratchfs个人目录为/scratchfs/csns/username或/scratchfs/others/username

关于不同存储目录的使用有如下建议:

  • /afs目录下仅保留部分重要的个人设置文件,若在服务器上无法执行写操作,先排查是否由于/afs个人目录超过空间或文件数限额;
  • /workfs目录可供在登录节点上读写文件,但在计算节点上提交的SLURM计算任务无法在/workfs下新建和修改文件。
  • /sharefs目录下可保持重要计算结果和数据,登录节点和计算节点均可读写;
  • /scratchfs目录下可供暂存大文件和中间计算结果;
  • 请将重要计算结果和数据及时备份到本地个人电脑。

7.9.4 计算程序及示例

HEPS实验的各计算程序按不同类别分别安装在/ihepbatch/accdata/opt/、 /ihepbatch/accdata/APcodes、/sharefs/heps/data/APcodes和/sharefs/heps/data/opt/目录下,各计算程序的详细列表在/sharefs/heps/data/APcodes/README.md。

7.9.4.1 在acc-ap01~acc-ap18上运行并行程序

在acc-ap01, acc-ap03 ~ acc-ap18上,可以通过mpich进行跨节点并行。目前安装的mpich默认基于hydra进程管理策略,以如下方式执行并行任务:

$ mpiexec -f mf -n 50 ./exe

其中mf文件中列出了参与并行计算的节点及能够提高的核数:

 $more mf
 acc-ap01.ihep.ac.cn:20
 acc-ap07.ihep.ac.cn:10
 acc-ap10.ihep.ac.cn:20

服务器运行状态可以在http://ganglia.ihep.ac.cn/ganglia/?r=hour&cs=&ce=&m=load_one&s=by+name&c=ACCAP&tab=m&vn=&hide-hf=false 查看。

7.9.4.2 通过SLURM任务调度器在accap019~accap053上运行并行程序

关于SLURM任务调度器的详细使用说明参见3.2.2章节内容。在accap019-accap053计算节点上使用SLURM调度器,需要通过ssh登录节点lxslc7.ihep.ac.cn或acc-ap02.ihep.ac.cn,然后才可以提交作业脚本及监测服务器和脚本运行状况。注意,提交作业的并行核数最好是36的整数倍。

  • 作业脚本的示例如下(sbatch.sh)
$ more sbatch.sh
#! /bin/bash                                                                                                  

# Specify the partition name from which resources will be allocated  
#SBATCH --partition=heps

# Specify which expriment group you belong to.
#SBATCH --account=heps


# Specify your job name, e.g.: "DA" is my job name
#SBATCH --job-name=DA

# Specify the queue to submit the job, two options are available, regular and advanced. "advanced" has a higher priority and is dedicated to urgent jobs. 
#SBATCH --qos=regular

# Specify the output file path of your job  
#SBATCH –-output=slurm-%j.txt

# Specify how many cores you will need, e.g.: 36 is advisable for jobs submitted to accap019~accap052
#SBATCH --ntasks=36

### Below you can add any bash scripts

mpiexec –np 36 Pelegant parTrack2.ele
  • 在登录节点上按如下方式提交任务:
$  sbatch sbatch.sh
  • 在hepsdebug队列中进行程序调试:

为了满足在slurm集群饱和时进行程序调试和运行时间较短的计算任务执行,将accap053单独划为hepsdebug队列,可以提交 最多ntasks不超过36,运行时间不超过30分钟的计算任务,超出30分钟则系统会自动清除该计算任务。通过slurm调度器提交到 hepsdebug队列时,只需在上述脚本中设置

#SBATCH --qos=hepsdebug

其他设置及提交任务的方式同前面介绍的方法相同。

  • 查看全部HEPS服务器运行状态
$  sinfo -p heps
  • 查看HEPS队列情况,输出结果的第一列为jobid
$ squeue
  • 取消某个计算任务
$ scancel jobid

7.9.4.3 在accap019~accap050上运行正版Matlab程序

HEPS实验购买的Matlab主程序安装在/afs/ihep.ac.cn/soft/hepsap/matlab目录下,运行matlab程序需以ssh或vnc方式登录acc-ap02.ihep.ac.cn,并执行

$ matlab

所安装的matlab支持在accap019到accap053上进行并行计算,最多调用512个并行核数。matlab并行任务不需要通过SLURM调度系统,而是直接在matlab中申请并行核数并执行并行任务

>> parpool(512)

7.9.4.4 运行正版Mathematica程序

HEPS实验购买的Mathematica主程序安装在/sharefs/heps/data/opt/Mathematica/12.0目录下,运行Mathematica程序可以以ssh或vnc方式登录acc-ap01 ~ acc-ap18等任一节点,并执行

$ /sharefs/heps/data/opt/Mathematica/12.0/bin/mathematica

所购买的license支持最多17个Mathematica主程序同时使用,支持最多136核的并行计算。下面介绍不同的并行计算调用方法,在/sharefs/heps/data/opt/examples/MathematicaExamples/路径下可以找到相关的例子。

7.9.4.4.1 在acc-ap01~acc-ap18上执行单节点内并行计算任务

以ssh或vnc方式登录上述节点,在计算程序的并行部分开始之前,加上

LaunchKernels[20]

来启动并行进程。括号中的数字为并行进程数,需不大于该节点当前可以使用的核数。

7.9.4.4.2 在acc-ap01~acc-ap18上执行跨节点并行计算任务

运行个人电脑或上述服务器端的正版Mathematica,在Notebook中第一个并行计算命令(如Parallelize)之前加入下面的代码

(* First specify the computing nodes and the number of cores on each nodes for this parallel computation*)
(* This need to be specified as an association between the hostname and number of cores to be used *)
(* Note that the number of cores to be used must be no larger than the number of idle cores on the specified node*)    
hosts = <|
   "acc-ap03.ihep.ac.cn" -> 20,
   "acc-ap04.ihep.ac.cn" -> 20
   |>;
(* Set up the remote kernels for the parallel computation *)
(* Password-less SSH using public-private key pairs must be set up as an prerequisite *)    
Needs["SubKernels`RemoteKernels`"];
$RemoteCommand = 
  "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -x \
-f -l `3` `1` /sharefs/heps/data/opt/Mathematica/12.0/bin/wolfram \
-wstp -linkmode Connect `4` -linkname '`2`' -subkernel -noinit \
-nopaclet ";
Map[If[hosts[#] > 0, LaunchKernels[RemoteMachine[#, hosts[#]]]] &, 
  Keys[hosts]];
(* Test if the Remote Kernels are successfully launched*)
KernelIDList = ParallelEvaluate[$KernelID];
MachineNameList = ParallelEvaluate[$MachineName];
Print["The kernelIDs are ", KernelIDList];
Print["The computing nodes include ", DeleteDuplicates[MachineNameList],
  ", the number of parallel processes allocated is", Length[MachineNameList], "\n"];

7.9.4.4.3 在acc-ap019~acc-ap050上执行跨节点并行计算任务

需登录acc-ap02.ihep.ac.cn,通过SLURM任务调度系统来向计算节点提交计算任务。 利用SLURM任务调度系统执行Mathematica计算任务有两种方法。如Mathematica程序不需要交互,则可以将其保存为Wolfram Language Script格式,可以在通过命令行方式执行。对于这种情况,可以参考前面介绍的方法编辑sbatch.sh,在完成SBATCH相关设置之后,加一行执行Mathematica脚本的语句math -script test.wls。然后可以通过sbatch sbatch.sh来向SLURM调度器提交作业。如果Mathematica程序需要交互,则可以在终端执行下面的命令,来获取并行计算资源,之后再从acc-ap02.ihep.ac.cn上打开Mathematica并执行并行计算任务。

salloc -p heps  --qos=regular  --ntasks=72  -t 01:00:00

上述命令中ntasks为并行计算所需的核数,-t之后为预计完成计算所需的时间。

在Mathematica程序中第一个并行计算命令(如Parallelize)之前加入下面的代码

(* First obtain from SLURM the computing nodes and the number of cores on each nodes for this parallel computation*)
(* List of computing nodes allocated for this parallel computation *)
nodes = ReadList["!scontrol show hostname $SLURM_NODELIST", String];
(* List of number of cores on each computing node allocated for this parallel computation *)
tpn = Environment["SLURM_TASKS_PER_NODE"];
tpnlist = If[ StringMatchQ[#, RegularExpression[".*\\(x.*\\)"]], 
            Table[ StringTrim[#, RegularExpression["\\(.*"]], 
                {i, ToExpression[ StringTrim[StringTrim[#, RegularExpression[".*\\(x"]], ")"]]}
                 ], 
            #]& /@ StringSplit[tpn, ","] // Flatten // ToExpression;
hosts = AssociationThread[nodes -> tpnlist];
Print["The association of nodes and counts are ", hosts, "\n"];
(* Set up the remote kernels for the parallel computation *)
(* Password-less SSH using public-private key pairs must be set up as an prerequisite *)    
Needs["SubKernels`RemoteKernels`"];
$RemoteCommand = 
  "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -x \
-f -l `3` `1` /sharefs/heps/data/opt/Mathematica/12.0/bin/wolfram \
-wstp -linkmode Connect `4` -linkname '`2`' -subkernel -noinit \
-nopaclet ";
Map[If[hosts[#] > 0, LaunchKernels[RemoteMachine[#, hosts[#]]]] &, 
  Keys[hosts]];
(* Test if the Remote Kernels are successfully launched*)
KernelIDList = ParallelEvaluate[$KernelID];
MachineNameList = ParallelEvaluate[$MachineName];
Print["The kernelIDs are ", KernelIDList];
Print["The computing nodes include ", DeleteDuplicates[MachineNameList],
  ", the number of parallel processes allocated is", Length[MachineNameList], "\n"];

7.9.5 常见问题

7.9.5.1 /afs个人目录无法写文件

  • 用户需要每隔10个小时重新获取tokens,来获得在/afs个人目录下的写权限,可以执行如下命令:

    $ echo 'password' | kint username
    $ aklog -d
    

    这里,username 和password分别为用户名和密码。一种简单的处理办法是登录到服务器之后,利用crontab将上述命令设置为定时执行任务

    $ sh /sharefs/heps/data/opt/config/generate_crontab_klog.sh username password
    
  • /afs个人目录已满,可以执行如下命令来查看使用份额:

    $ fs listquota /afs/ihep.ac.cn/users/a-z/username
    $ du -h /afs/ihep.ac.cn/users/a-z/username
    

    第二段语句可以查看个人目录下哪些文件占用了大量空间。需要特别注意的是,如果经常使用MATLAB程序,需要经常执行如下命令来清除缓存:

    $ rm ~/.felix
    

7.9.5.2 从Linux主机无法通过ssh登录服务器

  • Host key verification failed 比如从acc-ap01通过ssh登录acc-ap02为例,需要在~/.ssh/known_hosts中找到并删除包含acc-ap02的各行。注意,lxslc7.ihep.ac.cn对应于多个不同的登录节点,多次ssh lxslc7.ihep.ac.cn会导致Host key verification failed。建议ssh到具体的一个登录节点,比如ssh lxslc701.ihep.ac.cn。

7.9.5.3 acc-ap服务器上MATLAB中画图不能正确显示

可以在终端用 matlab -softwareopengl 命令打开matlab,画图能够正常显示。

results matching ""

    No results matching ""