linux下intel使用intel mpi(2)

来源:互联网 发布:dbc数据库修改 编辑:程序博客网 时间:2024/06/18 17:40

1.任务调度支持
当使用Altair* PBS Pro*, TORQUE*, and OpenPBS*时:$PBS_ENVIRONMENT 设置为值 PBS_BATCH或者 PBS_INTERACTIVE
参考代码如下:

#PBS –l nodes=4:ppn=4 #PBS –q queue_name cd $PBS_O_WORKDIR mpirun –n 16 ./myprog

当使用IBM* Platform LSF*时:
先设置$LSB_MCPU_HOSTS,并在其上添加上main processes的名称,下面是一个运行实例:

$ bsub -n 16 mpirun -n 16 ./myprog

当使用Parallelnavi NQS*时:
完成设置

$ENVIRONMENT,  $QSUB_REQID, $QSUB_NODEINF
 $QSUB_NODEINF

这个文件被作为 mpirun的machine file
当使用SLURM*时:
设置$SLURM_JOBID,

 $SLURM_TASKS_PER_NODE $SLURM_NODELIST

运行如下命令:

$ srun -N2 --nodelist=host1,host2 -A $ mpirun -n 2 ./myprog

当使用Univa* Grid Engine*时:
设置$PE_HOSTFILE:
这两个会被生成

/tmp/sge_hostfile_${username}_$$ and /tmp/sge_machifile_${username}_$$

当使用SIGINT, SIGTERM Signals Intercepting时,
当资源调用超过上限时,一个信号会向所有进程发送来结束大多数的任务安排。
例如:Torque* 向一个任务发送三遍SIGTERM ,假如这个任务还在活跃, 就会发送SIGKILL 来结束它。
用以下命令来看查看所有的队列:

$ qconf -sql

使用以下命令来修改队列设置:

$ qconf -mq <queue_name>

找到terminate_method然后把信号改成SIGTERM
关闭队列设置
关于Controlling Per-Host Process Placement:
默认情况下,intel mpi使用per-host process placement,这意味着-ppn命令将无用。可以使用如下命令将其关闭,以可以通过-ppn命令来控制。

$ export I_MPI_JOB_RESPECT_PROCESS_PLACEMENT=off

Cross-OS Launch Mode:
你可以跨平台的使用intel mpi通信:
首先确保所有节点的intel mpi版本一致。
确保hydra服务被开启,可以使用如下命令查看:

> hydra_service -status

假如没有开启,可以使用-start选项开启。
当运行一个跨平台的任务时,进行如下设置:

-demux select-genv I_MPI_FABRICS=shm:tcp-host <hostname>-hostos <os> for nodes operating on the other OS-env I_MPI_ROOT and -env PATH – local environment variables for the specified host(optional) -bootstrap ssh – specifies the remote node access mechanism. If the option is not specified, the Hydra service is used. If you specify ssh, make sure the SSH connectivity is established between the Linux and Windows nodes.

以下是一个示例:

$ mpirun -demux select -genv I_MPI_FABRICS=shm:tcp -env I_MPI_ROOT=<windows_installdir> \ -env PATH=<windows_installdir>\<arch>\bin -hostos windows -host <windows_host> -n 2 IMB-MPI1 pingpong :\ -host <linux_host> -n 3 <linux_installdir>/<arch>/bin/IMB-MPI1 pingpong

2.设置项目启动选项:
设置library选项:
使用正确的参数运行mpivars.[c]sh脚本,例如:

$ . <installdir>/bin64/mpivars.sh release

下面是参数表:
release
Set this argument to use single-threaded optimized library.
debug
Set this argument to use single-threaded debug library.
release_mt
Set this argument to use multi-threaded optimized library (default).
debug_mt
Set this argument to use multi-threaded debug library.
控制节点放置:
通过使用 -host你可以明确的指定节点的运行内容,通过使用-ppn你可以
确定每个节点的进程数。例如:

$ mpirun -n 4 -ppn 2 -hosts node1,node2 ./testc Hello world: rank 0 of 4 running on node1 Hello world: rank 1 of 4 running on node1Hello world: rank 2 of 4 running on node2 Hello world: rank 3 of 4 running on node2

你也可以使用一个包含有相关信息的host文件来完成相关设置,使用-f来传递文件信息给mpirun,下面是示例:

$ cat ./hosts #nodes node1 node2 $ mpirun -n 4 -ppn 2 -f hosts ./testc

运行结果是:

$ mpirun -n 6 -hosts node1,node2 ./testc Hello world: rank 0 of 6 running on node1 Hello world: rank 1 of 6 running on node1 Hello world: rank 2 of 6 running on node1 Hello world: rank 3 of 6 running on node1 Hello world: rank 4 of 6 running on node2 Hello world: rank 5 of 6 running on node2

运用参数表:
参数表间应当用冒号隔开,全局变量应当最先出现,下面是一个示例:

$ mpirun -genv I_MPI_DEBUG=2 -host node1 -n 2 ./testc : -host node2 -n 2 ./testc

在设置文件中,每个参数表应当在新的一行,全局变量应该出现在第一行,下面是一个示例:

$ cat ./config -genv I_MPI_DEBUG=2 -host node1 -n 2 ./testc -host node2 -n 2 ./testc

使用-configfile命令指定:

$ mpirun -configfile config Hello world: rank 0 of 4 running on node1 Hello world: rank 1 of 4 running on node1 Hello world: rank 2 of 4 running on node2 Hello world: rank 3 of 4 running on node2

3.选择通信结构:
下面是相应的表格:
shm
Shared memory (for intra-node communication only).
dapl
Direct Access Programming Library* (DAPL)-capable network fabrics, such as InfiniBand* and iWarp* (through DAPL).
tcp
TCP/IP-capable network fabrics, such as Ethernet and InfiniBand* (through IPoIB*).
tmi
Tag Matching Interface (TMI)-capable network fabrics, such as Intel® True Scale Fabric, Intel® Omni-Path Architecture and Myrinet* (through TMI).
ofa
OpenFabrics Alliance* (OFA)-capable network fabrics, such as InfiniBand* (through OFED* verbs).
ofi
OpenFabrics Interfaces* (OFI)-capable network fabrics, such as Intel® True Scale Fabric, Intel® Omni-Path Architecture, InfiniBand* and Ethernet (through OFI API).
使用I_MPI_FABRICS变量来指定一个通信结构,另外还有控制变量比如I_MPI_FABRICS_LIST and I_MPI_FALLBACK,这个会在之后的博客提到。
默认的行为:
使用共享内存,并从结构表中选择最前面且可用的结构方式,结构表一般为(dapl,ofa,tcp,tmi,ofi),也可以看I_MPI_FABRICS_LIST。
我们可以通过设置I_MPI_DEBUG=2查看使用了哪种结构。
例如:

$ mpirun –n 4 –ppn 2 –hosts <node1>,<node2> -genv I_MPI_DEBUG=2 ./myprog ... MPI startup(): shm and dapl data transfer modes

设置结构列表:
使用I_MPI_FABRICS_LIST变量,例如:

$ export I_MPI_FABRICS_LIST=ofi,tcp $ mpirun –n 4 –ppn 2 –hosts <node1>,<node2> ./myprog

你也可以直接指定intra-node和inter-node(节点内部和外部)通信,语法为:

I_MPI_FABRICS=<fabric>|<intra-node fabric>:<inter-node fabric>

如果你只指定了

<fabric>

那么指定的内容会被用于节点内外。
例如如下设置:

$ export I_MPI_FABRICS=shm:tcp $ mpirun –n 4 –ppn 2 –hosts <node1>,<node2> ./myprog

节点内为shared memery,节点外为tcp
如果你设置为:

$ export I_MPI_FABRICS=tcp

节点内外均为tcp

原创粉丝点击