-
Notifications
You must be signed in to change notification settings - Fork 858
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Howard Pritchard <howardp@lanl.gov>
- Loading branch information
Showing
5 changed files
with
101 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana | ||
* University Research and Technology | ||
* Corporation. All rights reserved. | ||
* Copyright (c) 2004-2005 The University of Tennessee and The University | ||
* of Tennessee Research Foundation. All rights | ||
* reserved. | ||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, | ||
* University of Stuttgart. All rights reserved. | ||
* Copyright (c) 2004-2005 The Regents of the University of California. | ||
* All rights reserved. | ||
* Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved. | ||
* Copyright (c) 2015-2019 Research Organization for Information Science | ||
* and Technology (RIST). All rights reserved. | ||
* $COPYRIGHT$ | ||
* | ||
* Additional copyrights may follow | ||
* | ||
* $HEADER$ | ||
*/ | ||
|
||
PROTOTYPE VOID scatter_init(BUFFER x1, COUNT sendcount, | ||
DATATYPE sendtype, BUFFER_OUT x2, | ||
COUNT recvcount, DATATYPE recvtype, | ||
RANK root, COMM comm, INFO info, REQUEST_OUT request) | ||
{ | ||
int c_ierr; | ||
MPI_Comm c_comm = PMPI_Comm_f2c(*comm); | ||
int c_root = OMPI_FINT_2_INT(*root); | ||
MPI_Datatype c_sendtype = NULL, c_recvtype = NULL, c_recvdatatype = NULL; | ||
void *sendbuf = OMPI_CFI_BASE_ADDR(x1), *recvbuf = OMPI_CFI_BASE_ADDR(x2); | ||
MPI_Info c_info; | ||
MPI_Request c_request; | ||
@COUNT_TYPE@ c_sendcount = 0, c_recvcount = 0; | ||
|
||
c_info = PMPI_Info_f2c(*info); | ||
|
||
if (OMPI_COMM_IS_INTER(c_comm)) { | ||
if (MPI_ROOT == c_root) { | ||
c_sendtype = PMPI_Type_f2c(*sendtype); | ||
c_sendcount = (@COUNT_TYPE@) *sendcount; | ||
OMPI_CFI_CHECK_CONTIGUOUS(x1, c_ierr); | ||
if (MPI_SUCCESS != c_ierr) { | ||
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); | ||
OMPI_ERRHANDLER_INVOKE(c_comm, c_ierr, FUNC_NAME) | ||
return; | ||
} | ||
} else if (MPI_PROC_NULL != c_root) { | ||
c_recvtype = PMPI_Type_f2c(*recvtype); | ||
c_recvcount = (@COUNT_TYPE@) *recvcount; | ||
OMPI_CFI_2_C(x2, c_recvcount, c_recvtype, c_recvdatatype, c_ierr); | ||
if (MPI_SUCCESS != c_ierr) { | ||
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); | ||
OMPI_ERRHANDLER_INVOKE(c_comm, c_ierr, FUNC_NAME) | ||
return; | ||
} | ||
} | ||
} else { | ||
if (ompi_comm_rank(c_comm) == c_root) { | ||
c_sendtype = PMPI_Type_f2c(*sendtype); | ||
c_sendcount = (@COUNT_TYPE@) *sendcount; | ||
OMPI_CFI_CHECK_CONTIGUOUS(x1, c_ierr); | ||
if (MPI_SUCCESS != c_ierr) { | ||
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); | ||
OMPI_ERRHANDLER_INVOKE(c_comm, c_ierr, FUNC_NAME) | ||
return; | ||
} | ||
} | ||
if (OMPI_IS_FORTRAN_IN_PLACE(recvbuf)) { | ||
recvbuf = MPI_IN_PLACE; | ||
} else { | ||
c_recvtype = PMPI_Type_f2c(*recvtype); | ||
c_recvcount = (@COUNT_TYPE@) *recvcount; | ||
OMPI_CFI_2_C(x2, c_recvcount, c_recvtype, c_recvdatatype, c_ierr); | ||
if (MPI_SUCCESS != c_ierr) { | ||
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); | ||
OMPI_ERRHANDLER_INVOKE(c_comm, c_ierr, FUNC_NAME) | ||
return; | ||
} | ||
} | ||
} | ||
|
||
sendbuf = (char *) OMPI_F2C_BOTTOM(sendbuf); | ||
recvbuf = (char *) OMPI_F2C_BOTTOM(recvbuf); | ||
|
||
c_ierr = @INNER_CALL@(sendbuf,c_sendcount, c_sendtype, | ||
recvbuf, c_recvcount, c_recvdatatype, | ||
c_root, c_comm, c_info, &c_request); | ||
if (MPI_SUCCESS == c_ierr) { | ||
*request = PMPI_Request_c2f(c_request); | ||
} | ||
|
||
if ((c_recvdatatype != NULL ) && (c_recvdatatype != c_recvtype)){ | ||
ompi_datatype_destroy(&c_recvdatatype); | ||
} | ||
|
||
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); | ||
|
||
} |