MPI code compilation and run in MPICH2

  • MPI code can be compiled with command mpicc
    mpicc -o code.x code.c
    

  • Process managers.
    mpd: As the primary startup method mpd is introduced by MPICH2. It's based on the script language Python to startup a so called ring of machines. Giving mpd a list of nodes will startup daemons on the requested machines, which can be used immediately for the execution of parallel programs inside this ring. This is convenient for the interactive use of a parallel program, as the only thing which must be prepared is a list of to be used nodes.
    smpd: This startup method can be used in a daemon based or daemonless mode. The daemon based startup is not creating all the daemons on the nodes according to a nodelist on its own (like it is done by the mpd startup method), but the daemons have to be started before the execution of the main program, e.g. by a script.
    gforker. Programs started under gforker are limited to one machine and supports only forks for additional processes.

  • We will be using smpd process manager in daemon based and daemonless mode.

  • smpd in daemonless mode.
    export MPIEXEC_RSH=rsh
    
    Executable code.x should be started by command mpiexec:
    mpiexec -rsh -nopm  -n Nproc  -machinefile machines /full_path/code.x
    
    Where Nproc the number of processes involved; machines is a file with the list of hosts participated into MPI
    For example, to run the code on two single CPU nodes, unisys18 and node18, file machines looks as follows:
    unisys18
    node18
    

    To start the code in this case:
    mpiexec -rsh -nopm -n 2 -machinefile machines /full_path/code.x
    

  • smpd in daemon based mode.
    Start the process management daemon on all the compute nodes. Executing this for the first time will prompt the user to create a ~/.smpd configuration file and passphrase if one does not already exist.
    smpd -s
    
    Then run the code:
    mpiexec -n 2 code.x
    
    When the MPI run is finished, stop the process manager on all the nodes:
    smpd -shutdown [host]
    

    Previous Pageprevious First Pagetop Next Pagenext