27 #include "wrapperMPI.h"    47   ierr = MPI_Init(&argc, &argv);
    48   ierr = MPI_Comm_size(MPI_COMM_WORLD, &
nproc);
    49   ierr = MPI_Comm_rank(MPI_COMM_WORLD, &
myrank);
    59 #pragma omp parallel default(none) shared(nthreads)    66   fprintf(
stdoutMPI, 
"\n\n#####  Parallelization Info.  #####\n\n");
    77   ierr = MPI_Finalize();
    78   if (ierr != 0) fprintf(stderr, 
"\n  MPI_Finalize() = %d\n\n", ierr);
    93   fprintf(stdout,
"\n\n #######  [HPhi] You DO NOT have to WORRY about the following MPI-ERROR MESSAGE.  #######\n\n");
    94   ierr = MPI_Abort(MPI_COMM_WORLD, errorcode);
    95   ierr = MPI_Finalize();
    96   if (ierr != 0) fprintf(stderr, 
"\n  MPI_Finalize() = %d\n\n", ierr);
   106   const char* FileName,
   111   if (
myrank == 0) fp = fopen(FileName, mode);
   112   else fp = fopen(
"/dev/null", 
"w");
   133     ctmp = fgets(InputString, maxcount, fp);
   138     while(*InputString == 
'\n' || strncmp(InputString, 
"#", 1)==0){
   139       ctmp = fgets(InputString, maxcount, fp);
   147   MPI_Bcast(InputString, maxcount, MPI_CHAR, 0, MPI_COMM_WORLD);
   148   MPI_Bcast(&inull, 1, MPI_INT, 0, MPI_COMM_WORLD);
   150   if (
myrank != 0 && inull == 1) {
   162   MPI_Barrier(MPI_COMM_WORLD);
   172   unsigned long int idim
   176   ierr = MPI_Allreduce(MPI_IN_PLACE, &idim, 1,
   177     MPI_UNSIGNED_LONG, MPI_MAX, MPI_COMM_WORLD);
   193   ierr = MPI_Allreduce(MPI_IN_PLACE, &dvalue, 1,
   194     MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
   210   ierr = MPI_Allreduce(MPI_IN_PLACE, &norm, 1,
   211     MPI_DOUBLE_COMPLEX, MPI_SUM, MPI_COMM_WORLD);
   227   ierr = MPI_Allreduce(MPI_IN_PLACE, &norm, 1,
   228     MPI_DOUBLE_PRECISION, MPI_SUM, MPI_COMM_WORLD);
   240   unsigned long int idim
   244   ierr = MPI_Allreduce(MPI_IN_PLACE, &idim, 1,
   245     MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD);
   261   ierr = MPI_Allreduce(MPI_IN_PLACE, &idim, 1,
   262                        MPI_INT, MPI_SUM, MPI_COMM_WORLD);
   275   unsigned long int idim
   277   unsigned long int idim0;
   280     MPI_Bcast(&idim0, 1, MPI_UNSIGNED_LONG, root, MPI_COMM_WORLD);
   290   unsigned long int idim,
   293   double complex cdnorm=0;
   297 #pragma omp parallel for default(none) private(i) firstprivate(myrank) shared(_v1, idim) reduction(+: cdnorm)   298   for(i=1;i<=idim;i++){
   299     cdnorm += conj(_v1[i])*_v1[i];
   315   long unsigned int ndim,
   319   long unsigned int idim;
   323 #pragma omp parallel for default(none) shared(v1,v2,ndim) private(idim) reduction(+: prod)   324   for (idim = 1; idim <= ndim; idim++) prod += conj(
v1[idim]) * 
v2[idim];
 void exitMPI(int errorcode)
MPI Abortation wrapper. 
double complex SumMPI_dc(double complex norm)
MPI wrapper function to obtain sum of Double complex across processes. 
unsigned long int BcastMPI_li(int root, unsigned long int idim)
MPI wrapper function to broadcast unsigned long integer across processes. 
double SumMPI_d(double norm)
MPI wrapper function to obtain sum of Double across processes. 
double MaxMPI_d(double dvalue)
MPI wrapper function to obtain maximum Double across processes. 
int nthreads
Number of Threads, defined in InitializeMPI() 
double NormMPI_dc(unsigned long int idim, double complex *_v1)
Compute norm of process-distributed vector . 
void BarrierMPI()
MPI barrier wrapper. 
void splash()
Print logo mark and version number. 
int nproc
Number of processors, defined in InitializeMPI() 
int SumMPI_i(int idim)
MPI wrapper function to obtain sum of integer across processes. 
unsigned long int MaxMPI_li(unsigned long int idim)
MPI wrapper function to obtain maximum unsigned long integer across processes. 
void FinalizeMPI()
MPI Finitialization wrapper. 
double complex VecProdMPI(long unsigned int ndim, double complex *v1, double complex *v2)
Compute conjugate scaler product of process-distributed vector . 
int myrank
Process ID, defined in InitializeMPI() 
char * fgetsMPI(char *InputString, int maxcount, FILE *fp)
MPI file I/O (get a line, fgets) wrapper. Only the root node (myrank = 0) reads and broadcast string...
unsigned long int SumMPI_li(unsigned long int idim)
MPI wrapper function to obtain sum of unsigned long integer across processes. 
FILE * fopenMPI(const char *FileName, const char *mode)
MPI file I/O (open) wrapper. Only the root node (myrank = 0) should be open/read/write (small) parame...
void InitializeMPI(int argc, char *argv[])
MPI initialization wrapper Process ID (myrank), Number of processes (nproc), Number of threads (nthre...
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()