ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
tc_cCsameF77.c
Go to the documentation of this file.
1 #include <mpi.h>
2 
3 int Ccommcheck(int F77World, int f77comm)
4 {
5  int Np, Iam, i, OK=1;
6 
7  if (sizeof(int) != sizeof(MPI_Comm)) OK=0;
8  else if ((MPI_Comm) F77World != MPI_COMM_WORLD) OK=0;
9  else
10  {
11  MPI_Comm_rank(MPI_COMM_WORLD, &Iam);
12  if (Iam > 1) OK = ((MPI_Comm) f77comm == MPI_COMM_NULL);
13  else
14  {
15  i = MPI_Comm_size((MPI_Comm) f77comm, &Np);
16  if (i != MPI_SUCCESS) OK = 0;
17  else if (Np != 2) OK = 0;
18  }
19  }
20  MPI_Allreduce(&OK, &i, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD);
21  return(i);
22 }
23 
24 /*
25  * Fortran interfaces
26  */
27 int CCOMMCHECK(int *F77World, int *f77comm)
28 {
29  return(Ccommcheck(*F77World, *f77comm));
30 }
31 int ccommcheck_(int *F77World, int *f77comm)
32 {
33  return(Ccommcheck(*F77World, *f77comm));
34 }
35 int ccommcheck(int *F77World, int *f77comm)
36 {
37  return(Ccommcheck(*F77World, *f77comm));
38 }
CCOMMCHECK
int CCOMMCHECK(int *F77World, int *f77comm)
Definition: tc_cCsameF77.c:27
Ccommcheck
int Ccommcheck(int F77World, int f77comm)
Definition: tc_cCsameF77.c:3
ccommcheck_
int ccommcheck_(int *F77World, int *f77comm)
Definition: tc_cCsameF77.c:31
ccommcheck
int ccommcheck(int *F77World, int *f77comm)
Definition: tc_cCsameF77.c:35