MPI code compilation and run

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

  • Executable code.x should be started by command mpirun:
    mpirun -np Nproc  -machinefile machines 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:
    mpirun -np 2 -machinefile machines code.x
    

    Previous Pageprevious First Pagetop Next Pagenext