MPI_TYPE_DUP_FN(3)
π MPI_TYPE_DUP_FN π
okay bestie, welcome to the LAM/MPI corner of the manual, where we talk about the built-in MPI function that simple-mindedly copies datatype attributes. yes. simple-mindedly. it said what it said. π«Ά
β¨ NAME β¨
MPI_TYPE_DUP_FN β the built-in MPI function that simple-mindedly copies datatype attributes. no thoughts, just copying. it's giving copy-paste energy and honestly? we respect it. π
πΈ SYNOPSIS πΈ
#include <mpi.h>
int MPI_TYPE_DUP_FN(MPI_Datatype dtype, int key,
void *extra, void *attrin, void *attrout,
int *flag)
π INPUT PARAMETERS π
dtypeβ communicator (handle). yes bestie, the manpage literally calls it a communicator even though it's aMPI_Datatype. that's just what it says. we don't make the rules, we just copy them verbatim. πkeyβ key value (integer)extraβ extra stateattrinβ in value for attribute
π¦ OUTPUT PARAMETERS π¦
attroutβ out value for attributeflagβ1if attribute copied successfully,0otherwise (logical). spoiler alert though: it's always gonna be1. more on that in a sec. β
π NOTES π
okay so here's the tea. β
This function blindly byte-copies attributes on datatypes. no deep thoughts, no introspection, just vibes and bytes. It is the default attribute-copying function for datatypes. And the way that it's literally always gonna work β this function will always return MPI_SUCCESS, and flag will always be set to 1. periodt. π₯
The actual copy is performed by the code:
*((void **) attrout) = attrin;
that's it. that's the whole trick. one pointer assignment. iconic behavior honestly. β¨
If this simple assignment is not sufficient for your attributes, you will need to reassign the attribute-copying function on relevant keyvals on datatypes with the MPI_Type_keyval_create function. so like, if your attribute is more complicated than a pointer (and it might be, no shade), this default is NOT gonna cut it and you gotta go set up your own. π§
π NOTES FOR FORTRAN π
All MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) have an additional argument ierr at the end of the argument list. ierr is an integer and has the same meaning as the return value of the routine in C. In Fortran, MPI routines are subroutines, and they are invoked with the call statement. so yes, extra arg, same meaning, call statement, we love consistency. π
All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. not handles, not pointers, just INTEGER. slay. π§
β SEE ALSO β
MPI_Type_keyval_createβ go look at this one if you need to swap out the copying behavior, bestie, it's the whole point π―
π MORE INFORMATION π
For more information, please see the official MPI Forum web site, which contains the text of both the MPI-1 and MPI-2 standards. These documents contain detailed information about each MPI function (most of which is not duplicated in these man pages). like fr fr, the real lore is over there.
π ACKNOWLEDGEMENTS π
The LAM Team would like the thank the MPICH Team for the handy program to generate man pages ("doctext" from ftp://ftp.mcs.anl.gov/pub/sowing/sowing.tar.gz), the initial formatting, and some initial text for most of the MPI-1 man pages. shoutout MPICH, y'all ate. π
(yes, the original says "would like the thank." we are keeping it. character for character. no cap.) π
π LOCATION π
dupfn.c
and that's the whole page, bestie!! written up in LAM/MPI 7.1.4, dated 6/24/2006 β a vintage drop, honestly, still hits. stay slaying those datatypes and remember: if the pointer assignment isn't enough, go make your own copy function. mwah. ππ β¨
π¦ where this page comes from
- debian bookworm: lam4-dev 7.1.4-7+b1
- debian trixie: lam4-dev 7.1.4-7.2
- ubuntu jammy: lam4-dev 7.1.4-7
- ubuntu noble: lam4-dev 7.1.4-7.1build2
- ubuntu questing: lam4-dev 7.1.4-8
- ubuntu resolute: lam4-dev 7.1.4-8build1
- ubuntu stonking: lam4-dev 7.1.4-8build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms