/*@@ @file ProcessEnvironment.c @date Fri Feb 26 11:20:15 1999 @author Tom Goodale @desc Checks the environment for various settings, and acts on them. @enddesc @@*/ #include #include #include "cctk.h" #ifdef MPI #include "mpi.h" #endif #ifdef MPI #define CACTUS_MPI_ERROR(xf) do {int errcode; \ if((errcode = xf) != MPI_SUCCESS) \ { \ char mpi_error_string[MPI_MAX_ERROR_STRING+1]; \ int resultlen; \ MPI_Error_string(errcode, mpi_error_string, &resultlen);\ fprintf(stderr, "MPI Call %s returned error code %d (%s)\n", \ #xf, errcode, mpi_error_string); \ fprintf(stderr, "At line %d of file %s\n", \ __LINE__, __FILE__); \ } \ } while (0) #endif #include "cctk_Flesh.h" static char *rcsid = "$Header$"; #ifdef MPI char MPI_Active = 0; #endif int CCTKi_ProcessEnvironment(int *argc, char ***argv,tFleshConfig *ConfigData) { /* Check if MPI compiled in but choosing not to use MPI. */ #ifdef MPI if(!getenv("CACTUS_NOMPI")) { MPI_Active = 1; CACTUS_MPI_ERROR(MPI_Init(argc, argv)); } #endif return 0; }