|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
* (C) 2013 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Types and interfaces in this file are internally used by MPIR_T itself.
|
|
Packit Service |
c5cf8c |
* Other modules should call higher level interfaces in mpit.h instead.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
#ifndef MPITIMPL_H_INCLUDED
|
|
Packit Service |
c5cf8c |
#define MPITIMPL_H_INCLUDED
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#include "mpi.h"
|
|
Packit Service |
c5cf8c |
#include "mpir_strerror.h"
|
|
Packit Service |
c5cf8c |
#include "mpir_type_defs.h"
|
|
Packit Service |
c5cf8c |
#include "mpir_assert.h"
|
|
Packit Service |
c5cf8c |
#include "mpir_pointers.h"
|
|
Packit Service |
c5cf8c |
#include "utarray.h"
|
|
Packit Service |
c5cf8c |
#include "uthash.h"
|
|
Packit Service |
c5cf8c |
#include "mpir_objects.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_ERROR_CHECKING
|
|
Packit Service |
c5cf8c |
typedef enum {
|
|
Packit Service |
c5cf8c |
MPIR_T_OBJECT_INVALID = 0,
|
|
Packit Service |
c5cf8c |
MPIR_T_ENUM_HANDLE,
|
|
Packit Service |
c5cf8c |
MPIR_T_CVAR_HANDLE,
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_HANDLE,
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_SESSION
|
|
Packit Service |
c5cf8c |
} MPIR_T_object_kind;
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPI_T enum
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
typedef struct enum_item_s {
|
|
Packit Service |
c5cf8c |
const char *name;
|
|
Packit Service |
c5cf8c |
int value;
|
|
Packit Service |
c5cf8c |
} enum_item_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
typedef struct MPIR_T_enum_s {
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_ERROR_CHECKING
|
|
Packit Service |
c5cf8c |
MPIR_T_object_kind kind;
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
const char *name;
|
|
Packit Service |
c5cf8c |
UT_array *items;
|
|
Packit Service |
c5cf8c |
} MPIR_T_enum_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPI_T category (cat)
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
typedef struct {
|
|
Packit Service |
c5cf8c |
const char *name;
|
|
Packit Service |
c5cf8c |
UT_array *cvar_indices;
|
|
Packit Service |
c5cf8c |
UT_array *pvar_indices;
|
|
Packit Service |
c5cf8c |
UT_array *subcat_indices;
|
|
Packit Service |
c5cf8c |
const char *desc;
|
|
Packit Service |
c5cf8c |
} cat_table_entry_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Hash names to indices in a table */
|
|
Packit Service |
c5cf8c |
typedef struct {
|
|
Packit Service |
c5cf8c |
const char *name;
|
|
Packit Service |
c5cf8c |
unsigned idx;
|
|
Packit Service |
c5cf8c |
UT_hash_handle hh; /* Makes this structure hashable */
|
|
Packit Service |
c5cf8c |
} name2index_hash_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPI_T control variable (cvar)
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
typedef struct MPIR_T_cvar_range_value_s {
|
|
Packit Service |
c5cf8c |
int low;
|
|
Packit Service |
c5cf8c |
int high;
|
|
Packit Service |
c5cf8c |
} MPIR_T_cvar_range_value_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Type used to represent cvar default values */
|
|
Packit Service |
c5cf8c |
typedef union MPIR_T_cvar_value_s {
|
|
Packit Service |
c5cf8c |
int d;
|
|
Packit Service |
c5cf8c |
unsigned u;
|
|
Packit Service |
c5cf8c |
unsigned ul;
|
|
Packit Service |
c5cf8c |
unsigned ull;
|
|
Packit Service |
c5cf8c |
MPI_Count c;
|
|
Packit Service |
c5cf8c |
const char *str;
|
|
Packit Service |
c5cf8c |
double f;
|
|
Packit Service |
c5cf8c |
MPIR_T_cvar_range_value_t range;
|
|
Packit Service |
c5cf8c |
} MPIR_T_cvar_value_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
typedef int MPIR_T_cvar_get_addr_cb(void *obj_handle, void **addr);
|
|
Packit Service |
c5cf8c |
typedef int MPIR_T_cvar_get_count_cb(void *obj_handle, int *count);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
typedef struct cvar_table_entry_s {
|
|
Packit Service |
c5cf8c |
/* Is the cvar currently in use? False if the cvar is unregistered */
|
|
Packit Service |
c5cf8c |
int active;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* cvar name */
|
|
Packit Service |
c5cf8c |
const char *name;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Address of the cvar. May be NULL when get_addr != NULL */
|
|
Packit Service |
c5cf8c |
void *addr;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* cvar data type */
|
|
Packit Service |
c5cf8c |
MPI_Datatype datatype;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Num. of elements of the cvar. May be ignored when get_count != NULL */
|
|
Packit Service |
c5cf8c |
int count;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Properties of the cvar */
|
|
Packit Service |
c5cf8c |
MPI_T_enum enumtype;
|
|
Packit Service |
c5cf8c |
MPIR_T_verbosity_t verbosity;
|
|
Packit Service |
c5cf8c |
MPIR_T_bind_t bind;
|
|
Packit Service |
c5cf8c |
MPIR_T_scope_t scope;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Default value */
|
|
Packit Service |
c5cf8c |
MPIR_T_cvar_value_t defaultval;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* If not NULL, components provide this callback to get addr of the cvar */
|
|
Packit Service |
c5cf8c |
MPIR_T_cvar_get_addr_cb *get_addr;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* If not NULL, components provide this callback to get count */
|
|
Packit Service |
c5cf8c |
MPIR_T_cvar_get_count_cb *get_count;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Description of the cvar */
|
|
Packit Service |
c5cf8c |
const char *desc;
|
|
Packit Service |
c5cf8c |
} cvar_table_entry_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
typedef struct MPIR_T_cvar_handle_s {
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_ERROR_CHECKING
|
|
Packit Service |
c5cf8c |
MPIR_T_object_kind kind;
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Address and count of the cvar. Set at handle allocation time */
|
|
Packit Service |
c5cf8c |
void *addr;
|
|
Packit Service |
c5cf8c |
int count;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Cached value from cvar_table_entry_t to avoid indirection */
|
|
Packit Service |
c5cf8c |
MPI_Datatype datatype;
|
|
Packit Service |
c5cf8c |
MPIR_T_scope_t scope;
|
|
Packit Service |
c5cf8c |
} MPIR_T_cvar_handle_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
void MPIR_T_CVAR_REGISTER_impl(MPI_Datatype dtype, const char *name, const void *addr, int count,
|
|
Packit Service |
c5cf8c |
MPIR_T_enum_t * etype, MPIR_T_verbosity_t verb, MPIR_T_bind_t bind,
|
|
Packit Service |
c5cf8c |
MPIR_T_scope_t scope, MPIR_T_cvar_get_addr_cb get_addr,
|
|
Packit Service |
c5cf8c |
MPIR_T_cvar_get_count_cb get_count, MPIR_T_cvar_value_t defaultval,
|
|
Packit Service |
c5cf8c |
const char *cat, const char *desc);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPI_T performance variable (pvar)
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Forward declaration */
|
|
Packit Service |
c5cf8c |
struct MPIR_T_pvar_handle_s;
|
|
Packit Service |
c5cf8c |
struct MPIR_T_pvar_session_s;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
typedef void MPIR_T_pvar_get_value_cb(void *addr, void *obj_handle, int count, void *buf);
|
|
Packit Service |
c5cf8c |
typedef void MPIR_T_pvar_get_count_cb(void *addr, void *obj_handle, int *count);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Basic pvar flags defined by MPI_T standard */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_FLAG_READONLY 0x01
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_FLAG_CONTINUOUS 0x02
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_FLAG_ATOMIC 0x04
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Auxlilary flags used by MPIR_T */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* pvar is MPI_T_PVAR_CLASS_{COUNTER, TIMER, AGGREGATE} */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_FLAG_SUM 0x08
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* pvar is MPI_T_PVAR_CLASS_{HIGH, LOW}WATERMARK */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_FLAG_WATERMARK 0x10
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* pvar is continuous. If not, it has been started at least once */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_FLAG_ONCESTARTED 0x20
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* pvar is continuous. If not, it is started */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_FLAG_STARTED 0x40
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Used only for watermark handles. Set if a pvar handle is the
|
|
Packit Service |
c5cf8c |
* first handle of an associated watermark.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_FLAG_FIRST 0x80
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPI_T performance variable (pvar) stuff */
|
|
Packit Service |
c5cf8c |
typedef struct {
|
|
Packit Service |
c5cf8c |
/* Is the pvar in use (i.e., not unregistered)? */
|
|
Packit Service |
c5cf8c |
int active;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* pvar name */
|
|
Packit Service |
c5cf8c |
const char *name;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* If not NULL, it is address of the pvar */
|
|
Packit Service |
c5cf8c |
void *addr;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* pvar data type */
|
|
Packit Service |
c5cf8c |
MPI_Datatype datatype;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Num. of elements of the pvar */
|
|
Packit Service |
c5cf8c |
int count;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Properties of the pvar */
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_class_t varclass;
|
|
Packit Service |
c5cf8c |
MPIR_T_verbosity_t verbosity;
|
|
Packit Service |
c5cf8c |
MPIR_T_enum_t *enumtype;
|
|
Packit Service |
c5cf8c |
MPIR_T_bind_t bind;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Basic flags of the pvar */
|
|
Packit Service |
c5cf8c |
int flags;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* If not NULL, components provide this callback to read the pvar */
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_get_value_cb *get_value;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* If not NULL, components provide this callback to get count */
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_get_count_cb *get_count;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Description of the pvar */
|
|
Packit Service |
c5cf8c |
const char *desc;
|
|
Packit Service |
c5cf8c |
} pvar_table_entry_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
The following two macros do not work since C preprocessor does not support
|
|
Packit Service |
c5cf8c |
nested ifdefs. So we use another woarkable but a little ugly approach.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define PVAR_GATED_ACTION(MODULE, action_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
#ifdef ENABLE_PVAR_##MODULE \
|
|
Packit Service |
c5cf8c |
action_; \
|
|
Packit Service |
c5cf8c |
#endif \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* ENABLE_PVAR_##MODULE must be defined by configure script either to 0 or 1 */
|
|
Packit Service |
c5cf8c |
#define PVAR_GATED_ACTION(MODULE, action_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
if (ENABLE_PVAR_##MODULE) { \
|
|
Packit Service |
c5cf8c |
action_; \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* For some classes of pvars, internally we can not represent them
|
|
Packit Service |
c5cf8c |
* in basic data types. So come the following typedefs.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Timer type */
|
|
Packit Service |
c5cf8c |
typedef struct {
|
|
Packit Service |
c5cf8c |
/* Accumulated time */
|
|
Packit Service |
c5cf8c |
MPID_Time_t total;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Time when the timer was started recently */
|
|
Packit Service |
c5cf8c |
MPID_Time_t curstart;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* A counter recording how many times the timer is started */
|
|
Packit Service |
c5cf8c |
unsigned long long count;
|
|
Packit Service |
c5cf8c |
} MPIR_T_pvar_timer_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* An union to represent a watermark value */
|
|
Packit Service |
c5cf8c |
typedef union {
|
|
Packit Service |
c5cf8c |
double f;
|
|
Packit Service |
c5cf8c |
unsigned u;
|
|
Packit Service |
c5cf8c |
unsigned long ul;
|
|
Packit Service |
c5cf8c |
unsigned long long ull;
|
|
Packit Service |
c5cf8c |
} watermark_value_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Watermark type */
|
|
Packit Service |
c5cf8c |
typedef struct {
|
|
Packit Service |
c5cf8c |
/* current -- current resource utilization level
|
|
Packit Service |
c5cf8c |
* waterarmk -- cached value for the first pvar handle
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
watermark_value_t current, watermark;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Datatype of the watermark */
|
|
Packit Service |
c5cf8c |
MPI_Datatype datatype;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Is the cached value (i.e, watermark) in use by a pvar handle? */
|
|
Packit Service |
c5cf8c |
int first_used;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Is the first pvar handle started? */
|
|
Packit Service |
c5cf8c |
int first_started;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* A double-linked list of handles of the pvar */
|
|
Packit Service |
c5cf8c |
struct MPIR_T_pvar_handle_s *hlist;
|
|
Packit Service |
c5cf8c |
} MPIR_T_pvar_watermark_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
typedef struct MPIR_T_pvar_handle_s {
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_ERROR_CHECKING
|
|
Packit Service |
c5cf8c |
MPIR_T_object_kind kind;
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* These are cached fields from pvar table. Do so to avoid extra
|
|
Packit Service |
c5cf8c |
* indirection when accessing them through pvar handles.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
void *addr;
|
|
Packit Service |
c5cf8c |
MPI_Datatype datatype;
|
|
Packit Service |
c5cf8c |
int count;
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_get_value_cb *get_value;
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_class_t varclass;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Bytes of an element of datatype */
|
|
Packit Service |
c5cf8c |
int bytes;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Basic flags copied from pvar info + auxilary flags in pvar handle */
|
|
Packit Service |
c5cf8c |
int flags;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Store info here in case we need other fields */
|
|
Packit Service |
c5cf8c |
const pvar_table_entry_t *info;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Owner session from which the handle is allocated */
|
|
Packit Service |
c5cf8c |
struct MPIR_T_pvar_session_s *session;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Object which this pvar is bound to. NULL if no binding */
|
|
Packit Service |
c5cf8c |
void *obj_handle;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* This is how we support pvar sessions.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* For pvars of counter, timer or aggregate type, we cache their value at
|
|
Packit Service |
c5cf8c |
* the last start time in offset, their current value in current, and
|
|
Packit Service |
c5cf8c |
* their accumlated value in accum. Generally, when such a pvar is running,
|
|
Packit Service |
c5cf8c |
* reading the pvar should return
|
|
Packit Service |
c5cf8c |
* accum[i] + current[i] - offset[i], 0 <= i < count - 1.
|
|
Packit Service |
c5cf8c |
* When the pvar is stopped, reading just returns accum.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* For pvars of high/lowwatermark type, above method does not work.
|
|
Packit Service |
c5cf8c |
* We have a copy of such a pvar in every handle of the pvar.
|
|
Packit Service |
c5cf8c |
* Handles are registered to the pvar. Whenever a watermark changes,
|
|
Packit Service |
c5cf8c |
* its copies in non-stopped handles are updated. That sounds non-scalable.
|
|
Packit Service |
c5cf8c |
* Considering single-session is common, we reserve room in watermark
|
|
Packit Service |
c5cf8c |
* themselves for cache buffer for the first handle. So when such a pvar
|
|
Packit Service |
c5cf8c |
* changes, it also updates the watermark close to it in memory.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* For pvars of other classes, since they are supposed to be readonly
|
|
Packit Service |
c5cf8c |
* and continuous (FIXME: Is it true?), caching is not needed.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
void *accum;
|
|
Packit Service |
c5cf8c |
void *offset;
|
|
Packit Service |
c5cf8c |
void *current;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
watermark_value_t watermark;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* To chain handles in a session */
|
|
Packit Service |
c5cf8c |
struct MPIR_T_pvar_handle_s *prev, *next;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* To chain handles of a watermark pvar */
|
|
Packit Service |
c5cf8c |
struct MPIR_T_pvar_handle_s *prev2, *next2;
|
|
Packit Service |
c5cf8c |
} MPIR_T_pvar_handle_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
typedef struct MPIR_T_pvar_session_s {
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_ERROR_CHECKING
|
|
Packit Service |
c5cf8c |
MPIR_T_object_kind kind;
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* A linked list of pvar handles */
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_handle_t *hlist;
|
|
Packit Service |
c5cf8c |
} MPIR_T_pvar_session_t;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
extern void MPIR_T_PVAR_REGISTER_impl(MPIR_T_pvar_class_t varclass, MPI_Datatype dtype,
|
|
Packit Service |
c5cf8c |
const char *name, void *addr, int count,
|
|
Packit Service |
c5cf8c |
MPIR_T_enum_t * etype, MPIR_T_verbosity_t verb,
|
|
Packit Service |
c5cf8c |
MPIR_T_bind_t bind, int flags,
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_get_value_cb get_value,
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_get_count_cb get_count, const char *cat,
|
|
Packit Service |
c5cf8c |
const char *desc);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* For static pvars (i.e., pvars with static storage), we embed their class name
|
|
Packit Service |
c5cf8c |
* into their variable name, so that users can declare pvars with the same name
|
|
Packit Service |
c5cf8c |
* for different classes, without worry of name conflict. "class + pvar name"
|
|
Packit Service |
c5cf8c |
* should be unique as required by MPI_T.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPI_T_PVAR_CLASS_STATE (continuous only)
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Interfaces through pointer or name */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_STATE_SET_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { *(ptr_) = (val_); } while (0)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_STATE_GET_VAR_impl(ptr_) \
|
|
Packit Service |
c5cf8c |
(*(ptr_))
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_STATE_SET_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_STATE_SET_VAR_impl(&PVAR_STATE_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_STATE_GET_impl(name_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_STATE_GET_VAR_impl(&PVAR_STATE_##name_)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration AND initialization for static pvar */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_STATE_REGISTER_STATIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
initval_, etype_, verb_, bind_, flags_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
void *addr_; \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes only */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_INT); \
|
|
Packit Service |
c5cf8c |
/* Double check if dtype_ and name_ match */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert(sizeof(PVAR_STATE_##name_) == MPIR_Datatype_get_basic_size(dtype_)); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((flags_) & MPIR_T_PVAR_FLAG_CONTINUOUS); \
|
|
Packit Service |
c5cf8c |
/* State pvars should be describled further by an enum */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((etype_) != MPI_T_ENUM_NULL); \
|
|
Packit Service |
c5cf8c |
PVAR_STATE_##name_ = (initval_); \
|
|
Packit Service |
c5cf8c |
addr_ = &PVAR_STATE_##name_; \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_STATE, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, 1, etype_, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration for dynamic pvar w/ or w/o callback. Init is left to users */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_STATE_REGISTER_DYNAMIC_impl(dtype_, name_, addr_, count_, \
|
|
Packit Service |
c5cf8c |
etype_, verb_, bind_, flags_, get_value_, get_count_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_INT); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((flags_) & MPIR_T_PVAR_FLAG_CONTINUOUS); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((etype_) != MPI_T_ENUM_NULL); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((addr_) != NULL || (get_value_) != NULL); \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_STATE, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, etype_, verb_, bind_, flags_, get_value_, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPI_T_PVAR_CLASS_LEVEL (continuous only)
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Interfaces through pointer or name */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_LEVEL_SET_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { *(ptr_) = (val_); } while (0)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_LEVEL_GET_VAR_impl(ptr_) \
|
|
Packit Service |
c5cf8c |
(*(ptr_))
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_LEVEL_INC_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { *(ptr_) += (val_); } while (0)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_LEVEL_DEC_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { *(ptr_) -= (val_); } while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_LEVEL_SET_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_LEVEL_SET_VAR_impl(&PVAR_LEVEL_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_LEVEL_GET_impl(name_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_LEVEL_GET_VAR_impl(&PVAR_LEVEL_##name_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_LEVEL_INC_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_LEVEL_INC_VAR_impl(&PVAR_LEVEL_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_LEVEL_DEC_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_LEVEL_DEC_VAR_impl(&PVAR_LEVEL_##name_, val_)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration AND initialization for static pvar */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_LEVEL_REGISTER_STATIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
initval_, verb_, bind_, flags_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
void *addr_; \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes only */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
|
|
Packit Service |
c5cf8c |
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
|
|
Packit Service |
c5cf8c |
/* Double check if dtype_ and name_ match */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert(sizeof(PVAR_LEVEL_##name_) == MPIR_Datatype_get_basic_size(dtype_)); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((flags_) & MPIR_T_PVAR_FLAG_CONTINUOUS); \
|
|
Packit Service |
c5cf8c |
PVAR_LEVEL_##name_ = (initval_); \
|
|
Packit Service |
c5cf8c |
addr_ = &PVAR_LEVEL_##name_; \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_LEVEL, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration for dynamic pvar w/ or w/o callback. Init is left to users */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_LEVEL_REGISTER_DYNAMIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, verb_, bind_, flags_, get_value_, get_count, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
|
|
Packit Service |
c5cf8c |
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((flags_) & MPIR_T_PVAR_FLAG_CONTINUOUS); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((addr_) != NULL || (get_value_) != NULL); \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_LEVEL, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, MPI_T_ENUM_NULL, verb_, bind_, flags_, get_value_, \
|
|
Packit Service |
c5cf8c |
get_count, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPI_T_PVAR_CLASS_SIZE (continuous only)
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Interfaces through pointer or name */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_SIZE_SET_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { *(ptr_) = (val_); } while (0)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_SIZE_GET_VAR_impl(ptr_) \
|
|
Packit Service |
c5cf8c |
(*(ptr_))
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_SIZE_SET_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_SIZE_SET_VAR_impl(&PVAR_SIZE_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_SIZE_GET_impl(name_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_SIZE_GET_VAR_impl(&PVAR_SIZE_##name_)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration AND initialization for static pvar */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_SIZE_REGISTER_STATIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
initval_, verb_, bind_, flags_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
void *addr_; \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes only */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
|
|
Packit Service |
c5cf8c |
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
|
|
Packit Service |
c5cf8c |
/* Double check if dtype_ and name_ match */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert(sizeof(PVAR_SIZE_##name_) == MPIR_Datatype_get_basic_size(dtype_)); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((flags_) & MPIR_T_PVAR_FLAG_CONTINUOUS); \
|
|
Packit Service |
c5cf8c |
PVAR_SIZE_##name_ = (initval_); \
|
|
Packit Service |
c5cf8c |
addr_ = &PVAR_SIZE_##name_; \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_SIZE, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration for dynamic pvar w/ or w/o callback. Init is left to users */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_SIZE_REGISTER_DYNAMIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, verb_, bind_, flags_, get_value_, get_count_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
|
|
Packit Service |
c5cf8c |
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((flags_) & MPIR_T_PVAR_FLAG_CONTINUOUS); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((addr_) != NULL || (get_value_) != NULL); \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_SIZE, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, MPI_T_ENUM_NULL, verb_, bind_, flags_, get_value_, \
|
|
Packit Service |
c5cf8c |
get_count_, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPI_T_PVAR_CLASS_PERCENTAGE (continuous only)
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Interfaces through pointer or name */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_PERCENTAGE_SET_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
MPIR_Assert(0.0 <= (val_) && (val_) <= 1.0); \
|
|
Packit Service |
c5cf8c |
*(ptr_) = (val_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_PERCENTAGE_GET_VAR_impl(ptr_) \
|
|
Packit Service |
c5cf8c |
(*(ptr_))
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_PERCENTAGE_SET_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_PERCENTAGE_SET_VAR_impl(&PVAR_PERCENTAGE_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_PERCENTAGE_GET_impl(name_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_PERCENTAGE_GET_VAR_impl(&PVAR_PERCENTAGE_##name_)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration AND initialization for static pvar */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_PERCENTAGE_REGISTER_STATIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
initval_, verb_, bind_, flags_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
void *addr_; \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes only */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_DOUBLE); \
|
|
Packit Service |
c5cf8c |
/* Double check if dtype_ and name_ match */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert(sizeof(PVAR_PERCENTAGE_##name_) == MPIR_Datatype_get_basic_size(dtype_)); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((flags_) & MPIR_T_PVAR_FLAG_CONTINUOUS); \
|
|
Packit Service |
c5cf8c |
addr_ = &PVAR_PERCENTAGE_##name_; \
|
|
Packit Service |
c5cf8c |
PVAR_PERCENTAGE_##name_ = (initval_); \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_PERCENTAGE, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration for dynamic pvar w/ or w/o callback. Init is left to users */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_PERCENTAGE_REGISTER_DYNAMIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, verb_, bind_, flags_, get_value_, get_count_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_DOUBLE); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((flags_) & MPIR_T_PVAR_FLAG_CONTINUOUS); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((addr_) != NULL || (get_value_) != NULL); \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_PERCENTAGE, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, MPI_T_ENUM_NULL, verb_, bind_, flags_, get_value_, \
|
|
Packit Service |
c5cf8c |
get_count_, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPI_T_PVAR_CLASS_COUNTER (continuous or not)
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Interfaces through pointer or name */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_INIT_VAR_impl(ptr_) \
|
|
Packit Service |
c5cf8c |
do { *(ptr_) = 0; } while (0)
|
|
Packit Service |
c5cf8c |
/* _COUNTER_SET is intentionally not provided. Users should only INC counters */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_GET_VAR_impl(ptr_) \
|
|
Packit Service |
c5cf8c |
(*(ptr_))
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_INC_VAR_impl(ptr_, inc_) \
|
|
Packit Service |
c5cf8c |
do { *(ptr_) += (inc_); } while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_INIT_impl(name_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_COUNTER_INIT_VAR_impl(&PVAR_COUNTER_##name_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_GET_impl(name_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_COUNTER_GET_VAR_impl(&PVAR_COUNTER_##name_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_INC_impl(name_, inc_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_COUNTER_INC_VAR_impl(&PVAR_COUNTER_##name_, inc_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_ADDR_impl(name_) \
|
|
Packit Service |
c5cf8c |
(&PVAR_COUNTER_##name_)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration AND initialization to zero for static pvar. */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_REGISTER_STATIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
verb_, bind_, flags_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
void *addr_; \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes only */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
|
|
Packit Service |
c5cf8c |
(dtype_) == MPI_UNSIGNED_LONG_LONG); \
|
|
Packit Service |
c5cf8c |
/* Double check if dtype_ and name_ match*/ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert(sizeof(PVAR_COUNTER_##name_) == MPIR_Datatype_get_basic_size(dtype_)); \
|
|
Packit Service |
c5cf8c |
PVAR_COUNTER_##name_ = 0; \
|
|
Packit Service |
c5cf8c |
addr_ = &PVAR_COUNTER_##name_; \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_COUNTER, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration for dynamic pvar w/ or w/o callback. Init is left to users */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_REGISTER_DYNAMIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, verb_, bind_, flags_, get_value_, get_count_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
|
|
Packit Service |
c5cf8c |
(dtype_) == MPI_UNSIGNED_LONG_LONG); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((addr_) != NULL || (get_value_) != NULL); \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_COUNTER, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, MPI_T_ENUM_NULL, verb_, bind_, flags_, get_value_, \
|
|
Packit Service |
c5cf8c |
get_count_, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Interfaces through pointer or name */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_ARRAY_INIT_VAR_impl(ptr_, count_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
int idx_; \
|
|
Packit Service |
c5cf8c |
idx_ = 0; \
|
|
Packit Service |
c5cf8c |
for (; idx_ < (count_); idx_++) \
|
|
Packit Service |
c5cf8c |
*((ptr_) + idx_) = 0; \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_ARRAY_GET_VAR_impl(ptr_, idx_) \
|
|
Packit Service |
c5cf8c |
*((ptr_) + (idx_))
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_ARRAY_INC_VAR_impl(ptr_, idx_, inc_) \
|
|
Packit Service |
c5cf8c |
do { *((ptr_) + (idx_)) += (inc_); } while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_ARRAY_INIT_impl(name_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
int count_; \
|
|
Packit Service |
c5cf8c |
count_ = sizeof(PVAR_COUNTER_##name_)/sizeof(PVAR_COUNTER_##name_[0]); \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_COUNTER_ARRAY_INIT_VAR_impl(PVAR_COUNTER_##name_, count_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_ARRAY_GET_impl(name_, idx_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_COUNTER_ARRAY_GET_VAR_impl(PVAR_COUNTER_##name_, idx_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_ARRAY_INC_impl(ptr_, idx_, inc_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_COUNTER_ARRAY_INC_VAR_impl(PVAR_COUNTER_##name_, idx_, inc_)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration AND initialization to zero for static counter array */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_COUNTER_ARRAY_REGISTER_STATIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
verb_, bind_, flags_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
void *addr_; \
|
|
Packit Service |
c5cf8c |
int count_; \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes only */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
|
|
Packit Service |
c5cf8c |
(dtype_) == MPI_UNSIGNED_LONG_LONG); \
|
|
Packit Service |
c5cf8c |
/* Double check if dtype_ and name_ match */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert(sizeof(PVAR_COUNTER_##name_[0]) == MPIR_Datatype_get_basic_size(dtype_)); \
|
|
Packit Service |
c5cf8c |
addr_ = PVAR_COUNTER_##name_; \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_COUNTER_ARRAY_INIT_impl(name_); \
|
|
Packit Service |
c5cf8c |
count_ = sizeof(PVAR_COUNTER_##name_)/sizeof(mpit_pvar_##name_[0]); \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_COUNTER, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Dynamic counter array is already provided by MPIR_T_PVAR_COUNTER_REGISTER_DYNAMIC */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPI_T_PVAR_CLASS_AGGREGATE (continuous or not)
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Interfaces through pointer or name */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_AGGREGATE_INIT_VAR_impl(ptr_) \
|
|
Packit Service |
c5cf8c |
do { *(ptr_) = 0; } while (0)
|
|
Packit Service |
c5cf8c |
/* _AGGREGATE_SET is intentionally not provided as for counters */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_AGGREGATE_GET_VAR_impl(ptr_) \
|
|
Packit Service |
c5cf8c |
(*(ptr_))
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_AGGREGATE_INC_VAR_impl(ptr_, inc_) \
|
|
Packit Service |
c5cf8c |
do { *(ptr_) += (inc_); } while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_AGGREGATE_INIT_impl(name_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_AGGREGATE_INIT_VAR_impl(&PVAR_AGGREGATE_##name_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_AGGREGATE_GET_impl(name_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_AGGREGATE_GET_VAR_impl(&PVAR_AGGREGATE_##name_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_AGGREGATE_INC_impl(name_, inc_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_AGGREGATE_INC_VAR_impl(&PVAR_AGGREGATE_##name_, inc_)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration AND initialization to zero for static aggregate */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_AGGREGATE_REGISTER_STATIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
verb_, bind_, flags_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
void *addr; \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes only */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
|
|
Packit Service |
c5cf8c |
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
|
|
Packit Service |
c5cf8c |
/* Double check if dtype_ and name_ match*/ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert(sizeof(PVAR_AGGREGATE_##name_) == MPIR_Datatype_get_basic_size(dtype_)); \
|
|
Packit Service |
c5cf8c |
PVAR_AGGREGATE_##name_ = 0; \
|
|
Packit Service |
c5cf8c |
addr_ = &PVAR_AGGREGATE_##name_; \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_AGGREGATE, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration for dynamic pvar w/ or w/o callback. Init is left to users */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_AGGREGATE_REGISTER_DYNAMIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, verb_, bind_, flags_, get_value_, get_count_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
|
|
Packit Service |
c5cf8c |
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((addr_) != NULL || (get_value_) != NULL); \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_AGGREGATE, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, MPI_T_ENUM_NULL, verb_, bind_, flags_, get_value_, \
|
|
Packit Service |
c5cf8c |
get_count_, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPI_T_PVAR_CLASS_TIMER (continuous or not)
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Interfaces through pointer or name */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_TIMER_INIT_VAR_impl(ptr_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
/* FIXME: need a generic approach to init a timer */ \
|
|
Packit Service |
c5cf8c |
memset(&((ptr_)->total), 0, sizeof(MPID_Time_t)); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_TIMER_GET_VAR_impl(ptr_, buf) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
MPID_Wtime_todouble(&((ptr_)->total), buf); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_TIMER_START_VAR_impl(ptr_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
MPID_Wtime(&((ptr_)->curstart)); \
|
|
Packit Service |
c5cf8c |
(ptr_)->count++; \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_TIMER_END_VAR_impl(ptr_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
MPID_Time_t tmp_; \
|
|
Packit Service |
c5cf8c |
MPID_Wtime(&tmp_); \
|
|
Packit Service |
c5cf8c |
MPID_Wtime_acc(&((ptr_)->curstart), &tmp_, &((ptr_)->total)); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_TIMER_INIT_impl(name_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_TIMER_INIT_VAR_impl(&PVAR_TIMER_##name_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_TIMER_GET_impl(name_, buf_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_TIMER_GET_VAR_impl(&PVAR_TIMER_##name_, buf_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_TIMER_START_impl(name_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_TIMER_START_VAR_impl(&PVAR_TIMER_##name_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_TIMER_END_impl(name_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_TIMER_END_VAR_impl(&PVAR_TIMER_##name_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_TIMER_ADDR_impl(name_) \
|
|
Packit Service |
c5cf8c |
(&PVAR_TIMER_##name_)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Customized get_value() for MPIR_T_pvar_timer_t */
|
|
Packit Service |
c5cf8c |
static inline
|
|
Packit Service |
c5cf8c |
void get_timer_time_in_double(MPIR_T_pvar_timer_t * timer, void *obj_handle,
|
|
Packit Service |
c5cf8c |
int count, double *buf)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int i;
|
|
Packit Service |
c5cf8c |
for (i = 0; i < count; i++)
|
|
Packit Service |
c5cf8c |
MPID_Wtime_todouble(&(timer[i].total), &buf[i]);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration for static storage */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_TIMER_REGISTER_STATIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
verb_, bind_, flags_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
void *addr_; \
|
|
Packit Service |
c5cf8c |
void *count_addr_; \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes only */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_DOUBLE); \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_TIMER_INIT_impl(name_); \
|
|
Packit Service |
c5cf8c |
addr_ = &PVAR_TIMER_##name_; \
|
|
Packit Service |
c5cf8c |
count_addr_ = &(PVAR_TIMER_##name_.count); \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_TIMER, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, \
|
|
Packit Service |
c5cf8c |
(MPIR_T_pvar_get_value_cb *)&get_timer_time_in_double, NULL, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_COUNTER, MPI_UNSIGNED_LONG_LONG, #name_, \
|
|
Packit Service |
c5cf8c |
count_addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, \
|
|
Packit Service |
c5cf8c |
NULL, NULL, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPI_T_PVAR_CLASS_HIGHWATERMARK (continuous or not)
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Interfaces through pointer or name.
|
|
Packit Service |
c5cf8c |
* In contrast to previous pvar classes, for each type we create a set
|
|
Packit Service |
c5cf8c |
* of interfaces. That is because we have a pointer and a union in the
|
|
Packit Service |
c5cf8c |
* struct. We need to know types to (de)reference them.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_UINT_HIGHWATERMARK_INIT_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
(ptr_)->datatype = MPI_UNSIGNED; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.u = (val_); \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_started = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_used = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->hlist = NULL; \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG_HIGHWATERMARK_INIT_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
(ptr_)->datatype = MPI_UNSIGNED_LONG; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.ul = (val_); \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_started = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_used = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->hlist = NULL; \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG2_HIGHWATERMARK_INIT_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
(ptr_)->datatype = MPI_UNSIGNED_LONG_LONG; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.ull = (val_); \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_started = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_used = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->hlist = NULL; \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_DOUBLE_HIGHWATERMARK_INIT_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
(ptr_)->datatype = MPI_DOUBLE; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.f = (val_); \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_started = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_used = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->hlist = NULL; \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_UINT_HIGHWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_handle_t *head; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.u = (val_); \
|
|
Packit Service |
c5cf8c |
if ((ptr_)->first_used && (ptr_)->first_started) { \
|
|
Packit Service |
c5cf8c |
if ((val_) > (ptr_)->watermark.u) \
|
|
Packit Service |
c5cf8c |
(ptr_)->watermark.u = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = (ptr_)->hlist; \
|
|
Packit Service |
c5cf8c |
while (head != NULL) { \
|
|
Packit Service |
c5cf8c |
if (MPIR_T_pvar_is_started(head) && (val_) > head->watermark.u) { \
|
|
Packit Service |
c5cf8c |
head->watermark.u = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = head->next2; \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG_HIGHWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_handle_t *head; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.ul = (val_); \
|
|
Packit Service |
c5cf8c |
if ((ptr_)->first_used && (ptr_)->first_started) { \
|
|
Packit Service |
c5cf8c |
if ((val_) > (ptr_)->watermark.ul) \
|
|
Packit Service |
c5cf8c |
(ptr_)->watermark.ul = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = (ptr_)->hlist; \
|
|
Packit Service |
c5cf8c |
while (head != NULL) { \
|
|
Packit Service |
c5cf8c |
if (MPIR_T_pvar_is_started(head) && (val_) > head->watermark.ul) { \
|
|
Packit Service |
c5cf8c |
head->watermark.ul = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = head->next2; \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG2_HIGHWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_handle_t *head; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.ull = (val_); \
|
|
Packit Service |
c5cf8c |
if ((ptr_)->first_used && (ptr_)->first_started) { \
|
|
Packit Service |
c5cf8c |
if ((val_) > (ptr_)->watermark.ull) \
|
|
Packit Service |
c5cf8c |
(ptr_)->watermark.ull = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = (ptr_)->hlist; \
|
|
Packit Service |
c5cf8c |
while (head != NULL) { \
|
|
Packit Service |
c5cf8c |
if (MPIR_T_pvar_is_started(head) && (val_) > head->watermark.ull) { \
|
|
Packit Service |
c5cf8c |
head->watermark.ull = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = head->next2; \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_DOUBLE_HIGHWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_handle_t *head; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.f = (val_); \
|
|
Packit Service |
c5cf8c |
if ((ptr_)->first_used && (ptr_)->first_started) { \
|
|
Packit Service |
c5cf8c |
if ((val_) > (ptr_)->watermark.f) \
|
|
Packit Service |
c5cf8c |
(ptr_)->watermark.f = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = (ptr_)->hlist; \
|
|
Packit Service |
c5cf8c |
while (head != NULL) { \
|
|
Packit Service |
c5cf8c |
if (MPIR_T_pvar_is_started(head) && (val_) > head->watermark.f) { \
|
|
Packit Service |
c5cf8c |
head->watermark.f = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = head->next2; \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_UINT_HIGHWATERMARK_INIT_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_UINT_HIGHWATERMARK_INIT_VAR_impl(&PVAR_HIGHWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG_HIGHWATERMARK_INIT_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_ULONG_HIGHWATERMARK_INIT_VAR_impl(&PVAR_HIGHWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG2_HIGHWATERMARK_INIT_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_ULONG2_HIGHWATERMARK_INIT_VAR_impl(&PVAR_HIGHWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_DOUBLE_HIGHWATERMARK_INIT_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_DOUBLE_HIGHWATERMARK_INIT_VAR_impl(&PVAR_HIGHWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_UINT_HIGHWATERMARK_UPDATE_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_UINT_HIGHWATERMARK_UPDATE_VAR_impl(&PVAR_HIGHWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG_HIGHWATERMARK_UPDATE_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_ULONG_HIGHWATERMARK_UPDATE_VAR_impl(&PVAR_HIGHWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG2_HIGHWATERMARK_UPDATE_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_ULONG2_HIGHWATERMARK_UPDATE_VAR_impl(&PVAR_HIGHWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_DOUBLE_HIGHWATERMARK_UPDATE_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_DOUBLE_HIGHWATERMARK_UPDATE_VAR_impl(&PVAR_HIGHWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration AND initialization for static pvar */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_HIGHWATERMARK_REGISTER_STATIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
initval_, verb_, bind_, flags_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
void *addr_; \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes only */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
|
|
Packit Service |
c5cf8c |
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
|
|
Packit Service |
c5cf8c |
switch (dtype_) { \
|
|
Packit Service |
c5cf8c |
case MPI_UNSIGNED: \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_UINT_HIGHWATERMARK_INIT_impl(name_, initval_); break; \
|
|
Packit Service |
c5cf8c |
case MPI_UNSIGNED_LONG: \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_ULONG_HIGHWATERMARK_INIT_impl(name_, initval_); break; \
|
|
Packit Service |
c5cf8c |
case MPI_UNSIGNED_LONG_LONG: \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_ULONG2_HIGHWATERMARK_INIT_impl(name_, initval_); break; \
|
|
Packit Service |
c5cf8c |
case MPI_DOUBLE: \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_DOUBLE_HIGHWATERMARK_INIT_impl(name_, initval_); break; \
|
|
Packit Service |
c5cf8c |
default: \
|
|
Packit Service |
c5cf8c |
break; \
|
|
Packit Service |
c5cf8c |
}; \
|
|
Packit Service |
c5cf8c |
addr_ = &PVAR_HIGHWATERMARK_##name_; \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_HIGHWATERMARK, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration for dynamic pvar w/ or w/o callback. Init is left to users */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_HIGHWATERMARK_REGISTER_DYNAMIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, verb_, bind_, flags_, get_value_, get_count_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
|
|
Packit Service |
c5cf8c |
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((addr_) != NULL || (get_value_) != NULL); \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_HIGHWATERMARK, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, MPI_T_ENUM_NULL, verb_, bind_, flags_, get_value_, \
|
|
Packit Service |
c5cf8c |
get_count_, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPI_T_PVAR_CLASS_LOWWATERMARK (continuous or not)
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_UINT_LOWWATERMARK_INIT_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
(ptr_)->datatype = MPI_UNSIGNED; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.u = (val_); \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_started = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_used = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->hlist = NULL; \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG_LOWWATERMARK_INIT_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
(ptr_)->datatype = MPI_UNSIGNED_LONG; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.ul = (val_); \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_started = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_used = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->hlist = NULL; \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG2_LOWWATERMARK_INIT_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
(ptr_)->datatype = MPI_UNSIGNED_LONG_LONG; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.ull = (val_); \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_started = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_used = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->hlist = NULL; \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_DOUBLE_LOWWATERMARK_INIT_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
(ptr_)->datatype = MPI_DOUBLE; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.f = (val_); \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_started = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->first_used = 0; \
|
|
Packit Service |
c5cf8c |
(ptr_)->hlist = NULL; \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_UINT_LOWWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_handle_t *head; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.u = (val_); \
|
|
Packit Service |
c5cf8c |
/* Update values in all handles */ \
|
|
Packit Service |
c5cf8c |
if ((ptr_)->first_used && (ptr_)->first_started) { \
|
|
Packit Service |
c5cf8c |
if ((val_) < (ptr_)->watermark.u) \
|
|
Packit Service |
c5cf8c |
(ptr_)->watermark.u = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = (ptr_)->hlist; \
|
|
Packit Service |
c5cf8c |
while (head != NULL) { \
|
|
Packit Service |
c5cf8c |
if (MPIR_T_pvar_is_started(head) && (val_) < head->watermark.u) { \
|
|
Packit Service |
c5cf8c |
head->watermark.u = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = head->next2; \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG_LOWWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_handle_t *head; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.ul = (val_); \
|
|
Packit Service |
c5cf8c |
if ((ptr_)->first_used && (ptr_)->first_started) { \
|
|
Packit Service |
c5cf8c |
if ((val_) < (ptr_)->watermark.ul) \
|
|
Packit Service |
c5cf8c |
(ptr_)->watermark.ul = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = (ptr_)->hlist; \
|
|
Packit Service |
c5cf8c |
while (head != NULL) { \
|
|
Packit Service |
c5cf8c |
if (MPIR_T_pvar_is_started(head) && (val_) < head->watermark.ul) { \
|
|
Packit Service |
c5cf8c |
head->watermark.ul = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = head->next2; \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG2_LOWWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_handle_t *head; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.ull = (val_); \
|
|
Packit Service |
c5cf8c |
if ((ptr_)->first_used && (ptr_)->first_started) { \
|
|
Packit Service |
c5cf8c |
if ((val_) < (ptr_)->watermark.ull) \
|
|
Packit Service |
c5cf8c |
(ptr_)->watermark.ull = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = (ptr_)->hlist; \
|
|
Packit Service |
c5cf8c |
while (head != NULL) { \
|
|
Packit Service |
c5cf8c |
if (MPIR_T_pvar_is_started(head) && (val_) < head->watermark.ull) { \
|
|
Packit Service |
c5cf8c |
head->watermark.ull = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = head->next2; \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_DOUBLE_LOWWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_handle_t *head; \
|
|
Packit Service |
c5cf8c |
(ptr_)->current.f = (val_); \
|
|
Packit Service |
c5cf8c |
if ((ptr_)->first_used && (ptr_)->first_started) { \
|
|
Packit Service |
c5cf8c |
if ((val_) < (ptr_)->watermark.f) \
|
|
Packit Service |
c5cf8c |
(ptr_)->watermark.f = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = (ptr_)->hlist; \
|
|
Packit Service |
c5cf8c |
while (head != NULL) { \
|
|
Packit Service |
c5cf8c |
if (MPIR_T_pvar_is_started(head) && (val_) < head->watermark.f) { \
|
|
Packit Service |
c5cf8c |
head->watermark.f = (val_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
head = head->next2; \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_UINT_LOWWATERMARK_INIT_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_UINT_LOWWATERMARK_INIT_VAR_impl(&PVAR_LOWWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG_LOWWATERMARK_INIT_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_ULONG_LOWWATERMARK_INIT_VAR_impl(&PVAR_LOWWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG2_LOWWATERMARK_INIT_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_ULONG2_LOWWATERMARK_INIT_VAR_impl(&PVAR_LOWWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_DOUBLE_LOWWATERMARK_INIT_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_DOUBLE_LOWWATERMARK_INIT_VAR_impl(&PVAR_LOWWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_UINT_LOWWATERMARK_UPDATE_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_UINT_LOWWATERMARK_UPDATE_VAR_impl(&PVAR_LOWWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG_LOWWATERMARK_UPDATE_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_ULONG_LOWWATERMARK_UPDATE_VAR_impl(&PVAR_LOWWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_ULONG2_LOWWATERMARK_UPDATE_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_ULONG2_LOWWATERMARK_UPDATE_VAR_impl(&PVAR_LOWWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_DOUBLE_LOWWATERMARK_UPDATE_impl(name_, val_) \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_DOUBLE_LOWWATERMARK_UPDATE_VAR_impl(&PVAR_LOWWATERMARK_##name_, val_)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration AND initialization for static pvar */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_LOWWATERMARK_REGISTER_STATIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
initval_, verb_, bind_, flags_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
void *addr_; \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes only */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
|
|
Packit Service |
c5cf8c |
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
|
|
Packit Service |
c5cf8c |
switch (dtype_) { \
|
|
Packit Service |
c5cf8c |
case MPI_UNSIGNED: \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_UINT_LOWWATERMARK_INIT_impl(name_, initval_); break; \
|
|
Packit Service |
c5cf8c |
case MPI_UNSIGNED_LONG: \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_ULONG_LOWWATERMARK_INIT_impl(name_, initval_); break; \
|
|
Packit Service |
c5cf8c |
case MPI_UNSIGNED_LONG_LONG: \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_ULONG2_LOWWATERMARK_INIT_impl(name_, initval_); break; \
|
|
Packit Service |
c5cf8c |
case MPI_DOUBLE: \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_DOUBLE_LOWWATERMARK_INIT_impl(name_, initval_); break; \
|
|
Packit Service |
c5cf8c |
default: \
|
|
Packit Service |
c5cf8c |
break; \
|
|
Packit Service |
c5cf8c |
}; \
|
|
Packit Service |
c5cf8c |
addr_ = &PVAR_LOWWATERMARK_##name_; \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_LOWWATERMARK, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Registration for dynamic pvar w/ or w/o callback. Init is left to users */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_LOWWATERMARK_REGISTER_DYNAMIC_impl(dtype_, name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, verb_, bind_, flags_, get_value_, get_count_, cat_, desc_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
/* Allowable datatypes */ \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
|
|
Packit Service |
c5cf8c |
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert((addr_) != NULL || (get_value_) != NULL); \
|
|
Packit Service |
c5cf8c |
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_LOWWATERMARK, dtype_, #name_, \
|
|
Packit Service |
c5cf8c |
addr_, count_, MPI_T_ENUM_NULL, verb_, bind_, flags_, get_value_, \
|
|
Packit Service |
c5cf8c |
get_count_, cat_, desc_); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Unregister a pvar by its index */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_PVAR_UNREGISTER(idx_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
if (pvar_table != NULL) { \
|
|
Packit Service |
c5cf8c |
pvar_table_entry_t *pvar = \
|
|
Packit Service |
c5cf8c |
(pvar_table_entry_t *)utarray_eltptr(pvar_table, idx_); \
|
|
Packit Service |
c5cf8c |
if (pvar != NULL) { \
|
|
Packit Service |
c5cf8c |
pvar->active = FALSE; \
|
|
Packit Service |
c5cf8c |
/* Do not do MPL_free(pvar->info), since it may be re-activated */ \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static inline int MPIR_T_pvar_is_readonly(MPIR_T_pvar_handle_t * handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
return handle->flags & MPIR_T_PVAR_FLAG_READONLY;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static inline int MPIR_T_pvar_is_continuous(MPIR_T_pvar_handle_t * handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
return handle->flags & MPIR_T_PVAR_FLAG_CONTINUOUS;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static inline int MPIR_T_pvar_is_atomic(MPIR_T_pvar_handle_t * handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
return handle->flags & MPIR_T_PVAR_FLAG_ATOMIC;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static inline int MPIR_T_pvar_is_sum(MPIR_T_pvar_handle_t * handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
return handle->flags & MPIR_T_PVAR_FLAG_SUM;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static inline int MPIR_T_pvar_is_watermark(MPIR_T_pvar_handle_t * handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
return handle->flags & MPIR_T_PVAR_FLAG_WATERMARK;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static inline int MPIR_T_pvar_is_started(MPIR_T_pvar_handle_t * handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
return handle->flags & MPIR_T_PVAR_FLAG_STARTED;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static inline void MPIR_T_pvar_set_started(MPIR_T_pvar_handle_t * handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
handle->flags |= (MPIR_T_PVAR_FLAG_STARTED | MPIR_T_PVAR_FLAG_ONCESTARTED);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static inline void MPIR_T_pvar_unset_started(MPIR_T_pvar_handle_t * handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
handle->flags &= ~MPIR_T_PVAR_FLAG_STARTED;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static inline int MPIR_T_pvar_is_oncestarted(MPIR_T_pvar_handle_t * handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
return handle->flags & MPIR_T_PVAR_FLAG_ONCESTARTED;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static inline void MPIR_T_pvar_unset_oncestarted(MPIR_T_pvar_handle_t * handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
handle->flags &= ~MPIR_T_PVAR_FLAG_ONCESTARTED;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static inline int MPIR_T_pvar_is_first(MPIR_T_pvar_handle_t * handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
return handle->flags & MPIR_T_PVAR_FLAG_FIRST;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static inline int MPIR_T_pvar_set_first(MPIR_T_pvar_handle_t * handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
return handle->flags |= MPIR_T_PVAR_FLAG_FIRST;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static inline int MPIR_T_pvar_unset_first(MPIR_T_pvar_handle_t * handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
return handle->flags &= ~MPIR_T_PVAR_FLAG_FIRST;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* A counter that keeps track of the relative balance of calls to
|
|
Packit Service |
c5cf8c |
* MPI_T_init_thread and MPI_T_finalize */
|
|
Packit Service |
c5cf8c |
extern int MPIR_T_init_balance;
|
|
Packit Service |
c5cf8c |
static inline int MPIR_T_is_initialized(void)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
return MPIR_T_init_balance > 0;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* A special strncpy to return strings in behavior defined by MPI_T */
|
|
Packit Service |
c5cf8c |
extern void MPIR_T_strncpy(char *dst, const char *src, int *len);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Stuffs to support multithreaded MPI_T */
|
|
Packit Service |
c5cf8c |
extern int MPIR_T_is_threaded;
|
|
Packit Service |
c5cf8c |
#define MPIR_T_THREAD_CHECK_BEGIN if (MPIR_T_is_threaded) {
|
|
Packit Service |
c5cf8c |
#define MPIR_T_THREAD_CHECK_END }
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#ifdef MPICH_IS_THREADED
|
|
Packit Service |
c5cf8c |
extern MPID_Thread_mutex_t mpi_t_mutex;
|
|
Packit Service |
c5cf8c |
#define MPIR_T_THREAD_CS_INIT() \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
int err_; \
|
|
Packit Service |
c5cf8c |
MPIR_T_THREAD_CHECK_BEGIN \
|
|
Packit Service |
c5cf8c |
MPID_Thread_mutex_create(&mpi_t_mutex, &err_); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert(err_ == 0); \
|
|
Packit Service |
c5cf8c |
MPIR_T_THREAD_CHECK_END \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_THREAD_CS_FINALIZE() \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
int err_; \
|
|
Packit Service |
c5cf8c |
MPIR_T_THREAD_CHECK_BEGIN \
|
|
Packit Service |
c5cf8c |
MPID_Thread_mutex_destroy(&mpi_t_mutex, &err_); \
|
|
Packit Service |
c5cf8c |
MPIR_Assert(err_ == 0); \
|
|
Packit Service |
c5cf8c |
MPIR_T_THREAD_CHECK_END \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_THREAD_CS_ENTER() \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
int err; \
|
|
Packit Service |
c5cf8c |
MPIR_T_THREAD_CHECK_BEGIN \
|
|
Packit Service |
c5cf8c |
MPID_Thread_mutex_lock(&mpi_t_mutex,&err;; \
|
|
Packit Service |
c5cf8c |
MPIR_T_THREAD_CHECK_END \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPIR_T_THREAD_CS_EXIT() \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
int err; \
|
|
Packit Service |
c5cf8c |
MPIR_T_THREAD_CHECK_BEGIN \
|
|
Packit Service |
c5cf8c |
MPID_Thread_mutex_unlock(&mpi_t_mutex,&err;; \
|
|
Packit Service |
c5cf8c |
MPIR_T_THREAD_CHECK_END \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
#else /* !MPICH_IS_THREADED */
|
|
Packit Service |
c5cf8c |
#define MPIR_T_THREAD_CS_INIT() do { /* nothing */ } while (0)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_THREAD_CS_FINALIZE() do { /* nothing */ } while (0)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_THREAD_CS_ENTER() do { /* nothing */ } while (0)
|
|
Packit Service |
c5cf8c |
#define MPIR_T_THREAD_CS_EXIT() do { /* nothing */ } while (0)
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Init and finalize routines */
|
|
Packit Service |
c5cf8c |
extern void MPIR_T_env_init(void);
|
|
Packit Service |
c5cf8c |
extern void MPIR_T_env_finalize(void);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#endif /* MPITIMPL_H_INCLUDED */
|