ScaLAPACK  2.0.2
ScaLAPACK: Scalable Linear Algebra PACKage
tc_cCsameF77.c
Go to the documentation of this file.
00001 #include <mpi.h>
00002 
00003 int Ccommcheck(int F77World, int f77comm)
00004 {
00005    int Np, Iam, i, OK=1;
00006 
00007    if (sizeof(int) != sizeof(MPI_Comm)) OK=0;
00008    else if ((MPI_Comm) F77World != MPI_COMM_WORLD) OK=0;
00009    else
00010    {
00011       MPI_Comm_rank(MPI_COMM_WORLD, &Iam);
00012       if (Iam > 1) OK = ((MPI_Comm) f77comm == MPI_COMM_NULL);
00013       else
00014       {
00015          i = MPI_Comm_size((MPI_Comm) f77comm, &Np);
00016          if (i != MPI_SUCCESS) OK = 0;
00017          else if (Np != 2) OK = 0;
00018       }
00019    }
00020    MPI_Allreduce(&OK, &i, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD);
00021    return(i);
00022 }
00023 
00024 /*
00025  * Fortran interfaces
00026  */
00027 int CCOMMCHECK(int *F77World, int *f77comm)
00028 {
00029    return(Ccommcheck(*F77World, *f77comm));
00030 }
00031 int ccommcheck_(int *F77World, int *f77comm)
00032 {
00033    return(Ccommcheck(*F77World, *f77comm));
00034 }
00035 int ccommcheck(int *F77World, int *f77comm)
00036 {
00037    return(Ccommcheck(*F77World, *f77comm));
00038 }