Download PGI Compiler User`s Guide
Transcript
Using MPI 6.5. Using MPICH on Linux and OS X PGI Workstation for Linux and OS X and PGI CDK for Linux include MPICH header files, libraries and tools required to compile, execute, profile, and debug MPI programs. PGI Workstation can be installed on a single system, and that system can be treated as if it is a small cluster by using this version of MPI. Example MPI Hello World Example The following MPI example program uses MPICH. $ $ $ $ $ cd my_example_dir cp -r $PGI/linux86-64/14.0/EXAMPLES/MPI/mpihello . cd mpihello export PATH=$PGI/linux86-64/2015/mpi/mpich/bin:$PATH pgfortran -Mmpi=mpich mpihello.f -o mpihello $ mpiexec mpihello Hello world! I'm node 0 $ mpiexec -np 4 mpihello Hello world! I'm node 0 Hello world! I'm node 2 Hello world! I'm node 1 Hello world! I'm node 3 If you want to build your MPI application using the instance of MPICH installed with the PGI compilers, just use the -Mmpi=mpich option. Add -g for debugging, or use -Mprof=mpich instead to instrument for MPICH profiling. To use a different instance of MPICH instead of the PGI-provided one, use the MPIDIR environment variable. Before compiling set MPIDIR to the root of the MPICH installation directory that you want to use, that is, the directory that contains bin, include, lib, and so on. You can still use the -Mmpi=mpich and -Mprof=mpich options but now the compilers use the MPIDIR-specified version of MPICH instead of the PGI default. 6.6. Using MPICH1, MPICH2, and MVAPICH1 on Linux The -Mmpi and –Mprof sub-options mpich1, mpich2 and mvapich1 have been deprecated in the PGI 2015 release and will be disabled in a future release. To use these deprecated options, you must first set the environment variable MPIDIR to the root of the MPI installation directory you intend to use, that is, the directory that contains bin, include, lib and so on. If you do not set MPIDIR, you will see an error like the following: $ pgfortran -Mmpi=mpich2 pi.f90 -o fpi -Mmpi=mpich2 has been deprecated and will be removed in a future release pgfortran-Error-The environment variable $MPIDIR must be set to use MPICH2 Once MPIDIR is set, you can use –Mmpi and –Mprof with the mpich1, mpich2 and mvapich1 sub-options as you have in previous releases. PGI Compiler User's Guide 77