cta_par.h

Go to the documentation of this file.
00001 /*
00002 COSTA: Problem solving environment for data assimilation
00003 Copyright (C) 2005  Nils van Velzen
00004 
00005 This library is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU Lesser General Public
00007 License as published by the Free Software Foundation; either
00008 version 2.1 of the License, or (at your option) any later version.
00009 
00010 This library is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 Lesser General Public License for more details.
00014 
00015 You should have received a copy of the GNU Lesser General Public
00016 License along with this library; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 #ifndef CTA_PAR_H
00020 #define CTA_PAR_H
00021 #include "cta_system.h"
00022 #include "cta_handles.h"
00023 #include "cta_datatypes.h"
00024 
00025 #ifdef USE_MPI
00026 #include "mpi.h"
00027 #endif
00028 
00029 /**
00030 \file  cta_par.h
00031 
00032 \brief Interface for creating parallel applications with COSTA */
00033 
00034 /** Type of processes */
00035 enum CTA_ParProcType {CTA_ParMaster, CTA_ParWorker, CTA_ParOther};
00036 
00037 
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 
00042 
00043 
00044 /** Flag CTA_TRUE/CTA_FALSE to indicate whether run is in a parallel
00045  *  environment */
00046 CTAEXPORT extern int CTA_IS_PARALLEL;
00047 
00048 /** Rank in world of all processes Note this variable is only
00049  * used for debugging and output. */
00050 CTAEXPORT extern int CTA_PAR_MY_RANK;
00051 
00052 
00053 
00054 /** Kind of this process */
00055 CTAEXPORT extern enum CTA_ParProcType CTA_MY_PROC_TYPE;
00056 
00057 #ifdef USE_MPI
00058 /** The whole communication universe              */
00059 CTAEXPORT extern MPI_Comm CTA_COMM_WORLD;
00060 
00061 /** My own communication group                    */
00062 CTAEXPORT extern MPI_Comm CTA_COMM_MYWORLD;
00063 
00064 /** Group consisting of master process and all worker processes the master
00065  *  communicates with */
00066 CTAEXPORT extern MPI_Comm CTA_COMM_MASTER_WORKER;        
00067 
00068 #endif
00069 
00070 
00071 /** \brief Initialises parallel environment and create process groups
00072  *
00073  * \param parConfig I  configuration input from XML-file
00074  * \param StartPat  I  CTA_TRUE/CTA_FALSE start parallel model builder
00075  *
00076  * Note when a worker process is part of a Master-Worker model and it does
00077  * not implement the COSTA model interface it should not start the parallel model builder
00078  *
00079  * \return error status: CTA_OK if successful
00080  */
00081 int CTA_Par_CreateGroups(int parConfig, int StartPar);
00082 
00083 /** \brief Get a new communicator for a new model instance
00084  *
00085  * \param forModel I  model class of new model
00086  * \param comm     O  MPI communicator
00087  *
00088  * \return error status: CTA_OK if successful
00089  */
00090 #ifdef USE_MPI
00091 int CTA_Par_CreateNewCreateGetComm(CTA_ModelClass modelCls, MPI_Comm *comm);
00092 #endif
00093 
00094 /** \brief Get the Fortran (integer handles) of the communicators 
00095  *
00096  * \param O cta_comm_world          Fortran communcator CTA_COMM_WORLD
00097  * \param O cta_comm_myworld        Fortran communcator CTA_COMM_MYWORLD
00098  * \param O cta_comm_master_worker  Fortran communcator CTA_COMM_MASTER_WORKER
00099  *
00100  */
00101 #ifdef USE_MPI
00102 int CTA_Par_CreateNewCreateGetComm(CTA_ModelClass modelCls, MPI_Comm *comm);
00103 #endif
00104 
00105 /** \brief Get a communicator for a process group by index 
00106  *
00107  * \param I indx  indx of communicator
00108  * \param O comm  MPI communicator
00109  * \return CTA_OK when succesfull. The value is CTA_CANNOT_FIND_PROCESS_GROUP is
00110  *         returned when the communicator cannot be found
00111  *
00112  */
00113 #ifdef USE_MPI
00114 int CTA_Par_GetAllCommByIndex(int indx, MPI_Comm *comm);
00115 #endif
00116 
00117 
00118 
00119 
00120 
00121 #ifdef __cplusplus
00122 }
00123 #endif
00124 #endif
00125 
00126 

Generated on Mon Apr 6 14:05:58 2009 for COSTA by  doxygen 1.5.2