Re: [OMPI users] MPI and C++ (Boost)

2009-07-10 Thread John Phillips

Luis Vitorio Cargnini wrote:
Ok, after all the considerations, I'll try Boost, today, make some 
experiments and see if I can use it or if I'll avoid it yet.


But as said by Raimond I think, the problem is been dependent of a 
rich-incredible-amazing-toolset  but still implementing only MPI-1, 
and do not implement all the MPI functions main drawbacks of boost, but 
the set of functions implemented do not compromise the functionality, i 
don't know about the MPI-1, MPI-2 and future MPI-3 specifications, how 
this specifications implementations affect boost and the developer using 
Boost, with OpenMPI of course.


Continuing if something change in the boost how can I guarantee it won't 
affect my code in the future ? It is impossible.


Anyway I'll test it today and without it and choose my direction, thanks 
for all the replies, suggestions, solutions, that you all pointed to me 
I really appreciate all your help and comments about boost or not my code.


Thanks and Regards.
Vitorio.




  Vitorio,

  If there is some MPI capability that is not currently provided in 
Boost.MPI, then just call it the normal MPI way. Using Boost.MPI doesn't 
interfere with any use of the C bindings, even in the same function.


  As for future changes, if something happens to a boost library that 
you don't like, just keep using the older version. Past releases of 
boost remain available after new releases arrive.


John



Re: [OMPI users] MPI and C++ (Boost)

2009-07-07 Thread John Phillips

Terry Frankcombe wrote:



I understand Luis' position completely.  He wants an MPI program, not a
program that's written in some other environment, no matter how
attractive that may be.  It's like the difference between writing a
numerical program in standard-conforming Fortran and writing it in the
latest flavour of the month interpreted language calling highly
optimised libraries behind the scenes.

IF boost is attached to MPI 3 (or whatever), AND it becomes part of the
mainstream MPI implementations, THEN you can have the discussion again.

Ciao
Terry




  I guess we view it differently. Boost.MPI isn't a language at all. It 
is a library written in fully ISO compliant C++, that exists to make 
doing an otherwise complex and error prone job simpler and more 
readable. As such, I would compare it to using a well tested BLAS 
library to do matrix manipulations in your Fortran code or writing it 
yourself. Both can be standard conforming Fortran (though many BLAS 
implementations include lower level optimized code), and neither is a 
flavor of the month interpreted language. The advantage of the library 
is that it allows you to work at a level of abstraction that may be 
better suited to your work.


  For you, as for everyone else, make your choices based on what you 
believe best serves the needs of your program, whether that includes 
Boost.MPI or not. However, making the choices with an understanding of 
the options strengths and weaknesses gives the best chance of writing a 
good program.


John

PS - I am not part of the MPI Forum, but I would be surprised if they 
chose to add boost to any MPI version. Possibly an analog of Boost.MPI, 
but not all of boost. There are over 100 different libraries, covering 
many different areas of use in boost, and most of them have no direct 
connection to MPI.


PPS - If anyone would like to know more about Boost, I would suggest the 
website (http://www.boost.org) or the user mailing list. Folks who don't 
write in C++ will probably not be very interested.




Re: [OMPI users] MPI and C++ (Boost)

2009-07-07 Thread John Phillips

Luis Vitorio Cargnini wrote:


Your suggestion is a great and interesting idea. I only have the fear to 
get used to the Boost and could not get rid of Boost anymore, because 
one thing is sure the abstraction added by Boost is impressive, it turn 
the things much less painful like MPI to be implemented using C++, also 
the serialization inside Boost::MPI already made by Boost to use MPI is 
astonishing attractive, and of course the possibility to add new types 
like classes to be able to send objects through MPI_Send of Boost, this 
is certainly attractive, but again I do not want to get dependent of a 
library as I said, this is my major concern.

.


  I'm having problems understanding your base argument here. It seems 
to be that you are afraid that Boost.MPI will make your prototype 
program so much better and easier to write that you won't want to remove 
it. Wouldn't this be exactly the reason why keeping it would be good?


  I like and use Boost.MPI. I voted for inclusion during the review in 
the Boost developer community. However, what you should do in your 
program is use those tools that produce the right trade off between the 
best performance, easiest to develop correctly, and most maintainable 
program you can. If that means using Boost.MPI, then remember that 
questions about it are answered at the Boost Users mailing list. If your 
decision is that that does not include Boost.MPI then you will have some 
other challenges to face but experience shows that you can still produce 
a very high quality program.


  Choose as you see fit, just be sure to understand your own reasons. 
(Whether any of the rest of us on this list understand them or not.)


John



Re: [OMPI users] MPI and C++ - now Send and Receive of Classes and STL containers

2009-07-07 Thread John Phillips

Luis Vitorio Cargnini wrote:

just one additional and if I have:
vector< vector > x;

How to use the MPI_Send

MPI_Send([0][0], x[0].size(),MPI_DOUBLE, 2, 0, MPI_COMM_WORLD);

?




  Vitorio,

  The standard provides no information on where the different parts of 
the data will be, relative to each other. In specific, there is no 
reason to believe that the data in the different internally nested 
doubles will be contiguous. (In fact, I know of no platform where it 
will be.) That means trying to send the whole structure at once is 
problematic.


  What you wrote will provide a pointer to the first element of the 
first nested vector to MPI_Send, and the length of that nested vector. 
If that is what you intend, I expect it to work. (I have not tested it, 
so I may be misthinking something here.) The other nested vectors could 
be sent for themselves, using separate MPI_Send calls.


  The only reliable way to send all of the data at once would be to 
serialize it off to a single vector or array for the send, then repack 
it in the structure after it is received.


John