1 /*
2    (C) 2004 by Argonne National Laboratory.
3        See COPYRIGHT in top-level directory.
4 */
5 #include "collchk.h"
6 
MPI_Scan(MPICH2_CONST void * sbuff,void * rbuff,int cnt,MPI_Datatype dt,MPI_Op op,MPI_Comm comm)7 int MPI_Scan(MPICH2_CONST void* sbuff, void* rbuff, int cnt,
8              MPI_Datatype dt, MPI_Op op, MPI_Comm comm)
9 {
10     int g2g = 1;
11     char call[COLLCHK_SM_STRLEN];
12 
13     sprintf(call, "SCAN");
14 
15     /* Check if init has been called */
16     g2g = CollChk_is_init();
17 
18     if(g2g) {
19         /* check call consistancy */
20         CollChk_same_call(comm, call);
21         /* check operation consistacy */
22         CollChk_same_op(comm, op, call);
23 
24         /* check datatype signature consistancy */
25         CollChk_dtype_bcast(comm, dt, cnt, 0, call);
26 
27         /* make the call */
28         return PMPI_Scan(sbuff, rbuff, cnt, dt, op, comm);
29     }
30     else {
31         /* init not called */
32         return CollChk_err_han("MPI_Init() has not been called!",
33                                COLLCHK_ERR_NOT_INIT, call, comm);
34     }
35 }
36