.\" -*- nroff -*- .\" Copyright 2013-2014 Los Alamos National Security, LLC. All rights reserved. .\" Copyright 2010 Cisco Systems, Inc. All rights reserved. .\" Copyright 2006-2008 Sun Microsystems, Inc. .\" Copyright (c) 1996 Thinking Machines Corporation .\" $COPYRIGHT$ .TH MPI_Put 3 "May 26, 2022" "4.1.4" "Open MPI" .SH NAME \fBMPI_Put\fP, \fBMPI_Rput\fP \- Copies data from the origin memory to the target. .SH SYNTAX .ft R .SH C Syntax .nf #include MPI_Put(const void *\fIorigin_addr\fP, int \fIorigin_count\fP, MPI_Datatype \fIorigin_datatype\fP, int \fItarget_rank\fP, MPI_Aint \fItarget_disp\fP, int \fItarget_count\fP, MPI_Datatype \fItarget_datatype\fP, MPI_Win \fIwin\fP) MPI_Rput(const void *\fIorigin_addr\fP, int \fIorigin_count\fP, MPI_Datatype \fIorigin_datatype\fP, int \fItarget_rank\fP, MPI_Aint \fItarget_disp\fP, int \fItarget_count\fP, MPI_Datatype \fItarget_datatype\fP, MPI_Win \fIwin\fP, MPI_Request *\fIrequest\fP) .fi .SH Fortran Syntax (see FORTRAN 77 NOTES) .nf USE MPI ! or the older form: INCLUDE 'mpif.h' MPI_PUT(\fIORIGIN_ADDR, ORIGIN_COUNT, ORIGIN_DATATYPE, TARGET_RANK, TARGET_DISP, TARGET_COUNT, TARGET_DATATYPE, WIN, IERROR\fP) \fIORIGIN_ADDR\fP(*) INTEGER(KIND=MPI_ADDRESS_KIND) \fITARGET_DISP\fP INTEGER \fIORIGIN_COUNT, ORIGIN_DATATYPE, TARGET_RANK, TARGET_COUNT, TARGET_DATATYPE, WIN, IERROR\fP MPI_RPUT(\fIORIGIN_ADDR, ORIGIN_COUNT, ORIGIN_DATATYPE, TARGET_RANK, TARGET_DISP, TARGET_COUNT, TARGET_DATATYPE, WIN, REQUEST, IERROR\fP) \fIORIGIN_ADDR\fP(*) INTEGER(KIND=MPI_ADDRESS_KIND) \fITARGET_DISP\fP INTEGER \fIORIGIN_COUNT, ORIGIN_DATATYPE, TARGET_RANK, TARGET_COUNT, TARGET_DATATYPE, WIN, REQUEST, IERROR\fP .fi .SH Fortran 2008 Syntax .nf USE mpi_f08 MPI_Put(\fIorigin_addr\fP, \fIorigin_count\fP, \fIorigin_datatype\fP, \fItarget_rank\fP, \fItarget_disp\fP, \fItarget_count\fP, \fItarget_datatype\fP, \fIwin\fP, \fIierror\fP) TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIorigin_addr\fP INTEGER, INTENT(IN) :: \fIorigin_count\fP, \fItarget_rank\fP, \fItarget_count\fP TYPE(MPI_Datatype), INTENT(IN) :: \fIorigin_datatype\fP, \fItarget_datatype\fP INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN) :: \fItarget_disp\fP TYPE(MPI_Win), INTENT(IN) :: \fIwin\fP INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP MPI_Rput(\fIorigin_addr\fP, \fIorigin_count\fP, \fIorigin_datatype\fP, \fItarget_rank\fP, \fItarget_disp\fP, \fItarget_count\fP, \fItarget_datatype\fP, \fIwin\fP, \fIrequest,\fP \fIierror\fP) TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIorigin_addr\fP INTEGER, INTENT(IN) :: \fIorigin_count\fP, \fItarget_rank\fP, \fItarget_count\fP TYPE(MPI_Datatype), INTENT(IN) :: \fIorigin_datatype\fP, \fItarget_datatype\fP INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN) :: \fItarget_disp\fP TYPE(MPI_Win), INTENT(IN) :: \fIwin\fP TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP .fi .SH C++ Syntax .nf #include void MPI::Win::Put(const void* \fIorigin_addr\fP, int \fIorigin_count\fP, const MPI::Datatype& \fIorigin_datatype\fP, int \fItarget_rank\fP, MPI::Aint \fItarget_disp\fP, int \fItarget_count\fP, const MPI::Datatype& \fItarget_datatype\fP) const .fi .SH INPUT PARAMETERS .ft R .TP 1i origin_addr Initial address of origin buffer (choice). .TP 1i origin_count Number of entries in origin buffer (nonnegative integer). .TP 1i origin_datatype Data type of each entry in origin buffer (handle). .TP 1i target_rank Rank of target (nonnegative integer). .TP 1i target_disp Displacement from start of window to target buffer (nonnegative integer). .TP 1i target_count Number of entries in target buffer (nonnegative integer). .TP 1i target_datatype Data type of each entry in target buffer (handle). .TP 1i win Window object used for communication (handle). .SH OUTPUT PARAMETER .ft R .TP 1i request MPI_Rput: RMA request .TP 1i IERROR Fortran only: Error status (integer). .SH DESCRIPTION .ft R \fBMPI_Put\fP transfers \fIorigin_count\fP successive entries of the type specified by \fIorigin_datatype\fP, starting at address \fIorigin_addr\fP on the origin node to the target node specified by the \fIwin\fP, \fItarget_rank\fP pair. The data are written in the target buffer at address \fItarget_addr\fP = \fIwindow_base\fP + \fItarget_disp\fP x \fIdisp_unit\fP, where \fIwindow_base\fP and \fIdisp_unit\fP are the base address and window displacement unit specified at window initialization, by the target process. .sp The target buffer is specified by the arguments \fItarget_count\fP and \fItarget_datatype\fP. .sp The data transfer is the same as that which would occur if the origin process executed a send operation with arguments \fIorigin_addr\fP, \fIorigin_count\fP, \fIorigin_datatype\fP, \fItarget_rank\fP, \fItag\fP, \fIcomm\fP, and the target process executed a receive operation with arguments \fItarget_addr\fP, \fItarget_count\fP, \fItarget_datatype\fP, \fIsource\fP, \fItag\fP, \fIcomm\fP, where \fItarget_addr\fP is the target buffer address computed as explained above, and \fIcomm\fP is a communicator for the group of \fIwin\fP. .sp The communication must satisfy the same constraints as for a similar message-passing communication. The \fItarget_datatype\fP may not specify overlapping entries in the target buffer. The message sent must fit, without truncation, in the target buffer. Furthermore, the target buffer must fit in the target window. In addition, only processes within the same buffer can access the target window. .sp The \fItarget_datatype\fP argument is a handle to a datatype object defined at the origin process. However, this object is interpreted at the target process: The outcome is as if the target datatype object were defined at the target process, by the same sequence of calls used to define it at the origin process. The target data type must contain only relative displacements, not absolute addresses. The same holds for get and accumulate. .sp \fBMPI_Rput\fP is similar to \fBMPI_Put\fP, except that it allocates a communication request object and associates it with the request handle (the argument \fIrequest\fP). The completion of an MPI_Rput operation (i.e., after the corresponding test or wait) indicates that the sender is now free to update the locations in the \fIorigin_addr\fP buffer. It does not indicate that the data is available at the target window. If remote completion is required, \fBMPI_Win_flush\fP, \fBMPI_Win_flush_all\fP, \fBMPI_Win_unlock\fP, or \fBMPI_Win_unlock_all\fP can be used. .SH NOTES The \fItarget_datatype\fP argument is a handle to a datatype object that is defined at the origin process, even though it defines a data layout in the target process memory. This does not cause problems in a homogeneous or heterogeneous environment, as long as only portable data types are used (portable data types are defined in Section 2.4 of the MPI-2 Standard). .sp The performance of a put transfer can be significantly affected, on some systems, from the choice of window location and the shape and location of the origin and target buffer: Transfers to a target window in memory allocated by MPI_Alloc_mem may be much faster on shared memory systems; transfers from contiguous buffers will be faster on most, if not all, systems; the alignment of the communication buffers may also impact performance. .SH FORTRAN 77 NOTES .ft R The MPI standard prescribes portable Fortran syntax for the \fITARGET_DISP\fP argument only for Fortran 90. FORTRAN 77 users may use the non-portable syntax .sp .nf INTEGER*MPI_ADDRESS_KIND \fITARGET_DISP\fP .fi .sp where MPI_ADDRESS_KIND is a constant defined in mpif.h and gives the length of the declared integer in bytes. .SH ERRORS Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ functions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism will be used to throw an MPI::Exception object. .sp Before the error value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error. .SH SEE ALSO .ft R .sp MPI_Get MPI_Rget .br MPI_Accumulate MPI_Win_flush MPI_Win_flush_all MPI_Win_unlock MPI_Win_unlock_all