Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Beyond the different compiler flavours in offer, we can also choose different MPI implementations for our MPI parallel programs. On the Atos HPCF and ECS, we can choose from the following implementations:

ImplementationModuleDescription
OpenMPIopenmpiStandard OpenMPI implementation provided by Atos
Intel MPIintel-mpiIntel's MPI implementation based on MPICH. Part of part of the Intel OneAPI distribution
HPC-X OpenMPIhpcx-openmpiNVIDIA's optimised flavour of OpenMPI. This is the recommended option

For the next exercise, we will use this adapted hello world code for MPI.

...

  1. Reset your environment with:

    No Format
    module reset


  2. With your favourite editor, create the file mpiversions.c with the code above, and compile it into the executable mpiversions. Hint: You may use the module hpcx-openmpi

    Expand
    titleSolution

    In order to compile MPI parallel programs, we need to use the MPI wrappers such as mpicc for C, mpicxx / mpic++ for C++ or mpif77 / mpif90 / mpifort for Fortran code. They will in turn call the corresponding compiler loaded in your environment, and will make sure all the necessary flags to compile and link agains the MPI library are set.

    These wrappers are made available when you load one of the MPI modules in the system. We will use the default hpcx-openmpi.

    Since we are building a C program, we will use mpicc:

    No Format
    module load hpcx-openmpi
    mpicc -o mpiversions mpiversions.c



  3. Write a small batch job that will compile and run the program using 2 processors and submit it to the batch system:

    Expand
    titleSolution

    You may write a job script similar to the following

    Code Block
    languagebash
    titlempiversions.sh
    #!/bin/bash
    #SBATCH -J mpiversions
    #SBATCH -o %x.out
    #SBATCH -n 2
    
    module load hpcx-openmpi
    mpicc -o mpiversions mpiversions.c
    srun ./mpiversions

    You may then submit it to the batch system with sbatch:

    No Format
    sbatch mpiversions.sh

    Inspect the output to check what versions of Compiler and MPI are reported


  4. Tweak the previous job to build and run the mpiversions program with as many combinations of compiler families and MPI implementations as you can.

    Expand
    titleSolution

    You may amend your existing mpiversions.sh script with a couple of loops on the prgenvs and MPI implementations:

    Code Block
    languagebash
    titlempiversions.sh
    #!/bin/bash
    #SBATCH -J mpiversions
    #SBATCH -o %x.out
    #SBATCH -n 2
    
    for pe in gnu intel intel-llvm amd; do
        for mpi in hpcx-openmpi intel-mpi openmpi; do
            module load prgenv/$pe $mpi
            module list 
            mpicc -o mpiversions mpiversions.c
            srun ./mpiversions
            echo "******************"
        done
    done
    
    

    You may then submit it to the batch system with sbatch:

    No Format
    sbatch mpiversions.sh

    Inspect again the output to check what versions of Compiler and MPI are reported.


...