openmpi  3.1.6
About: Open MPI is a high performance Message Passing Interface (MPI) library project combining technologies and resources from several other projects (FT-MPI, LA-MPI, LAM/MPI, and PACX-MPI) in order to build the best MPI library available. 3.x series.
  Fossies Dox: openmpi-3.1.6.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

bindings.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
3  * University Research and Technology
4  * Corporation. All rights reserved.
5  * Copyright (c) 2004-2006 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) 2010 Cisco Systems, Inc. All rights reserved.
13  * $COPYRIGHT$
14  *
15  * Additional copyrights may follow
16  *
17  * $HEADER$
18  */
19 
20 #ifndef OMPI_C_BINDINGS_H
21 #define OMPI_C_BINDINGS_H
22 
23 #include "ompi_config.h"
24 #include "mpi.h"
26 
27 /* This library needs to be here so that we can define
28  * the OPAL_CR_* checks
29  */
30 #include "opal/runtime/opal_cr.h"
31 
33 
34 /* If compiling in the profile directory, then we don't have weak
35  symbols and therefore we need the defines to map from MPI->PMPI.
36  NOTE: pragma weak stuff is handled on a file-by-file basis; it
37  doesn't work to simply list all of the pragmas in a top-level
38  header file. */
39 
40 /* These macros have to be used to check the corectness of the datatype depending on the
41  * operations that we have to do with them. They can be used on all functions, not only
42  * on the top level MPI functions, as they does not trigger the error handler. Is the user
43  * responsability to do it.
44  */
45 #define OMPI_CHECK_DATATYPE_FOR_SEND( RC, DDT, COUNT ) \
46  do { \
47  /* (RC) = MPI_SUCCESS; */ \
48  if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \
49  else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \
50  else if( !opal_datatype_is_committed(&((DDT)->super)) ) (RC) = MPI_ERR_TYPE; \
51  else if( !opal_datatype_is_valid(&((DDT)->super)) ) (RC) = MPI_ERR_TYPE; \
52  } while (0)
53 
54 #define OMPI_CHECK_DATATYPE_FOR_RECV( RC, DDT, COUNT ) \
55  do { \
56  /* (RC) = MPI_SUCCESS; */ \
57  if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \
58  else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \
59  else if( !opal_datatype_is_committed(&((DDT)->super)) ) (RC) = MPI_ERR_TYPE; \
60  /* XXX Fix flags else if( ompi_datatype_is_overlapped((DDT)) ) (RC) = MPI_ERR_TYPE; */ \
61  else if( !opal_datatype_is_valid(&((DDT)->super)) ) (RC) = MPI_ERR_TYPE; \
62  } while (0)
63 
64 #define OMPI_CHECK_DATATYPE_FOR_ONE_SIDED( RC, DDT, COUNT ) \
65  do { \
66  /*(RC) = MPI_SUCCESS; */ \
67  if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \
68  else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \
69  else if( !opal_datatype_is_committed(&((DDT)->super)) ) (RC) = MPI_ERR_TYPE; \
70  else if( opal_datatype_is_overlapped(&((DDT)->super)) ) (RC) = MPI_ERR_TYPE; \
71  else if( !opal_datatype_is_valid(&((DDT)->super)) ) (RC) = MPI_ERR_TYPE; \
72  } while(0)
73 
74 
75 /* This macro has to be used to check the correctness of the user buffer depending on the datatype.
76  * This macro expects that the DDT parameter is a valid pointer to an ompi datatype object.
77  */
78 #define OMPI_CHECK_USER_BUFFER(RC, BUFFER, DDT, COUNT) \
79  do { \
80  if ( NULL == (BUFFER) && 0 < (COUNT) && MPI_SUCCESS == (RC) ) { \
81  if ( (DDT)->super.flags & OPAL_DATATYPE_FLAG_PREDEFINED ) { \
82  (RC) = MPI_ERR_BUFFER; \
83  } else { \
84  size_t size = 0; \
85  ptrdiff_t true_lb = 0; \
86  ptrdiff_t true_extended = 0; \
87  ompi_datatype_type_size((DDT), &size); \
88  ompi_datatype_get_true_extent((DDT), &true_lb, &true_extended); \
89  if ( 0 < size && 0 == true_lb ) { \
90  (RC) = MPI_ERR_BUFFER; \
91  } \
92  } \
93  } \
94  } while (0)
95 
97 
98 #endif /* OMPI_C_BINDINGS_H */
opal_cr.h
BEGIN_C_DECLS
#define BEGIN_C_DECLS
code that should be in ompi_config_bottom.h regardless of build status
Definition: opal_config_bottom.h:85
ompi_datatype.h
ompi_config.h
END_C_DECLS
#define END_C_DECLS
Definition: opal_config_bottom.h:86