Extending from Building OpenMPI with Intel Compiler (Ver 2). Assuming you are using Intel Compiler as the default compiler.
Step 1: If you wish to change to another compiler like PGI (in this example) from the Intel Compiler,
You can issue the commands
# export CC=pgcc
# export CXX=pgCC
# export F77=pgf77
# export FC=pgf90
To check that the openmpi is using the PGI compiler
# /usr/local/openmpi/bin/mpicc --showme
# /usr/local/openmpi/bin/mpiCC --showme
# /usr/local/openmpi/bin/mpif77 --showme
# /usr/local/openmpi/bin/mpif90 --showme
Step 2: If you wish to "return" to the default
# unset CC
# unset CXX
# unset F77
# unset FC
To check that the openmpi is using the PGI compiler
# /usr/local/openmpi/bin/mpicc --showme
# /usr/local/openmpi/bin/mpiCC --showme
# /usr/local/openmpi/bin/mpif77 --showme
# /usr/local/openmpi/bin/mpif90 --showme