mgilson mgilson -3 years ago 102
C Question

how is MPI_Send implemented with MPI_Character?

In fortran, I can declare a character string as:

character*80 mystring


and then send it as:

call MPI_Send(mystring,len(mystring),MPI_CHARACTER,...,ierr)


Alternatively, I could declare my string as an array of characters (much more in line with the way things are traditionally done in C)

character mystring(80)


and then send it as:

call MPI_Send(mystring,80,MPI_CHARACTER,...,ierr)


My understanding is that these two calls would have different interfaces when calling a C function. (the former is often implemented by the compiler by passing an additional parameter by value which holds the length of the string, whereas the latter does not pass that parameter). So, how does the MPI Implementation (typically written in C) know the difference?

Answer Source
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download