MPE_GetTags(4) NAME MPE_GetTags - Returns tags that can be used in communica- tion with a communicator SYNOPSIS #include#include "mpe.h" int MPE_GetTags( comm_in, ntags, comm_out, first_tag ) MPI_Comm comm_in, *comm_out; int ntags, *first_tag; INPUT PARAMETERS comm_in - Input communicator ntags - Number of tags OUTPUT PARAMETERS comm_out - Output communicator. May be 'comm_in'. first_tag - First tag available RETURNS MPI_SUCCESS on success, MPI error class on failure. NOTES This routine returns the requested number of tags, with the tags being These tags are guarenteed to be unique within 'comm_out'. SEE ALSO MPE_ReturnTags @*/ int MPE_GetTags( comm_in, ntags, comm_out, first_tag ) MPI_Comm comm_in, *comm_out; int ntags, *first_tag; { int mpe_errno = MPI_SUCCESS; int *tagvalp, *maxval, flag; if (MPE_Tag_keyval == MPI_KEYVAL_INVALID) { MPI_Keyval_create( MPI_NULL_COPY_FN, MPE_DelTag, &MPE_Tag_keyval, (void *)0 ); } if ((mpe_errno = MPI_Attr_get( comm_in, MPE_Tag_keyval, &tagvalp, &flag ))) return mpe_errno; if (!flag) { /* This communicator is not yet known to this system, so we dup it and setup the first value */ MPI_Comm_dup( comm_in, comm_out ); comm_in = *comm_out; MPI_Attr_get( MPI_COMM_WORLD, MPI_TAG_UB, &maxval, &flag ); tagvalp = (int *)malloc( 2 * sizeof(int) ); if (!tagvalp) return MPI_ERR_OTHER; *tagvalp = *maxval; *first_tag = *tagvalp - ntags; *tagvalp = *first_tag; MPI_Attr_put( comm_in, MPE_Tag_keyval, tagvalp ); return MPI_SUCCESS; } *comm_out = comm_in; if (*tagvalp INPUT PARAMETERS comm - Communicator to return tags to first_tag - First of the tags to return ntags - Number of tags to return. SEE ALSO MPE_GetTags @*/ int MPE_ReturnTags( comm, first_tag, ntags ) MPI_Comm comm; int first_tag, ntags; { int *tagvalp, flag, mpe_errno; if ((mpe_errno = MPI_Attr_get( comm, MPE_Tag_keyval, &tagvalp, &flag ))) return mpe_errno; if (!flag) { /* Error, attribute does not exist in this com- municator */ return MPI_ERR_OTHER; } if (*tagvalp == first_tag) { *tagvalp = first_tag + ntags; } return MPI_SUCCESS; } /*@ MPE_TagsEnd - Returns the private keyval. NOTES This routine is provided to aid in cleaning up all of the allocated storage in and MPI program. Normally, this rou- tine does `not` need to be called. If it is, it should be called immediately before LOCATION privtags.c Last change: 5/28/1996