/usr/include/ple_coupling.h is in code-saturne-include 3.2.1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | #ifndef __PLE_COUPLING_H__
#define __PLE_COUPLING_H__
/*============================================================================
* Set up communication with coupled codes.
*============================================================================*/
/*
This file is part of the "Parallel Location and Exchange" library,
intended to provide mesh or particle-based code coupling services.
Copyright (C) 2005-2011 EDF
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*----------------------------------------------------------------------------*/
#include "ple_config.h"
#if defined(PLE_HAVE_MPI)
#include <mpi.h>
#endif
/*----------------------------------------------------------------------------
* Local headers
*----------------------------------------------------------------------------*/
#include "ple_defs.h"
/*----------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#if 0
} /* Fake brace to force Emacs auto-indentation back to column 0 */
#endif
#endif /* __cplusplus */
/*=============================================================================
* Macro definitions
*============================================================================*/
/*
* Mask for synchronization flag
*/
/* Command bits */
#define PLE_COUPLING_INIT (1 << 0) /* Not yet synchronized */
#define PLE_COUPLING_NO_SYNC (1 << 1) /* Not synchronized */
#define PLE_COUPLING_STOP (1 << 2) /* Will stop immediately */
#define PLE_COUPLING_LAST (1 << 3) /* Last synchronization */
/* Time stepping bits */
#define PLE_COUPLING_NEW_ITERATION (1 << 4)
#define PLE_COUPLING_REDO_ITERATION (1 << 5)
/* Time step value handling bits */
#define PLE_COUPLING_TS_MIN (1 << 6) /* Use smallest time step */
#define PLE_COUPLING_TS_LEADER (1 << 7) /* Prescribe time step for all
members of group (only one
member may set this flag) */
/* Calculation type or state information bits */
#define PLE_COUPLING_UNSTEADY (1 << 8)
#define PLE_COUPLING_STEADY (1 << 9)
#define PLE_COUPLING_CONVERGED (1 << 10)
/* Optional user code information bits */
#define PLE_COUPLING_USER_1 (1 << 11)
#define PLE_COUPLING_USER_2 (1 << 12)
#define PLE_COUPLING_USER_3 (1 << 13)
#define PLE_COUPLING_USER_4 (1 << 14)
/*============================================================================
* Type definitions
*============================================================================*/
#if defined(PLE_HAVE_MPI)
/* Opaque code coupling information structure */
typedef struct _ple_coupling_mpi_set_t ple_coupling_mpi_set_t;
/* Info structure for code coupling */
typedef struct {
int status; /* Status flag for synchronization info */
int root_rank; /* Application root rank in MPI_COMM_WORLD */
int n_ranks; /* Number of ranks associated with application */
const char *app_type; /* Application type name (may be empty) */
const char *app_name; /* Application instance name (may be empty) */
} ple_coupling_mpi_set_info_t;
#endif /* defined(PLE_HAVE_MPI) */
/*=============================================================================
* Public function prototypes
*============================================================================*/
#if defined(PLE_HAVE_MPI)
/*----------------------------------------------------------------------------
* Build a group id within a communicator based on its name.
*
* If multiple groups are present, ids are number from 0 to n_groups - 1,
* based on the odering of group names. If all processes have the same
* group name, the returned value is -1.
*
* The returned id may typically be used as a "color" argument for
* MPI_Comm_split().
*
* As this function requires communication between applications, it
* is a collective function in comm.
*
* parameters:
* comm <-- MPI communicator.
* group_name <-- name associated with current group.
*
* returns:
* id associated with local name.
*----------------------------------------------------------------------------*/
int
ple_coupling_mpi_name_to_id(MPI_Comm comm,
const char *group_name);
/*----------------------------------------------------------------------------
* Discover other applications in a set with a common communicator.
*
* In most cases, the base communicator is MPI_COMM_WORLD, and the local
* application communicator app_comm is usually obtained from it using
* MPI_Comm_split, but other combinations may be possible using MPI-2
* process management functions.
*
* As this function requires communication between applications, it
* is a collective function in base_comm.
*
* parameters:
* sync_flag <-- 1 if application is to be synchronized at each
* time step, 0 if independent from others.
* app_type <-- name of current application type (software name).
* app_name <-- name of current application (data/case name).
* base_comm <-- communicator associated with all applications.
* app_comm <-- communicator associated with local application.
*
* returns:
* PLE coupling MPI set info structure.
*----------------------------------------------------------------------------*/
ple_coupling_mpi_set_t *
ple_coupling_mpi_set_create(int sync_flag,
const char *app_type,
const char *app_name,
MPI_Comm base_comm,
MPI_Comm app_comm);
/*----------------------------------------------------------------------------
* Free an PLE coupling MPI set info structure.
*
* parameters:
* s <-> pointer to structure that should be freed.
*----------------------------------------------------------------------------*/
void
ple_coupling_mpi_set_destroy(ple_coupling_mpi_set_t **s);
/*----------------------------------------------------------------------------
* Return the number of applications in a coupled set.
*
* parameters:
* s <-- pointer to PLE coupling MPI set info structure.
*
* returns:
* number of application in set's common communicator.
*----------------------------------------------------------------------------*/
int
ple_coupling_mpi_set_n_apps(const ple_coupling_mpi_set_t *s);
/*----------------------------------------------------------------------------
* Return the id of the local application in a coupled set.
*
* parameters:
* s <-- pointer to PLE coupling MPI set info structure.
*
* returns:
* id of the local application in set's common communicator.
*----------------------------------------------------------------------------*/
int
ple_coupling_mpi_set_get_app_id(const ple_coupling_mpi_set_t *s);
/*----------------------------------------------------------------------------
* Return application information in set's common communicator.
*
* parameters:
* s <-- pointer to PLE coupling MPI set info structure.
* app_id <-- application id
*
* returns:
* application information structure.
*----------------------------------------------------------------------------*/
ple_coupling_mpi_set_info_t
ple_coupling_mpi_set_get_info(const ple_coupling_mpi_set_t *s,
int app_id);
/*----------------------------------------------------------------------------
* Synchronize applications in a set.
*
* Note that if a member of the set has used a PLE_COUPLING_STOP or
* PLE_COUPLING_LAST flag when calling ple_coupling_mpi_set_create() or
* or at the previous call to this function, it will not be synchronized
* anymore (i.e. the PLE_COUPLING_NO_SYNC flag will be added).
*
* parameters:
* s <-- pointer to PLE coupling MPI set info structure.
* sync_flag <-- synchronization info for current application.
* time_step <-- time step for current application.
*----------------------------------------------------------------------------*/
void
ple_coupling_mpi_set_synchronize(ple_coupling_mpi_set_t *s,
int sync_flag,
double time_step);
/*----------------------------------------------------------------------------
* Get status of applications in a set.
*
* This function allows access to the status flag of each synchronized
* application in the set. It may be used immediately after
* ple_coupling_mpi_set_create(), and flags are updated after each
* call to ple_coupling_mpi_set_synchronize().
*
* parameters:
* s <-- pointer to PLE coupling MPI set info structure.
*
* returns:
* a pointer to the set's array of status flags
*----------------------------------------------------------------------------*/
const int *
ple_coupling_mpi_set_get_status(const ple_coupling_mpi_set_t *s);
/*----------------------------------------------------------------------------
* Get time steps in a set.
*
* This function may be called after ple_coupling_mpi_set_synchronize()
* to access the time step values of each synchronized application in the set.
*
* parameters:
* s <-- pointer to PLE coupling MPI set info structure.
*
* returns:
* a pointer to the set's array of time steps
*----------------------------------------------------------------------------*/
const double *
ple_coupling_mpi_set_get_timestep(const ple_coupling_mpi_set_t *s);
/*----------------------------------------------------------------------------
* Create an intracommunicator from a local and distant communicator
* within a base communicator.
*
* Note that if a member of the set has used a PLE_COUPLING_STOP or
* PLE_COUPLING_LAST flag when calling ple_coupling_mpi_set_create() or
* or at the previous call to this function, it will not be synchronized
* anymore (i.e. the PLE_COUPLING_NO_SYNC flag will be added).
*
* parameters:
* base_comm <-- communicator associated with both applications
* app_comm <-- communicator associated with local application
* distant_root <-- rank of distant group leader in base_comm
* new_comm --> pointer to new communicator
* local_range --> first and past-the last ranks of local application
* in new communicator
* distant_range --> first and past-the last ranks of distant application
* in new communicator
*----------------------------------------------------------------------------*/
void
ple_coupling_mpi_intracomm_create(MPI_Comm base_comm,
MPI_Comm app_comm,
int distant_root,
MPI_Comm *new_comm,
int local_range[2],
int distant_range[2]);
/*----------------------------------------------------------------------------
* Dump printout of an PLE coupling MPI set info structure.
*
* parameters:
* w <-- pointer to PLE coupling MPI set info structure.
*----------------------------------------------------------------------------*/
void
ple_coupling_mpi_set_dump(const ple_coupling_mpi_set_t *s);
#endif /* defined(PLE_HAVE_MPI) */
/*----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __PLE_COUPLING_H__ */
|