File: blacs_pinfo_.c

package info (click to toggle)
scalapack 2.0.2-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 36,300 kB
  • sloc: fortran: 338,514; ansic: 75,307; makefile: 1,385; sh: 56
file content (27 lines) | stat: -rw-r--r-- 643 bytes parent folder | download | duplicates (2)
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
#include "Bdef.h"

#if (INTFACE == C_CALL)
void Cblacs_pinfo(int *mypnum, int *nprocs)
#else
F_VOID_FUNC blacs_pinfo_(int *mypnum, int *nprocs)
#endif
{
   int ierr;
   extern int BI_Iam, BI_Np;
   int argc=0;
   char **argv=NULL;
   if (BI_COMM_WORLD == NULL)
   {
      MPI_Initialized(nprocs);

      if (!(*nprocs)) 
         ierr = MPI_Init(&argc,&argv);  // call Init and ignore argc and argv

      BI_COMM_WORLD = (int *) malloc(sizeof(int));
      *BI_COMM_WORLD = MPI_Comm_c2f(MPI_COMM_WORLD);
      MPI_Comm_size(MPI_COMM_WORLD, &BI_Np);
      MPI_Comm_rank(MPI_COMM_WORLD, &BI_Iam);
   }
   *mypnum = BI_Iam;
   *nprocs = BI_Np;
}