ESYS13  Revision_
Esys_MPI.h
Go to the documentation of this file.
00001 
00002 /*******************************************************
00003 *
00004 * Copyright (c) 2003-2012 by University of Queensland
00005 * Earth Systems Science Computational Center (ESSCC)
00006 * http://www.uq.edu.au/esscc
00007 *
00008 * Primary Business: Queensland, Australia
00009 * Licensed under the Open Software License version 3.0
00010 * http://www.opensource.org/licenses/osl-3.0.php
00011 *
00012 *******************************************************/
00013 
00014 
00015 #ifndef INC_ESYS_MPI
00016 #define INC_ESYS_MPI
00017 
00018 #include "system_dep.h"
00019 #include "types.h"
00020 
00021 #ifdef ESYS_MPI
00022    #include "mpi_C.h"
00023 #else
00024    typedef int MPI_Comm;
00025    typedef int MPI_Request;
00026    #define MPI_INT 6
00027    #define MPI_DOUBLE 11
00028    #define MPI_COMM_WORLD 91
00029 #endif
00030 
00031 typedef int Esys_MPI_rank;
00032 
00033 #define ESYS_MPI_TODO   { fprintf( stdout, "\nTODO : %s:%d\n", __FILE__, __LINE__); MPI_Finalize(); exit(1); }
00034 
00035 /* Datatypes */
00036 struct Esys_MPIInfo {
00037   dim_t reference_counter;
00038   int size;
00039   Esys_MPI_rank rank;
00040   MPI_Comm comm;
00041   int msg_tag_counter;
00042 };
00043 
00044 typedef struct Esys_MPIInfo Esys_MPIInfo;
00045 
00046 /* Function prototypes */
00047 
00048 ESYSUTILS_DLL_API
00049 Esys_MPIInfo* Esys_MPIInfo_alloc( MPI_Comm comm );
00050 
00051 ESYSUTILS_DLL_API
00052 void          Esys_MPIInfo_free( Esys_MPIInfo* );
00053 
00054 ESYSUTILS_DLL_API
00055 Esys_MPIInfo *Esys_MPIInfo_getReference( Esys_MPIInfo* in );
00056 
00057 ESYSUTILS_DLL_API
00058 int           Esys_MPIInfo_initialized( void );
00059 
00060 ESYSUTILS_DLL_API
00061 index_t Esys_MPIInfo_mod(index_t n, index_t k);
00062 
00063 ESYSUTILS_DLL_API
00064 dim_t Esys_MPIInfo_setDistribution(Esys_MPIInfo* in ,index_t min_id,index_t max_id,index_t* distribution);
00065 
00066 ESYSUTILS_DLL_API
00067 void Esys_MPIInfo_Split( Esys_MPIInfo *mpi_info, dim_t n, dim_t* local_N,index_t* offset); 
00068 
00069 ESYSUTILS_DLL_API
00070 bool_t Esys_MPIInfo_noError( Esys_MPIInfo *mpi_info);
00071 
00072 ESYSUTILS_DLL_API
00073 char *Esys_MPI_appendRankToFileName(const char *, int, int);
00074 
00075 #endif /* INC_ESYS_MPI */