Discussion:
MPI c++ broadcast of boolean array?
(too old to reply)
Thijssss
2006-12-20 22:58:55 UTC
Permalink
comp.parallel.mpi,

I have only just started out making a program run with mpi on several nodes,
but I miss the MPI_Bool datatype (which when I search.. is available in java
it seems). I tested broadcasting a small boolean array
using MPI_INT which worked but in my main program something went horribly
wrong since it crashed (seg fault I believe, code 11). Should I use MPI_Byte
and find out the size of the array in bytes and give it that as it's size?
What would be a good solution to do this? I need to broadcast a 2D boolean
array between the nodes.

I will get back on it first thing in the morning, maybe someone can leave a
message overnight which can help me out tomorrow.

Greetings,
Thijs Stuurman
Christian
2006-12-21 10:12:53 UTC
Permalink
Hi Thijs,
... but I miss the MPI_Bool datatype (which when I search..
is available in java it seems). I tested broadcasting a small
boolean array using MPI_INT ...
the problem is that MPI is relatively old now and the C++ interface had
been an add-on. C and Fortran don't have proper "boolean" data types
(see [1]). Either convert your boolean array into something of another
type (like integer array with 1=true and 0=false) or use an MPI
implementation that supports the 2.0 standard. This newer version of
the interface has explicit C++ bindings (see [2]), including
"MPI::BOOL".

Regards,
Christian

[1] http://www.mpi-forum.org/docs/mpi-11-html/node32.html
[2] http://www.mpi-forum.org/docs/mpi-20-html/node229.htm
Thijssss
2006-12-21 12:44:32 UTC
Permalink
Now that sheds new lights to my world, thank you for the information!
Post by Christian
Hi Thijs,
... but I miss the MPI_Bool datatype (which when I search..
is available in java it seems). I tested broadcasting a small
boolean array using MPI_INT ...
the problem is that MPI is relatively old now and the C++ interface had
been an add-on. C and Fortran don't have proper "boolean" data types
(see [1]). Either convert your boolean array into something of another
type (like integer array with 1=true and 0=false) or use an MPI
implementation that supports the 2.0 standard. This newer version of
the interface has explicit C++ bindings (see [2]), including
"MPI::BOOL".
Regards,
Christian
[1] http://www.mpi-forum.org/docs/mpi-11-html/node32.html
[2] http://www.mpi-forum.org/docs/mpi-20-html/node229.htm
Loading...