|
| 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) 2012 Cisco Systems, Inc. All rights reserved. |
| 13 | + * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. |
| 14 | + * Copyright (c) 2015-2019 Research Organization for Information Science |
| 15 | + * and Technology (RIST). All rights reserved. |
| 16 | + * Copyright (c) 2015 FUJITSU LIMITED. All rights reserved. |
| 17 | + * $COPYRIGHT$ |
| 18 | + * |
| 19 | + * Additional copyrights may follow |
| 20 | + * |
| 21 | + * $HEADER$ |
| 22 | + */ |
| 23 | + |
| 24 | +#include "ompi_config.h" |
| 25 | + |
| 26 | +#include "ompi/mpi/fortran/mpif-h/bindings.h" |
| 27 | +#include "ompi/mpi/fortran/use-mpi-f08/cdesc/bindings.h" |
| 28 | +#include "ompi/mpi/fortran/mpif-h/status-conversion.h" |
| 29 | +#include "ompi/mpi/fortran/base/constants.h" |
| 30 | +#include "ompi/communicator/communicator.h" |
| 31 | + |
| 32 | +void ompi_mrecv_cdesc(CFI_cdesc_t* x, MPI_Fint *count, MPI_Fint *datatype, |
| 33 | + MPI_Fint *message, MPI_Fint *status, MPI_Fint *ierr) |
| 34 | +{ |
| 35 | + int c_ierr; |
| 36 | + OMPI_FORTRAN_STATUS_DECLARATION(c_status,c_status2) |
| 37 | + MPI_Message c_message = PMPI_Message_f2c(*message); |
| 38 | + MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype); |
| 39 | + void *buf = x->base_addr; |
| 40 | + int c_count = OMPI_FINT_2_INT(*count); |
| 41 | + |
| 42 | + OMPI_FORTRAN_STATUS_SET_POINTER(c_status,c_status2,status) |
| 43 | + |
| 44 | + /* Call the C function */ |
| 45 | + if (x->rank != 0 && !CFI_is_contiguous(x)) { |
| 46 | + c_ierr = cdesc_create_datatype(x, c_count, c_type, &c_datatype); |
| 47 | + if (MPI_SUCCESS != c_ierr) { |
| 48 | + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); |
| 49 | + return; |
| 50 | + } |
| 51 | + c_count = 1; |
| 52 | + } |
| 53 | + c_ierr = OMPI_INT_2_FINT(PMPI_Mrecv(OMPI_F2C_BOTTOM(buf), c_count, |
| 54 | + c_datatype, &c_message, |
| 55 | + c_status)); |
| 56 | + if (c_datatype != c_type) { |
| 57 | + ompi_datatype_destroy(&c_datatype); |
| 58 | + } |
| 59 | + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); |
| 60 | + |
| 61 | + if (MPI_SUCCESS == c_ierr) { |
| 62 | + OMPI_FORTRAN_STATUS_RETURN(c_status,c_status2,status,c_ierr) |
| 63 | + /* message is an INOUT, and may be updated by the recv */ |
| 64 | + *message = PMPI_Message_c2f(c_message); |
| 65 | + } |
| 66 | +} |
0 commit comments