The full name of MPI is the message passing interface, the standard messaging interface, which can be used for parallel computing. MPI has several implementations, such as Mpich, Chimp, and Openmpi. Here we use the Mpich version.
First, Mpich installation
Download: http://www.mpich.org/static/downloads/3.0.4/mpich-3.0.4.tar.gz
TAR-XZVF soft/mpich-3.0.4.tar.gz
CD mpich-3.0.4/
./configure--prefix=/usr/local/mpich
Make && make install
There is insufficient permission to use the
chmod 777/usr/local
Add the environment variable/etc/profile after installation and execute source/etc/profile
Path= $PATH:/usr/local/mpich/bin
Manpath= $MANPATH:/usr/local/mpich/man
Export PATH MANPATH
Two, single-node test
Copy the examples directory under the source code package to the installation directory
cp-r examples//usr/local/mpich
Perform
MPIRUN-NP./examples/cpi
The output results are as follows:
Process 0 of are on server150
Process 9 of are on server150
Process 1 of are on server150
Process 4 of are on server150
Process 5 of are on server150
Process 7 of are on server150
Process 2 of are on server150
Process 3 of are on server150
Process 6 of are on server150
Process 8 of are on server150
Pi is approximately 3.1415926544231256, Error is 0.0000000008333325
Wall clock time = 0.020644
If we want to compile the file now: Execute under/home/houqingdong: Mpicc-o Hello hello.c will be reminded:-BASH:MPICC command not found this is because we have not configured the path
Enter at the command line: Export path=/home/houqingdong/mpiexe/bin: $PATH Note: Here is only a temporary set of paths, after the restart effect will disappear, if you want to configure once and for all, please Google query
Take a look at the success of our configuration you can execute the Echo $PATH see if we have a path in the output.
It is not known here why the program that runs the Compute PI will only execute a process,
Manual compilation example of the following Hellow example, this time is correct
"Go" Linux MPI stand-alone configuration