|
| 1 | +--- |
| 2 | +highlighter: none |
| 3 | +layout: default |
| 4 | +title: MPI Use Guide |
| 5 | +--- |
| 6 | + |
| 7 | + |
| 8 | +Contents |
| 9 | +======== |
| 10 | + |
| 11 | +1. [Overview of installed MPI libraries](#overview) |
| 12 | +2. [Using the MPI libraries to compile your code](#lib) |
| 13 | +3. [Running your job](#run) |
| 14 | + |
| 15 | +This page describes how to use the MPI libraries installed on the HPC |
| 16 | +cluster. |
| 17 | + |
| 18 | +<a name="overview"></a> |
| 19 | + |
| 20 | +**1. Overview of Installed MPI Libraries** |
| 21 | +====================================== |
| 22 | + |
| 23 | +There are multiple MPI libraries installed on the cluster, many compiled |
| 24 | +in at least two ways (see below). The SLURM scheduler also has |
| 25 | +integrated libraries for most MPI versions, which you can read about |
| 26 | +[here](https://computing.llnl.gov/linux/slurm/mpi_guide.html). |
| 27 | + |
| 28 | +There are ten different MPI libraries installed: |
| 29 | + |
| 30 | +- OpenMPI version 1.6.4 |
| 31 | +- OpenMPI version 1.10.2 |
| 32 | +- OpenMPI version 2.0.1 |
| 33 | +- OpenMPI version 2.1.0 |
| 34 | +- OpenMPI version 3.1.1 |
| 35 | +- MPICH version 3.0.4 |
| 36 | +- MPICH version 3.1 |
| 37 | +- MPICH2 version 1.5 |
| 38 | +- MVAPICH2 version 1.9 |
| 39 | +- MVAPICH2 version 2.1 |
| 40 | + |
| 41 | +**IMPORTANT: If your software can use OpenMPI or MVAPICH2, these are the |
| 42 | +recommended MPI libraries for CHTC\'s HPC Cluster and will perform the |
| 43 | +fastest on the cluster\'s Infiniband networking.** MPICH and MPICH2 do |
| 44 | +not use Infiniband, by default, and will perform slower than OpenMPI or |
| 45 | +MVAPICH2, though we\'ve configured them to work as well as for |
| 46 | +ethernet-only clusters, so they\'ll still work if your software will |
| 47 | +*only* run with MPICH or MPICH2. |
| 48 | + |
| 49 | +Note that many of our MPI libraries have been compiled with different |
| 50 | +base compilers, to accommodate codes that require these base compilers |
| 51 | +to be built successfully. The compiler used to build MPI can be seen in |
| 52 | +the names of our software modules (see [below](#lib)) and include: |
| 53 | + |
| 54 | +- `gcc` - the base system version of `gcc` |
| 55 | +- `intel` - compiled with Intel Composer XE and Intel MPI Library |
| 56 | + Development Kit 4.1 compilers |
| 57 | +- `intel-2016` - |
| 58 | +- `2.1.0-GCC-7.3.0-2.30` - version 7.3 of `gcc` |
| 59 | + |
| 60 | +<a name="lib"></a> |
| 61 | + |
| 62 | +**2. Using the MPI Libraries to Compile Your Code** |
| 63 | +=============================================== |
| 64 | + |
| 65 | +In order to successfully compile and run your code using these MPI |
| 66 | +libraries you need to set a few environmental variables. To set these |
| 67 | +variables you will be using the Environmental Modules package |
| 68 | +(<http://modules.sourceforge.net>). This package is very easy to use and |
| 69 | +it will automatically set the environmental variables necessary to use |
| 70 | +the flavor and version of MPI that you need. |
| 71 | + |
| 72 | +First, you are going to want to run the following command to see the |
| 73 | +available modules: |
| 74 | + |
| 75 | +``` |
| 76 | +[alice@service]$ module avail |
| 77 | +``` |
| 78 | +{:.term} |
| 79 | + |
| 80 | +When you run the above command you will receive output similar to this: |
| 81 | + |
| 82 | +``` |
| 83 | +[alice@service]$ module avail |
| 84 | +---------------------------------------- /etc/modulefiles ---------------------------------------- |
| 85 | +mpi/gcc/mpich-3.0.4 mpi/gcc/openmpi-1.6.4 mpi/intel/mvapich2-1.9 |
| 86 | +mpi/gcc/mvapich2-1.9 mpi/intel/mpich-3.0.4 mpi/intel/openmpi-1.6.4 |
| 87 | +matlab-r2015b compile/intel-2016 mpi/gcc/openmpi/2.1.0-GCC-7.3.0-2.30 |
| 88 | +``` |
| 89 | +{:.term} |
| 90 | + |
| 91 | +As you can see, the MPI libraries compiled with GCC compilers are listed |
| 92 | +under `mpi/gcc/` and the MPI libraries compiled with Intel compilers are |
| 93 | +listed under `mpi/intel/`. |
| 94 | + |
| 95 | +To load a module (for example, OpenMPI compiled with GCC compilers), |
| 96 | +simply run this command: |
| 97 | + |
| 98 | +``` |
| 99 | +[alice@service]$ module load mpi/gcc/openmpi-1.6.4 |
| 100 | +``` |
| 101 | +{:.term} |
| 102 | + |
| 103 | +Now all necessary environmental variables are set correctly and you can |
| 104 | +go ahead and compile your code! |
| 105 | + |
| 106 | +If you loaded the wrong module, let\'s say MPICH compiled with Intel |
| 107 | +compilers, you can unload it by running: |
| 108 | + |
| 109 | +``` |
| 110 | +[alice@service]$ module unload mpi/intel/mpich-3.0.4 |
| 111 | +``` |
| 112 | +{:.term} |
| 113 | + |
| 114 | +You can see what modules you already have loaded by running: |
| 115 | + |
| 116 | +``` |
| 117 | +[alice@service]$ module list |
| 118 | +``` |
| 119 | +{:.term} |
| 120 | + |
| 121 | +**NOTE:** Before using any of the MPI libraries under `mpi/intel/` you |
| 122 | +first need to load the `compile/intel` module. |
| 123 | + |
| 124 | +<a name="run"></a> |
| 125 | + |
| 126 | + |
| 127 | +**3. Running Your Job** |
| 128 | +=================== |
| 129 | + |
| 130 | +**NOTE:** To run your job you need the same module loaded as when you |
| 131 | +compiled your code. When you log out of your terminal all loaded modules |
| 132 | +are automatically unloaded. |
| 133 | + |
| 134 | +In order to ensure that your job has the appropriate modules loaded when |
| 135 | +it runs, we recommend adding the `module load` command to your submit |
| 136 | +file, with the appropriate modules. See our sample submit file in the |
| 137 | +[HPC Use Guide](/HPCuseguide.shtml#batch-job) to see what this looks |
| 138 | +like. |
0 commit comments