Re: [MPI3 Fortran] Proposing changes to Fortran 2008
On Mar 18, 2008, at 10:08 AM, Craig Rasmussen wrote:
I admit that I know so little about Fortran that much of your mail went over my head. :-( But a question about the above: is it possible to allow non-contiguous datatypes to be passed through without having the compiler copy them into contiguous areas? It may be possible, for example, for the MPI datatype to accurately describe the non-contiguousness of the data, and MPI is well-equipped to handle such situations.
I'm not sure I understand MPI datatypes to respond coherently, but that's never stopped me before :-)
I think you really want contiguous"ness", otherwise you wouldn't know how to stride through the data with constant offsets. Right?
No. MPI datatypes are a rich abstraction that allow the description of a variety of different layouts in memory (such as constant strides, etc.). Specifically: in C, there is no requirement for a contiguous buffer. As long as the accompanying MPI datatype accurately describes the buffer, you're good to go. This is one of the reasons that MPI requires a datatype argument -- because even though modern languages such as C++ and Fortran can derive a type from the buffer argument, what if the actual memory layout differs from that of the buffer argument type? For example: struct foo { char c; double d; } struct foo instance; MPI_Send(&instance->c, ...); What is passed is a pointer to a character. But what you really want to send is the whole struct (which likely has a big hole in its memory map). Likewise, the type in the following call doesn't tell anything to MPI, and an explicit datatype is required: MPI_Send(&instance, ...) And note that &instance == &instance->c. -- Jeff Squyres Cisco Systems
participants (1)
-
Jeff Squyres