On Sep 15, 2004, at 12:50 PM, Kevin Kuo wrote:
> I have LAM/MPI 7.0.6 running on a small linux cluster. When I tried to
> compile a c++ project I get the following errors in constant.h
>
> /usr/local/lam/include/mpi2cxx/constants.h:128: redeclaration of C++
> built-in
> type `int'
> /usr/local/lam/include/mpi2cxx/constants.h:129: declaration does not
> declare
> anything
>
> my g++ version is "3.2 20020903 (Red Hat Linux 8.0 3.2-7)"
>
> here is what constants.h says:
>
> 127 // c++ types
> 128 extern const Datatype BOOL;
Can you run this through the preparser can see what the output is?
i.e., perhaps "BOOL" was defined to "int" somewhere...?
> 129 extern const Datatype COMPLEX;
> 130 extern const Datatype DOUBLE_COMPLEX;
> 131 extern const Datatype LONG_DOUBLE_COMPLEX;
>
> so what's wrong here? If I put a #if 0...#endif block around these
> lines, it will continue to compile, but why was there an error in the
> first place?
>
> Secondly, I have access to some C/C++ code that uses MPI_DOUBLE_COMPLEX
> data type in the MPI_Datatype argument for Send, recv, etc. This type
> is suppose to be only Fortran only? Mpich 1.2.6 allows me to compile
> it, but breaks on the offending line when executing, while lam-7.0.6
> does not allow me to compile it, saying that MPI_DOUBLE_COMPLEX is
> undefined. So which implementation has it correct? I imagine LAM's
> got
> it correct because C doesn't have any support for COMPLEX numbers and
> the users have to use MPI's functions to generate derived types for the
> Complex structures.
Technically, the MPI standard doesn't say that you have to implement
MPI_DOUBLE_COMPLEX in C -- it is supposed to be a fortran type
(analogously, MPI::DOUBLE_COMPLEX is C++ only). For example, there's
also no MPI_INTEGER available in C (the fortran integer) -- there's
only MPI_INT.
You're correct that C99 defines a complex type in C, but that type
didn't exist when the MPI standard was written (1994, 1996). :-)
> Thirdly, if I generate a derived type for a structure (call it Complex)
> in C, and I want to send an array of these Complex structures, is the
> count field the number the number of elements in the array (using
> MPI_Type_vector), or should the derived type be generated for the array
> of Complex objects and in that case the count is 1? Thanks for any
> feedback.
In MPI, "count" refers to the number of datatype instances that you
want to send. So if you make a datatype representing a complex, if you
want to send 3 of those complex instances, your count would be 3.
Make sense?
--
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/
|