Ubuntu configuration and use of MPI method

  

MPI is a multi-excuses, need to build mpi environment when using Ubuntu, the following small series will be a brief introduction to the construction and use of MPI in Ubuntu, interested friends can Let's get to know.

1, environment structures

Terminal: sudo apt-get install mpich2

installed version 1.4.1 of mpich2.

2, compile

Terminal: mpicc mpi_hello.c -g -Wall -o mpi_hello

3, run

Terminal: mpiexec -n "number Of processes". /mpi_hello

Example: Run the program with 4 processes

mpiexec -n 4 . /mpi_hello

The above is the introduction of Ubuntu configuration and the use of MPI. There are three steps, namely configuration environment, compilation and MPI operation. The use of other Linux systems can be used as a reference.

Copyright © Windows knowledge All Rights Reserved