|
| 1 | +/* |
| 2 | + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana |
| 3 | + * University Research and Technology |
| 4 | + * Corporation. All rights reserved. |
| 5 | + * Copyright (c) 2004-2005 The University of Tennessee and The University |
| 6 | + * of Tennessee Research Foundation. All rights |
| 7 | + * reserved. |
| 8 | + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, |
| 9 | + * University of Stuttgart. All rights reserved. |
| 10 | + * Copyright (c) 2004-2005 The Regents of the University of California. |
| 11 | + * All rights reserved. |
| 12 | + * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. |
| 13 | + * Copyright (c) 2015-2019 Research Organization for Information Science |
| 14 | + * and Technology (RIST). All rights reserved. |
| 15 | + * $COPYRIGHT$ |
| 16 | + * |
| 17 | + * Additional copyrights may follow |
| 18 | + * |
| 19 | + * $HEADER$ |
| 20 | + */ |
| 21 | + |
| 22 | +#include "ompi_config.h" |
| 23 | + |
| 24 | +#include "ompi/mpi/fortran/mpif-h/bindings.h" |
| 25 | +#include "ompi/mpi/fortran/use-mpi-f08/cdesc/bindings.h" |
| 26 | +#include "ompi/mpi/fortran/base/constants.h" |
| 27 | + |
| 28 | +void ompi_recv_init_cdesc(CFI_cdesc_t* x, MPI_Fint *count, MPI_Fint *datatype, |
| 29 | + MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, |
| 30 | + MPI_Fint *request, MPI_Fint *ierr) |
| 31 | +{ |
| 32 | + int c_ierr; |
| 33 | + MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype); |
| 34 | + MPI_Request c_req; |
| 35 | + MPI_Comm c_comm; |
| 36 | + void *buf = x->base_addr; |
| 37 | + int c_count = OMPI_FINT_2_INT(*count); |
| 38 | + |
| 39 | + c_comm = PMPI_Comm_f2c (*comm); |
| 40 | + |
| 41 | + c_datatype = c_type; |
| 42 | + if (x->rank != 0 && !CFI_is_contiguous(x)) { |
| 43 | + c_ierr = cdesc_create_datatype(x, c_count, c_type, &c_datatype); |
| 44 | + if (MPI_SUCCESS != c_ierr) { |
| 45 | + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); |
| 46 | + return; |
| 47 | + } |
| 48 | + c_count = 1; |
| 49 | + } |
| 50 | + c_ierr = PMPI_Recv_init(OMPI_F2C_BOTTOM(buf), c_count, |
| 51 | + c_datatype, OMPI_FINT_2_INT(*source), |
| 52 | + OMPI_INT_2_FINT(*tag), c_comm, |
| 53 | + &c_req); |
| 54 | + if (c_datatype != c_type) { |
| 55 | + ompi_datatype_destroy(&c_datatype); |
| 56 | + } |
| 57 | + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); |
| 58 | + |
| 59 | + if (MPI_SUCCESS == c_ierr) { |
| 60 | + *request = PMPI_Request_c2f(c_req); |
| 61 | + } |
| 62 | +} |
0 commit comments