ompi/timings: fixed the error of opal timings env import
Signed-off-by: Boris Karasev <karasev.b@gmail.com>
Этот коммит содержится в:
родитель
95ae0d1df3
Коммит
d132eab4a5
@ -192,6 +192,7 @@ include mpiext/Makefile.am
|
||||
include patterns/net/Makefile.am
|
||||
include patterns/comm/Makefile.am
|
||||
include mca/Makefile.am
|
||||
include util/Makefile.am
|
||||
|
||||
# Ensure that the man page directory exists before we try to make man
|
||||
# page files (because ompi/mpi/man/man3 has no config.status-generated
|
||||
|
13
ompi/util/Makefile.am
Обычный файл
13
ompi/util/Makefile.am
Обычный файл
@ -0,0 +1,13 @@
|
||||
# -*- makefile -*-
|
||||
#
|
||||
# Copyright (c) 2017 Mellanox Technologies Ltd. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# Source code files
|
||||
headers += \
|
||||
util/timings.h
|
@ -1,3 +1,13 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Mellanox Technologies Ltd. All rights reserved.
|
||||
* Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef OMPI_UTIL_TIMING_H
|
||||
#define OMPI_UTIL_TIMING_H
|
||||
|
||||
@ -33,7 +43,7 @@ typedef struct ompi_timing_t {
|
||||
|
||||
#define OMPI_TIMING_INIT(_size) \
|
||||
ompi_timing_t OMPI_TIMING; \
|
||||
OMPI_TIMING.prefix = __func__; \
|
||||
OMPI_TIMING.prefix = __func__; \
|
||||
OMPI_TIMING.size = _size; \
|
||||
OMPI_TIMING.get_ts = opal_timing_ts_func(OPAL_TIMING_AUTOMATIC_TIMER); \
|
||||
OMPI_TIMING.cnt = 0; \
|
||||
@ -55,8 +65,8 @@ typedef struct ompi_timing_t {
|
||||
} \
|
||||
}
|
||||
|
||||
#define OMPI_TIMING_ITEM_EXTEND \
|
||||
do { \
|
||||
#define OMPI_TIMING_ITEM_EXTEND \
|
||||
do { \
|
||||
if (OMPI_TIMING.enabled) { \
|
||||
OMPI_TIMING.cur_timing->next = (struct ompi_timing_list_t*)malloc(sizeof(ompi_timing_list_t)); \
|
||||
OMPI_TIMING.cur_timing = (ompi_timing_list_t*)OMPI_TIMING.cur_timing->next; \
|
||||
@ -65,8 +75,8 @@ typedef struct ompi_timing_t {
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define OMPI_TIMING_FINALIZE \
|
||||
do { \
|
||||
#define OMPI_TIMING_FINALIZE \
|
||||
do { \
|
||||
if (OMPI_TIMING.enabled) { \
|
||||
ompi_timing_list_t *t = OMPI_TIMING.timing, *tmp; \
|
||||
while ( NULL != t) { \
|
||||
@ -81,8 +91,8 @@ typedef struct ompi_timing_t {
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define OMPI_TIMING_NEXT(...) \
|
||||
do { \
|
||||
#define OMPI_TIMING_NEXT(...) \
|
||||
do { \
|
||||
if (!OMPI_TIMING.error && OMPI_TIMING.enabled) { \
|
||||
char *f = strrchr(__FILE__, '/') + 1; \
|
||||
int len = 0; \
|
||||
@ -90,7 +100,7 @@ typedef struct ompi_timing_t {
|
||||
OMPI_TIMING_ITEM_EXTEND; \
|
||||
} \
|
||||
len = snprintf(OMPI_TIMING.cur_timing->val[OMPI_TIMING.cur_timing->use].desc, \
|
||||
OPAL_TIMING_STR_LEN, ##__VA_ARGS__); \
|
||||
OPAL_TIMING_STR_LEN, ##__VA_ARGS__); \
|
||||
if (len >= OPAL_TIMING_STR_LEN) { \
|
||||
OMPI_TIMING.error = 1; \
|
||||
} \
|
||||
@ -103,8 +113,8 @@ typedef struct ompi_timing_t {
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define OMPI_TIMING_APPEND(filename,func,desc,ts) \
|
||||
do { \
|
||||
#define OMPI_TIMING_APPEND(filename,func,desc,ts) \
|
||||
do { \
|
||||
if (OMPI_TIMING.cur_timing->use >= OMPI_TIMING.size){ \
|
||||
OMPI_TIMING_ITEM_EXTEND; \
|
||||
} \
|
||||
@ -115,20 +125,18 @@ typedef struct ompi_timing_t {
|
||||
} \
|
||||
OMPI_TIMING.cur_timing->val[OMPI_TIMING.cur_timing->use].prefix = func; \
|
||||
OMPI_TIMING.cur_timing->val[OMPI_TIMING.cur_timing->use].file = filename; \
|
||||
OMPI_TIMING.cur_timing->val[OMPI_TIMING.cur_timing->use++].ts = \
|
||||
OMPI_TIMING.get_ts() - OMPI_TIMING.ts; \
|
||||
OMPI_TIMING.cur_timing->val[OMPI_TIMING.cur_timing->use++].ts = ts; \
|
||||
OMPI_TIMING.cnt++; \
|
||||
OMPI_TIMING.ts = OMPI_TIMING.get_ts(); \
|
||||
} while(0)
|
||||
|
||||
#define OMPI_TIMING_IMPORT_OPAL_PREFIX(_prefix, func) \
|
||||
do { \
|
||||
#define OMPI_TIMING_IMPORT_OPAL_PREFIX(_prefix, func) \
|
||||
do { \
|
||||
if (!OMPI_TIMING.error && OMPI_TIMING.enabled) { \
|
||||
int cnt; \
|
||||
int cnt; \
|
||||
int i; \
|
||||
double ts; \
|
||||
OPAL_TIMING_ENV_CNT(func, cnt); \
|
||||
OPAL_TIMING_ENV_ERROR_PREFIX(_prefix, func, OMPI_TIMING.error); \
|
||||
double ts; \
|
||||
OPAL_TIMING_ENV_CNT(func, cnt); \
|
||||
OPAL_TIMING_ENV_ERROR_PREFIX(_prefix, func, OMPI_TIMING.error); \
|
||||
for(i = 0; i < cnt; i++){ \
|
||||
char *desc, *filename; \
|
||||
OPAL_TIMING_ENV_GETDESC_PREFIX(_prefix, &filename, func, i, &desc, ts); \
|
||||
@ -137,13 +145,11 @@ typedef struct ompi_timing_t {
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define OMPI_TIMING_IMPORT_OPAL(func) \
|
||||
OMPI_TIMING_IMPORT_OPAL_PREFIX("", func)
|
||||
#define OMPI_TIMING_IMPORT_OPAL(func) \
|
||||
OMPI_TIMING_IMPORT_OPAL_PREFIX("", func);
|
||||
|
||||
|
||||
|
||||
#define OMPI_TIMING_OUT \
|
||||
do { \
|
||||
#define OMPI_TIMING_OUT \
|
||||
do { \
|
||||
if (OMPI_TIMING.enabled) { \
|
||||
int i, size, rank; \
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &size); \
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Artem Polyakov <artpol84@gmail.com>
|
||||
* Copyright (c) 2014 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 Mellanox Technologies Ltd. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Artem Polyakov <artpol84@gmail.com>
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 Mellanox Technologies Ltd. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -39,7 +40,7 @@ typedef struct {
|
||||
|
||||
opal_timing_ts_func_t opal_timing_ts_func(opal_timer_type_t type);
|
||||
|
||||
#define OPAL_TIMING_ENV_START_TYPE(func, _nm, type, prefix) \
|
||||
#define OPAL_TIMING_ENV_START_TYPE(func, _nm, type, prefix) \
|
||||
do { \
|
||||
char *ptr = NULL; \
|
||||
char *_prefix = prefix; \
|
||||
@ -47,38 +48,39 @@ opal_timing_ts_func_t opal_timing_ts_func(opal_timer_type_t type);
|
||||
if( NULL == prefix ){ \
|
||||
_prefix = ""; \
|
||||
} \
|
||||
(_nm)->error = 0; \
|
||||
n = snprintf((_nm)->id, OPAL_TIMING_STR_LEN, "%s%s", _prefix, func); \
|
||||
(_nm)->error = 0; \
|
||||
n = snprintf((_nm)->id, OPAL_TIMING_STR_LEN, "%s%s", _prefix, func); \
|
||||
if( n > OPAL_TIMING_STR_LEN ){ \
|
||||
(_nm)->error = 1; \
|
||||
(_nm)->error = 1; \
|
||||
} \
|
||||
n = sprintf((_nm)->cntr_env,"OMPI_TIMING_%s%s_CNT", prefix, (_nm)->id); \
|
||||
n = sprintf((_nm)->cntr_env,"OMPI_TIMING_%s%s_CNT", prefix, (_nm)->id); \
|
||||
if( n > OPAL_TIMING_STR_LEN ){ \
|
||||
(_nm)->error = 1; \
|
||||
(_nm)->error = 1; \
|
||||
} \
|
||||
ptr = getenv((_nm)->id); \
|
||||
ptr = getenv((_nm)->id); \
|
||||
if( NULL == ptr || strcmp(ptr, "1")){ \
|
||||
(_nm)->enabled = 0; \
|
||||
(_nm)->enabled = 0; \
|
||||
} \
|
||||
(_nm)->get_ts = opal_timing_ts_func(type); \
|
||||
(_nm)->get_ts = opal_timing_ts_func(type); \
|
||||
ptr = getenv("OPAL_TIMING_ENABLE"); \
|
||||
if (NULL != ptr) { \
|
||||
(_nm)->enabled = atoi(ptr); \
|
||||
(_nm)->enabled = atoi(ptr); \
|
||||
} \
|
||||
(_nm)->cntr = 0; \
|
||||
ptr = getenv((_nm)->id); \
|
||||
(_nm)->cntr = 0; \
|
||||
ptr = getenv((_nm)->id); \
|
||||
if( NULL != ptr ){ \
|
||||
(_nm)->cntr = atoi(ptr); \
|
||||
(_nm)->cntr = atoi(ptr); \
|
||||
} \
|
||||
(_nm)->ts = (_nm)->get_ts(); \
|
||||
if ( 0 != (_nm)->error ){ \
|
||||
(_nm)->enabled = 0; \
|
||||
(_nm)->ts = (_nm)->get_ts(); \
|
||||
if ( 0 != (_nm)->error ){ \
|
||||
(_nm)->enabled = 0; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define OPAL_TIMING_ENV_INIT(name) \
|
||||
opal_timing_env_t name ## _val, *name = &(name ## _val); \
|
||||
OPAL_TIMING_ENV_START_TYPE(__func__, name, OPAL_TIMING_AUTOMATIC_TIMER, "");
|
||||
#define OPAL_TIMING_ENV_INIT(name) \
|
||||
opal_timing_env_t name ## _val, *name = &(name ## _val); \
|
||||
OPAL_TIMING_ENV_START_TYPE(__func__, name, OPAL_TIMING_AUTOMATIC_TIMER, "");
|
||||
|
||||
|
||||
/* We use function names for identification
|
||||
* however this might be a problem for the private
|
||||
@ -86,14 +88,14 @@ opal_timing_ts_func_t opal_timing_ts_func(opal_timer_type_t type);
|
||||
* conflict.
|
||||
* Use prefix to do a finer-grained identification if needed
|
||||
*/
|
||||
#define OPAL_TIMING_ENV_INIT_PREFIX(prefix, name) \
|
||||
do { \
|
||||
#define OPAL_TIMING_ENV_INIT_PREFIX(prefix, name) \
|
||||
do { \
|
||||
opal_timing_env_t name ## _val, *name = &(name ## _val); \
|
||||
*name = OPAL_TIMING_ENV_START_TYPE(__func__, OPAL_TIMING_AUTOMATIC_TIMER, prefix); \
|
||||
} while(0)
|
||||
|
||||
#define OPAL_TIMING_ENV_NEXT(h, ...) \
|
||||
do { \
|
||||
#define OPAL_TIMING_ENV_NEXT(h, ...) \
|
||||
do { \
|
||||
int n; \
|
||||
char buf1[OPAL_TIMING_STR_LEN], buf2[OPAL_TIMING_STR_LEN]; \
|
||||
double time; \
|
||||
@ -105,7 +107,7 @@ opal_timing_ts_func_t opal_timing_ts_func(opal_timer_type_t type);
|
||||
if ( n > OPAL_TIMING_STR_LEN ){ \
|
||||
h->error = 1; \
|
||||
} \
|
||||
n = snprintf(buf2, OPAL_TIMING_STR_LEN, __VA_ARGS__ ); \
|
||||
n = snprintf(buf2, OPAL_TIMING_STR_LEN, __VA_ARGS__ ); \
|
||||
if ( n > OPAL_TIMING_STR_LEN ){ \
|
||||
h->error = 1; \
|
||||
} \
|
||||
@ -154,37 +156,37 @@ opal_timing_ts_func_t opal_timing_ts_func(opal_timer_type_t type);
|
||||
* do the postprocessing, i.e. OMPI timing portion that will
|
||||
* do the reduction of accumulated values
|
||||
*/
|
||||
#define OPAL_TIMING_ENV_CNT_PREFIX(prefix, func, _cnt) \
|
||||
do { \
|
||||
#define OPAL_TIMING_ENV_CNT_PREFIX(prefix, func, _cnt) \
|
||||
do { \
|
||||
char ename[OPAL_TIMING_STR_LEN]; \
|
||||
char *ptr = NULL; \
|
||||
int n = snprintf(ename, OPAL_TIMING_STR_LEN, "OMPI_TIMING_%s%s_CNT", prefix, func); \
|
||||
(_cnt) = 0; \
|
||||
(_cnt) = 0; \
|
||||
if ( n <= OPAL_TIMING_STR_LEN ){ \
|
||||
ptr = getenv(ename); \
|
||||
if( NULL != ptr ){ (_cnt) = atoi(ptr); }; \
|
||||
if( NULL != ptr ){ (_cnt) = atoi(ptr); }; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define OPAL_TIMING_ENV_ERROR_PREFIX(prefix, func, _err) \
|
||||
do { \
|
||||
#define OPAL_TIMING_ENV_ERROR_PREFIX(prefix, func, _err) \
|
||||
do { \
|
||||
char ename[OPAL_TIMING_STR_LEN]; \
|
||||
(_err) = 0; \
|
||||
(_err) = 0; \
|
||||
char *ptr = NULL; \
|
||||
int n = snprintf(ename, OPAL_TIMING_STR_LEN, "OMPI_TIMING_%s%s_ERROR", prefix, func); \
|
||||
if ( n <= OPAL_TIMING_STR_LEN ){ \
|
||||
ptr = getenv(ename); \
|
||||
if( NULL != ptr ){ (_err) = atoi(ptr); }; \
|
||||
if( NULL != ptr ){ (_err) = atoi(ptr); }; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define OPAL_TIMING_ENV_CNT(func, _cnt) \
|
||||
#define OPAL_TIMING_ENV_CNT(func, _cnt) \
|
||||
OPAL_TIMING_ENV_CNT_PREFIX("", func, _cnt)
|
||||
|
||||
#define OPAL_TIMING_ENV_GETDESC_PREFIX(prefix, filename, func, i, desc, _t) \
|
||||
do { \
|
||||
#define OPAL_TIMING_ENV_GETDESC_PREFIX(prefix, filename, func, i, desc, _t) \
|
||||
do { \
|
||||
char vname[OPAL_TIMING_STR_LEN]; \
|
||||
(_t) = 0.0; \
|
||||
(_t) = 0.0; \
|
||||
sprintf(vname, "OMPI_TIMING_%s%s_FILE_%d", prefix, func, i); \
|
||||
*filename = getenv(vname); \
|
||||
sprintf(vname, "OMPI_TIMING_%s%s_DESC_%d", prefix, func, i); \
|
||||
@ -192,11 +194,11 @@ opal_timing_ts_func_t opal_timing_ts_func(opal_timer_type_t type);
|
||||
sprintf(vname, "OMPI_TIMING_%s%s_VAL_%d", prefix, func, i); \
|
||||
char *ptr = getenv(vname); \
|
||||
if ( NULL != ptr ) { \
|
||||
sscanf(ptr,"%lf", &(_t)); \
|
||||
sscanf(ptr,"%lf", &(_t)); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define OPAL_TIMING_ENV_GETDESC(file, func, index, desc) \
|
||||
#define OPAL_TIMING_ENV_GETDESC(file, func, index, desc) \
|
||||
OPAL_TIMING_ENV_GETDESC_PREFIX("", file, func, index, desc)
|
||||
|
||||
#else
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user