Building MPICH2-1.0.8 for OpenSolaris with Sun Studio 12
MPICH2-1.0.8 is a very nice implementation of the MPIv2 standard, I utilized MPI in a variety of projects. Here are my notes for building and running with the library for OpenSolaris using Sun Studio 12 for compilation.
Getting started
-
OpenSolaris 2008.11
-
MPICH2-1.0.8
-
Studio 12 compilers
-
GNU utilities
MPICH2-1.0.8 can be obtained at: http://www.mcs.anl.gov/research/projects/mpich2/
For OpenSolaris, use the package manager and the opensolaris.org repository to download the Studio 12 compilers for C/C++ and GNU utilities, the repository is great and as a developer on OpenSolaris, you should get use to this tool to manage your environment, it is a fantastic addition, I use it heavily.
Building MPICH2-1.0.8
# gzip -d mpich2-1.0.8.tar.gz
# tar xvf mpich2-1.0.8.tar
This is a basic delivery of source, it utilizes configure for the environment build. Configure will pick up the Studio compilers by setting the enviroment variables: CC, CFLAGS, CXX, CXXFLAGS, F77, FFLAGS
# export CC=/export/home/langston/COMPILER/SUNWspro/bin/cc
# export CXX=/export/home/langston/COMPILER/SUNWspro/bin/CC
# export F77=/export/home/langston/COMPILER/SUNWspro/bin/f77
With /export/home/langston/COMPILER/SUNWspro where I have Sun Studio 12 installed.
This is my configuration line – I still have to experiment for the best environment, but this will get you started and able to run MPI applications with the MPICH2 libraries
# ./configure --prefix=/usr/local/mpich2 --enable-threads --with-thread-package=posix –disable-sharedlibs
You must use –disable-sharedlibs , otherwise the build will complete, but the examples will not compile, this is noted in the RELEASENOTES, follow the advice even though Studio is used and not GCC. Thanks go to the MPICH folks for pointed out what was happening. Very responsive when I had the problem using sharedlibs enabled.
# gmake
Installing MPICH and running an example
# gmake install
As you start utilizing multiple implementation of MPIv2, such as OpenMPI or ClusterTools8, it is probably best to have you install directory set to a different location other than /usr/local which is generally the default. This will keep the mpi runtime environments from writing over each other.
Make sure you have that path in your PATH, in my case, /usr/local/mpich2/bin , this will find things such as mpicc
Make sure you have LD_LIBRARY_PATH set with /usr/local/mpich2/lib include
# export PATH=$PATH:/usr/local/mpich2/bin
# export LD_LIBRARY_PATH=/usr/local/mpich2/lib:$LD_LIBRARY_PATH
# cd examples
# cp cpi.c /tmp
# cd /tmp
langston@alpha:/tmp$ mpicc -I/usr/local/mpich2/include -c cpi.c
langston@alpha:/tmp$ mpicc -o cpi cpi.o -lm
langston@alpha:/tmp$ ldd cpi
libm.so.2 => /lib/libm.so.2
libnsl.so.1 => /lib/libnsl.so.1
libsocket.so.1 => /lib/libsocket.so.1
libc.so.1 => /lib/libc.so.1
libmp.so.2 => /lib/libmp.so.2
libmd.so.1 => /lib/libmd.so.1
libscf.so.1 => /lib/libscf.so.1
libuutil.so.1 => /lib/libuutil.so.1
libgen.so.1 => /lib/libgen.so.1
NOTE: You need to have in your home directory a .mpd.conf file containing a variable
MPD_SECRETWORD=<secret word>
see notes: https://svn.mcs.anl.gov/repos/mpi/mpich2/tags/release/mpich2-1.0.8/README.vin
This is used by mpd when you start it up before running the mpi task.
langston@alpha:/tmp$ mpd &
langston@alpha:/tmp$ mpirun -np 2 cpi
Process 0 of 2 is on alpha
Process 1 of 2 is on alpha
pi is approximately 3.1415926544231318, Error is 0.0000000008333387
wall clock time = 0.001380
