`TOP-C' provides a built-in subset of MPI sufficient to run distributed applications. If you prefer to use a different implementation of `MPI' with `TOP-C', this note describes how to do so.
First test a `hello_world' MPI program for your chosen MPI implementation to make sure that the startup mechanism is well understood.
Many dialects of `MPI' provide their own wrapper around
the C and C++ compiler. For example, `LAM MPI' provides mpicc
.
If your dialect provides such a wrapper mpicc
, then
do ./configure --with-mpi-cc=mpicc
and make
. There is a similar
configure flag, --with-mpi-cxx
, for `C++'.
If you do use such a wrapper, you should use the same C compiler for
the rest of `TOP-C'. Hence, if mpicc
uses cc
,
then configure with env CC=cc ./configure --with-mpi-cc=mpicc
.
If your dialect does not provide such a wrapper, it is easy to create one by modifying the shell script below for your site.
#!/bin/sh gcc -I/usr/local/include $* -L/usr/local/lib -lmpi
These wrappers will enable topcc
and topc++
to work,
but not topc-config
. If you also need topc-config
,
then you must modify topc-config
.
Determine the libraries used by your dialect of MPI.
Then search for a string with -ltopc-mpi
in
`.../topc/bin/topc-config',
and append to it your `libmpi'. For example,
append to -ltopc-mpi
with -L/usr/local/lib -lmpi
.
Finally, for many dialects of MPI, after compiling the MPI application,
they may also require a special command at runtime to execute,
such as mpirun a.out
.
In such cases, your `TOP-C' application must be treated similarly.
The following examples illustrate the configuration and use of MPI for other MPI implementations using 2 slaves and 1 master.
# IBM/AIX: env CC=xlc CXX=xlC ./configure --with-mpi-cc=mpcc --with-mpi-cxx=mpCC make; cd bin; ./topcc --mpi -qcpluscmt ../examples/parfactor.c poe ./a.out 1234 --TOPC-verbose -procs 3 -pgmmodel spmd
# MPICH/Linux: ./configure --with-mpi-cc=mpicc make; cd bin; ./topcc --mpi ../examples/parfactor.c mpirun -np 3 ./a.out --TOPC-verbose 1234
# LAM/Linux: ./configure --with-mpi-cc=mpicc make; cd bin; ./topcc --mpi ../examples/parfactor.c mpirun -c 3 ./a.out -- --TOPC-verbose 1234
Go to the first, previous, next, last section, table of contents.