2004-01-09 11:30:19 +03:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* 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.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-01-09 11:30:19 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#ifndef OMPI_C_BINDINGS_H
|
|
|
|
#define OMPI_C_BINDINGS_H
|
2004-01-09 11:30:19 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-01-09 11:30:19 +03:00
|
|
|
#include "mpi.h"
|
2005-09-12 13:17:44 +04:00
|
|
|
#include "ompi/communicator/communicator.h"
|
2006-03-16 12:42:46 +03:00
|
|
|
#include "ompi/datatype/datatype.h"
|
2005-09-12 13:17:44 +04:00
|
|
|
|
2004-10-21 02:31:03 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2006-03-29 13:26:27 +04:00
|
|
|
|
2004-01-09 11:30:19 +03:00
|
|
|
/* If compiling in the profile directory, then we don't have weak
|
|
|
|
symbols and therefore we need the defines to map from MPI->PMPI.
|
|
|
|
NOTE: pragma weak stuff is handled on a file-by-file basis; it
|
|
|
|
doesn't work to simply list all of the pragmas in a top-level
|
|
|
|
header file. */
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
/* This variable is actually in src/mpi/runtime/ompi_mpi_init.c, but it
|
2004-02-14 00:13:57 +03:00
|
|
|
is used by every MPI function. */
|
|
|
|
|
2006-03-29 13:26:27 +04:00
|
|
|
OMPI_DECLSPEC extern bool ompi_mpi_param_check;
|
2004-02-14 00:13:57 +03:00
|
|
|
|
2004-07-19 22:37:15 +04:00
|
|
|
/* These macros have to be used to check the corectness of the datatype depending on the
|
|
|
|
* operations that we have to do with them. They can be used on all functions, not only
|
|
|
|
* on the top level MPI functions, as they does not trigger the error handler. Is the user
|
|
|
|
* responsability to do it.
|
|
|
|
*/
|
2004-10-10 04:22:23 +04:00
|
|
|
#define OMPI_CHECK_DATATYPE_FOR_SEND( RC, DDT, COUNT ) \
|
2006-03-29 13:26:27 +04:00
|
|
|
do { \
|
|
|
|
/* (RC) = MPI_SUCCESS; */ \
|
|
|
|
if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \
|
|
|
|
else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \
|
|
|
|
else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
|
|
|
else if( !ompi_ddt_is_valid((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
|
|
|
} while (0)
|
2004-10-10 04:22:23 +04:00
|
|
|
|
2006-03-29 13:26:27 +04:00
|
|
|
#define OMPI_CHECK_DATATYPE_FOR_RECV( RC, DDT, COUNT ) \
|
|
|
|
do { \
|
|
|
|
/* (RC) = MPI_SUCCESS; */ \
|
|
|
|
if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \
|
|
|
|
else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \
|
|
|
|
else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
|
|
|
/* XXX Fix flags else if( ompi_ddt_is_overlapped((DDT)) ) (RC) = MPI_ERR_TYPE; */ \
|
|
|
|
else if( !ompi_ddt_is_valid((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
|
|
|
} while (0)
|
|
|
|
|
2004-10-10 04:22:23 +04:00
|
|
|
#define OMPI_CHECK_DATATYPE_FOR_ONE_SIDED( RC, DDT, COUNT ) \
|
2006-03-29 13:26:27 +04:00
|
|
|
do { \
|
|
|
|
/*(RC) = MPI_SUCCESS; */ \
|
|
|
|
if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \
|
|
|
|
else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \
|
|
|
|
else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
|
|
|
else if( ompi_ddt_is_overerlapped((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
|
|
|
else if( !ompi_ddt_is_acceptable_for_one_sided((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
|
|
|
else if( !ompi_ddt_is_valid((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
|
|
|
} while(0)
|
|
|
|
|
2004-07-19 22:37:15 +04:00
|
|
|
|
2006-03-29 13:26:27 +04:00
|
|
|
/* This macro has to be used to check the correctness of the user buffer depending on the datatype.
|
|
|
|
* This macro expects that the DDT parameter is a valid pointer to an ompi datatype object.
|
|
|
|
*/
|
|
|
|
#define OMPI_CHECK_USER_BUFFER(RC, BUFFER, DDT, COUNT) \
|
|
|
|
do { \
|
|
|
|
if ( NULL == (BUFFER) && 0 < (COUNT) && MPI_SUCCESS == (RC) ) { \
|
|
|
|
if ( (DDT)->flags & DT_FLAG_PREDEFINED ) { \
|
|
|
|
(RC) = MPI_ERR_BUFFER; \
|
|
|
|
} else { \
|
|
|
|
unsigned long size = 0; \
|
|
|
|
ompi_ddt_get_size((DDT), &size); \
|
|
|
|
if ( size ) { \
|
|
|
|
(RC) = MPI_ERR_BUFFER; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2004-10-21 02:31:03 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
2006-03-29 13:26:27 +04:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#endif /* OMPI_C_BINDINGS_H */
|