/[escript]/trunk/esysUtils/src/Esys_MPI.h
ViewVC logotype

Contents of /trunk/esysUtils/src/Esys_MPI.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4479 - (show annotations)
Thu Jun 20 10:54:09 2013 UTC (6 years, 8 months ago) by caltinay
File MIME type: text/plain
File size: 2405 byte(s)
Missed a subtle fact about the stringstream constructor...

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15
16
17 #ifndef INC_ESYS_MPI
18 #define INC_ESYS_MPI
19
20 #include "system_dep.h"
21 #include "types.h"
22
23 #include <sstream>
24
25 #ifdef ESYS_MPI
26 #include "mpi_C.h"
27 #else
28 typedef int MPI_Comm;
29 typedef int MPI_Request;
30 #define MPI_INT 6
31 #define MPI_DOUBLE 11
32 #define MPI_COMM_WORLD 91
33 #endif
34
35 typedef int Esys_MPI_rank;
36
37 #define ESYS_MPI_TODO { fprintf( stdout, "\nTODO : %s:%d\n", __FILE__, __LINE__); MPI_Finalize(); exit(1); }
38
39 /* Datatypes */
40
41 /** \brief Struct that holds MPI communicator, rank, size and a tag counter */
42 struct Esys_MPIInfo {
43 dim_t reference_counter;
44 int size;
45 Esys_MPI_rank rank;
46 MPI_Comm comm;
47 int msg_tag_counter;
48 };
49
50 typedef struct Esys_MPIInfo Esys_MPIInfo;
51
52 /* Function prototypes */
53
54 ESYSUTILS_DLL_API
55 Esys_MPIInfo* Esys_MPIInfo_alloc( MPI_Comm comm );
56
57 ESYSUTILS_DLL_API
58 void Esys_MPIInfo_free( Esys_MPIInfo* );
59
60 ESYSUTILS_DLL_API
61 Esys_MPIInfo *Esys_MPIInfo_getReference( Esys_MPIInfo* in );
62
63 ESYSUTILS_DLL_API
64 int Esys_MPIInfo_initialized( void );
65
66 ESYSUTILS_DLL_API
67 index_t Esys_MPIInfo_mod(index_t n, index_t k);
68
69 ESYSUTILS_DLL_API
70 dim_t Esys_MPIInfo_setDistribution(Esys_MPIInfo* in ,index_t min_id,index_t max_id,index_t* distribution);
71
72 ESYSUTILS_DLL_API
73 void Esys_MPIInfo_Split( Esys_MPIInfo *mpi_info, dim_t n, dim_t* local_N,index_t* offset);
74
75 ESYSUTILS_DLL_API
76 bool_t Esys_MPIInfo_noError( Esys_MPIInfo *mpi_info);
77
78 namespace esysUtils {
79
80 /// Appends MPI rank to a file name if MPI size > 1
81 ESYSUTILS_DLL_API
82 inline std::string appendRankToFileName(const std::string &fileName,
83 int mpiSize, int mpiRank)
84 {
85 std::stringstream ss;
86 ss << fileName;
87 if (mpiSize > 1) {
88 ss << '.';
89 ss.fill('0');
90 ss.width(4);
91 ss << mpiRank;
92 }
93 std::string result(ss.str());
94 return result;
95 }
96
97 } // namespace esysUtils
98
99 #endif /* INC_ESYS_MPI */
100

Properties

Name Value
svn:mergeinfo /branches/lapack2681/paso/src/Paso_MPI.h:2682-2741 /branches/pasowrap/esysUtils/src/Esys_MPI.h:3661-3674 /branches/py3_attempt2/esysUtils/src/Esys_MPI.h:3871-3891 /branches/restext/paso/src/Paso_MPI.h:2610-2624 /branches/ripleygmg_from_3668/esysUtils/src/Esys_MPI.h:3669-3791 /branches/stage3.0/paso/src/Paso_MPI.h:2569-2590 /branches/symbolic_from_3470/esysUtils/src/Esys_MPI.h:3471-3974 /branches/symbolic_from_3470/ripley/test/python/esysUtils/src/Esys_MPI.h:3517-3974 /release/3.0/paso/src/Paso_MPI.h:2591-2601 /trunk/ripley/test/python/esysUtils/src/Esys_MPI.h:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26