MPI C++

Jun 23, 2010 at 9:07am
Dear everybody,

could anyone help me on how to make MPI library working?
is there a program to install other than a c++ compiler for example? since MPI isn't a language by itself, it's just a library?

Thanks in advance

ps: i have cygwin for windows as a compiler
Jun 23, 2010 at 10:56am
closed account (z05DSL3A)
This may be a good place to start.
Open MPI: http://www.open-mpi.org/
Jun 23, 2010 at 4:14pm
closed account (1yR4jE8b)
I've never been able to succesfully compile Open MPI from source, either using GCC or Visual C++.

I've always done any MPI stuff in Ubuntu/Linux where I can just
sudo apt-get install libopenmpi-dev openmpi-bin
then compile my programs using
mpicc
.

From what I can remember off the top of my head, the C++ bindings of openmpi are
unfortunately being deprecated (or already are), you're better off using the C bindings.
I've always used the C bindings, and find it extremely easy to use, and you can use C-MPI in C++ programs no problem.
Last edited on Jun 23, 2010 at 4:14pm
Jul 7, 2010 at 12:30pm
thx darkestfright, but am using mpi under windows, so I get use get-apt etc...
am actually running mpi using Miscrosoft Visual Studio 2005. about using c, am obliged to use C++, since the project am currently working on is already implemented using C++, am limited to what I already have.

here is another question:

while am running a simple MPI application that fills in a 10x10 multi-dimentional array using 4 processes, the whole 4 processes are using the same random function, that is, each 4 rows of the array are identical. do you have any idea how to force function rand() to give different values for each process?
if you want the code, i can send it
Thank you in advance,
Jul 8, 2010 at 4:12pm
closed account (1yR4jE8b)
The beauty of the C++ language is that it is backwards compatible with the C language, you can mix properly written C code with C++ and it will compile and work exactly the same. You don't need to switch your project to C, you can just include the C-MPI headers and away you go. I do it all the time without any problems. Unless you are forbidden to mix and match C and C++ by some ridiculous employer coding-standards, then I don't see the problem, considering the OpenMPI developers straight up tell you not to use the C++ bindings and just mix your C++ with C instead.

As far as rand()'ing in different processes...I'm not sure, but have you tried to srand() in each seperate process? I've never had to fill an array with random values in parallel, I usually just fill the array in the Master process and then Scatter it out to the Slaves.
Topic archived. No new replies allowed.