File: tc_cCsameF77.c

package info (click to toggle)
scalapack 2.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 37,012 kB
  • sloc: fortran: 339,113; ansic: 74,517; makefile: 1,494; sh: 34
file content (38 lines) | stat: -rw-r--r-- 842 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <mpi.h>

int Ccommcheck(int F77World, int f77comm)
{
   int Np, Iam, i, OK=1;

   if (sizeof(int) != sizeof(MPI_Comm)) OK=0;
   else if ((MPI_Comm) F77World != MPI_COMM_WORLD) OK=0;
   else
   {
      MPI_Comm_rank(MPI_COMM_WORLD, &Iam);
      if (Iam > 1) OK = ((MPI_Comm) f77comm == MPI_COMM_NULL);
      else
      {
         i = MPI_Comm_size((MPI_Comm) f77comm, &Np);
	 if (i != MPI_SUCCESS) OK = 0;
	 else if (Np != 2) OK = 0;
      }
   }
   MPI_Allreduce(&OK, &i, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD);
   return(i);
}

/*
 * Fortran interfaces
 */
int CCOMMCHECK(int *F77World, int *f77comm)
{
   return(Ccommcheck(*F77World, *f77comm));
}
int ccommcheck_(int *F77World, int *f77comm)
{
   return(Ccommcheck(*F77World, *f77comm));
}
int ccommcheck(int *F77World, int *f77comm)
{
   return(Ccommcheck(*F77World, *f77comm));
}