/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* * * (C) 2001 by Argonne National Laboratory. * See COPYRIGHT in top-level directory. */ #include "mpiimpl.h" #include "bsendutil.h" /* -- Begin Profiling Symbol Block for routine MPI_Bsend */ #if defined(HAVE_PRAGMA_WEAK) #pragma weak MPI_Bsend = PMPI_Bsend #elif defined(HAVE_PRAGMA_HP_SEC_DEF) #pragma _HP_SECONDARY_DEF PMPI_Bsend MPI_Bsend #elif defined(HAVE_PRAGMA_CRI_DUP) #pragma _CRI duplicate MPI_Bsend as PMPI_Bsend #elif defined(HAVE_WEAK_ATTRIBUTE) int MPI_Bsend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) __attribute__ ((weak, alias("PMPI_Bsend"))); #endif /* -- End Profiling Symbol Block */ /* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build the MPI routines */ #ifndef MPICH_MPI_FROM_PMPI #undef MPI_Bsend #define MPI_Bsend PMPI_Bsend #endif #undef FUNCNAME #define FUNCNAME MPI_Bsend #undef FCNAME #define FCNAME MPL_QUOTE(FUNCNAME) /*@ MPI_Bsend - Basic send with user-provided buffering Input Parameters: + buf - initial address of send buffer (choice) . count - number of elements in send buffer (nonnegative integer) . datatype - datatype of each send buffer element (handle) . dest - rank of destination (integer) . tag - message tag (integer) - comm - communicator (handle) Notes: This send is provided as a convenience function; it allows the user to send messages without worring about where they are buffered (because the user `must` have provided buffer space with 'MPI_Buffer_attach'). In deciding how much buffer space to allocate, remember that the buffer space is not available for reuse by subsequent 'MPI_Bsend's unless you are certain that the message has been received (not just that it should have been received). For example, this code does not allocate enough buffer space .vb MPI_Buffer_attach(b, n*sizeof(double) + MPI_BSEND_OVERHEAD); for (i=0; i