Testing the Cluster

Test Open MPI Cluster

Prerequisites

  1. You have successfully installed and configured everything in the previous articles.
  2. All devices including the server and the clients are connected in the same local area network.

Run the Example

  1. Switch the workplace to the server device by either ssh or IO devices.
  2. Switch the working directory to /home/nvidia/cloud by running:
    cd /home/nvidia/cloud
    
  3. Download the MPI hello world sample code by running:
    git clone https://github.com/wesleykendall/mpitutorial
    
  4. Compile the sample by running:
    cd mpitutorial/tutorials/mpi-hello-world/code
    mpicc -o mpi_hello_world mpi_hello_world.c
    
  5. Add a host file host_file with the following content (e.g., there are 4 devices, 192.168.0.100 is the server IP, same as locahost; 192.168.0.101-103 are the client IPs. Each device has 4 processors, so the options slots and max-slots are both 4):
    localhost slots=4 max-slots=4
    192.168.0.101 slots=4 max-slots=4
    192.168.0.102 slots=4 max-slots=4
    192.168.0.103 slots=4 max-slots=4
    
    See Open MPI FAQ for more information.
  6. Run the sample parallelly by running (e.g., there are 4 devices, each with 4 processors, so 4*4=16):
    mpirun -np 16 --hostfile host_file mpi_hello_world
    
    You should see something like:
    Hello world from processor tegra-server, rank 0 out of 16 processors
    Hello world from processor tegra-server, rank 1 out of 16 processors
    Hello world from processor tegra-server, rank 2 out of 16 processors
    Hello world from processor tegra-server, rank 3 out of 16 processors
    Hello world from processor tegra-1, rank 4 out of 16 processors
    Hello world from processor tegra-1, rank 5 out of 16 processors
    Hello world from processor tegra-1, rank 6 out of 16 processors
    Hello world from processor tegra-1, rank 7 out of 16 processors
    Hello world from processor tegra-2, rank 8 out of 16 processors
    Hello world from processor tegra-2, rank 9 out of 16 processors
    Hello world from processor tegra-2, rank 10 out of 16 processors
    Hello world from processor tegra-2, rank 11 out of 16 processors
    Hello world from processor tegra-3, rank 12 out of 16 processors
    Hello world from processor tegra-3, rank 13 out of 16 processors
    Hello world from processor tegra-3, rank 14 out of 16 processors
    Hello world from processor tegra-3, rank 15 out of 16 processors
    
    The actual orders and messages might stagger, this is just an artificial one for simplicity.

References

results matching ""

    No results matching ""