[Beowulf] An Ask about Compilation

Mark Hahn hahn at mcmaster.ca
Fri Jan 2 11:53:29 PST 2009

> I will try this. but I believe, the compiler will include all the MPI's
> code, and I would like to disable this part with macros

it's normally more convenient to provide two binaries: one with MPI
and the serial version without.  using MPI requires, for instance,
initialization and finalization calls, as well as actual message
passing.  you can, of course, make these conditional:
 	if (mpi) Mpi_Init(...)
but this is distracting in the code.

> programm works with lists and normally the list are made with pointers, and
> as far as I know, the MPI dont "like" pointers... So the Seriell version,

I think this indicates a more fundamental problem: MPI is for distributed
memory programs - if you want dynamic data available to an individual 
process (rank/worker), then you have to send it.  it's not so much that 
MPI is pointer-hostile, but rather that a pointer is a reference within
a single process, and have no real meaning outside the process (such as 
in the address space of another rank.)  you can, of course, pass the actual
data pointed to instead.  or possibly your data might be amenable to using
"handles", tags which you assign to your data, and explicitly manage.
(with a little more effort, you _could_ actually explicitly manage pointers
as handles - you'd have to control allocation explicitly, and synchronize
your memory use on all ranks.  mmap() allows you to do this, and with the 
prevalence of 64b machines, you certainly can avoid colliding with system
allocations within your address space.)

of course, it may also be that your workload is embarassingly parallel - 
that is, once set up, each rank will compute independently of the others.
if that's the case, then the mpi portions are really quite constrained:
distribution of data and collection of results.  controlling this via 
a commandline argument would be very doable.

More information about the Beowulf mailing list