This source file includes following definitions.
- MPI_Get_count
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "ompi_config.h"
25 #include <stdio.h>
26 #include <limits.h>
27
28 #include "ompi/mpi/c/bindings.h"
29 #include "ompi/runtime/params.h"
30 #include "ompi/communicator/communicator.h"
31 #include "ompi/errhandler/errhandler.h"
32 #include "ompi/datatype/ompi_datatype.h"
33 #include "ompi/memchecker.h"
34
35 #if OMPI_BUILD_MPI_PROFILING
36 #if OPAL_HAVE_WEAK_SYMBOLS
37 #pragma weak MPI_Get_count = PMPI_Get_count
38 #endif
39 #define MPI_Get_count PMPI_Get_count
40 #endif
41
42 static const char FUNC_NAME[] = "MPI_Get_count";
43
44
45 int MPI_Get_count(const MPI_Status *status, MPI_Datatype datatype, int *count)
46 {
47 size_t size = 0, internal_count;
48 int rc = MPI_SUCCESS;
49
50 OPAL_CR_NOOP_PROGRESS();
51
52 MEMCHECKER(
53 if (status != MPI_STATUSES_IGNORE) {
54
55
56
57
58 opal_memchecker_base_mem_defined((void*)&status->MPI_ERROR, sizeof(int));
59 memchecker_status(status);
60 memchecker_datatype(datatype);
61 }
62 );
63
64 if (MPI_PARAM_CHECK) {
65 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
66 OMPI_CHECK_DATATYPE_FOR_RECV(rc, datatype, 1);
67
68 OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
69 }
70
71 if( ompi_datatype_type_size( datatype, &size ) == MPI_SUCCESS ) {
72 if( size == 0 ) {
73 *count = 0;
74 } else {
75 internal_count = status->_ucount / size;
76 if( (internal_count * size) != status->_ucount ||
77 internal_count > ((size_t) INT_MAX) ) {
78 *count = MPI_UNDEFINED;
79 } else {
80 *count = (int)internal_count;
81 }
82 }
83 }
84 return MPI_SUCCESS;
85 }