免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1199 | 回复: 0
打印 上一主题 下一主题

安装mpich时如何根据不同的机器选择驱动程序 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-10-04 01:59 |只看该作者 |倒序浏览

http://www.quantumchemistry.net/Experience/CommonSoftwares/ABINIT/CompileInstallation/200512/150.html
MPI(Message Passing Interface)是消息传递并行程序设计的标准之一。MPI的实现包括MPICH、LAM、IBM MPL等多个版本,最常用和稳定的是MPICH。很多量化程序如vasp等的并行需要MPICH的支持。
   在使用mpich之前需要在指定的机器上首先编译安装mpich。根据手册说的,有四种驱动程序(device): ch_p4, ch_p4mpd, ch_shmem, ch_glous2.分别对应于不同的机器(见下面)。
   {
   Workstation Networks, Beowulf Clusters, and Individual Workstations. The most
   important devices are ch_p4 and ch_p4mpd. The ch_p4 device is the most general
   and supports SMP nodes, MPMD programs, and heterogeneous collections of systems.
   The ch_p4mpd device (so far) supports only homogenous clusters of uniprocessors, but
   provides for far faster and more scalable startup.
   Grids. The globus2 uses Globus (www.globus.org) to provide a grid-enabled implementation
   of MPI. This device is appropriate for systems on which Globus is installed.
   Symmetric Multiprocessors. The ch_shmem device is appropriate for a single sharedmemory
   system, such as a SGI Origin or Sun E10000. This device uses shared memory
   to pass messages between processes, and makes use of facilities provided by the operating
   system such as System V shared memory or anonymous mmap regions for data
   and System V semaphores or OS-specific mutex routines for synchronization. The
   ch_lfshmem device is a version of ch_shmem that uses a lock-free approach and that
   we developed for the NEC SX-4 [9]. The ch_shmem is appropriate for most systems;
   the ch_lfshmem requires special assembly language coding but can be ported to most
   systems. Currently, however, the ch_lfshmem supports only the NEC SX-4.
   3}
   问题是安装时如何选择适合的驱动程序。比如在sgi origine 3000里应该选择上面的哪一个?若是在intel P4微机上,又该如何选择。下文介绍如何选择合适的驱动程序来装MPI。
   
   从手册说明来看,ch_p4是比较普适的,甚至可以在不同的系统之间并行,而ch_p4mpd适合于环境单一的cluster,就是说你得机器都要是一样的,这个速度要快些(主要指的是启动任务的速度吧)。globus是用来网格之间的并行。最有一个ch_shmem是用来给那些共享内存的机器的,比如sgi origin 3800。
   
   所以你要在origin 3000上就用ch_shmem,如果是p4微机构成的cluster,就用ch_p4mpd。如果就一台微机,貌似也没必要并行了。。。如果有两个cpu的话,也可以考虑ch_shmem,或者仍然用ch_p4mpd,应该都可以。
   以下接着简单介绍MPI程序的编译和运行。
  MPI应用程序的编译
   Include文件
     C语言应用程序应有
       #include "mpi.h"
     若使用cc编译,命令行应有:
       -I/cluster/mpi/net/include (net版)
       -I/cluster/bcl/include -I/cluster/rms/include -I/cluster/sdr/include -I/cluster/mpi/mesh/include (mesh版)
     Fortran语言应用程序应有
      include 'mpif.h'
     若使用f77编译, 命令行应有:
       -I/cluster/mpi/net/include (net版)
       -I/cluster/bcl/include -I/cluster/rms/include -I/cluster/sdr/include -I/cluster/mpi/mesh/include (mesh版)
   MPI库文件
   C语言
     C语言程序编译时需作下述链接:
       -L/cluster/mpi/net/lib -lmpi -lbsd (net版)
       -L/cluster/mpi/mesh/lib -L/cluster/bcl/lib -L/cluster/rms/lib -L/cluster/sdr/lib -lmpi -lbcl -lrms -lsdr (mesh版)
     数学函数库还应链接: -lm
   Fortran语言
     Fortran编译时应作下述链接:
       -L/cluster/mpi/net/lib -lmpi -lbsd (net版)
       -L/cluster/mpi/mesh/lib -L/cluster/bcl/lib -L/cluster/rms/lib -L/cluster/sdr/lib -lmpi -lbcl -lrms -lsdr (mesh版)
   mpif77和mpicc
     MPI提供了两个工具(mpif77和mpicc)来简化MPI应用程序的编译。用户可以直接地使用命令行方式mpicc或mpif77来编译C或Fortran程序,编译方式与cc和f77完全一致。如:
       mpif77 -c foo.f
       mpicc -c foo.c
       mpif77 -o foo foo.o
       mpicc -o foo foo.o
     有时链接时需一些特殊库, 应在链接时注明。使用mpicc和mpif77省略了有关MPI的路径设置。
  MPI应用程序的运行
     应用程序编译好后,使用mpirun命令运行MPI应用程序。mpirun命令完整的格式如下:
       mpirun [-h|-?|-help] [-sz size|-sz hXw] [-np nprocs] [-pl poolname]
     各个选项的值由用户从命令行中显示地指定,选项的含义如下:
     -h
     -?
     -help:显示帮助信息。
     -sz
     指定物理节点的数目。有两种指定形式,一是直接指定size值,另一种是指定物理节点的矩形域的长和宽。size值和h*w的值如果超过所在pool的节点数,sz项的值取pool的节点数,h*w值取整个pool。两者的缺省值分别为所在pool的节点数和整个pool。
     -np
     用户期望运行的进程数。进程数与实际申请的物理节点数没有任何联系,因为允许一个节点上运行同一个应用的多个进程。如果未指定,取实际sz项的值。
     -pl poolname
     应用程序执行的pool。应用程序的每次执行能且只能在一个pool中执行。缺省值为系统为用户设置的缺省的pool名(每个用户在创建时已自行指定或系统分配了一个缺省的pool)。


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/50058/showart_394472.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP