From 361f15d5d734d4488cdf7b50361db8b40a462557 Mon Sep 17 00:00:00 2001 From: Mike Dubman Date: Wed, 5 Mar 2014 08:49:14 +0000 Subject: [PATCH] OSHMEM: fix use of opal_verbose fixed by Roman, reviewed by Igor/Mike cmr=v1.7.5:reviewer=ompi-rm1.7 This commit was SVN r30943. --- oshmem/mca/atomic/base/base.h | 2 +- oshmem/mca/memheap/base/base.h | 2 +- oshmem/mca/scoll/base/base.h | 2 +- oshmem/mca/spml/base/base.h | 2 +- oshmem/mca/sshmem/base/base.h | 2 +- oshmem/util/oshmem_util.c | 30 ++++++++++++++++++++++++++++-- oshmem/util/oshmem_util.h | 10 +++++++++- 7 files changed, 42 insertions(+), 8 deletions(-) diff --git a/oshmem/mca/atomic/base/base.h b/oshmem/mca/atomic/base/base.h index 9657f88857..2b4c815a26 100644 --- a/oshmem/mca/atomic/base/base.h +++ b/oshmem/mca/atomic/base/base.h @@ -48,7 +48,7 @@ OSHMEM_DECLSPEC extern mca_base_framework_t oshmem_atomic_base_framework; #endif #define ATOMIC_ERROR(...) \ - oshmem_output_verbose(0, oshmem_atomic_base_framework.framework_output, \ + oshmem_output(oshmem_atomic_base_framework.framework_output, \ "Error %s:%d - %s()", __ATOMIC_FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) END_C_DECLS diff --git a/oshmem/mca/memheap/base/base.h b/oshmem/mca/memheap/base/base.h index 31a440d1a5..5df05460b4 100644 --- a/oshmem/mca/memheap/base/base.h +++ b/oshmem/mca/memheap/base/base.h @@ -139,7 +139,7 @@ OSHMEM_DECLSPEC extern mca_base_framework_t oshmem_memheap_base_framework; #endif #define MEMHEAP_ERROR(...) \ - oshmem_output_verbose(0, oshmem_memheap_base_framework.framework_output, \ + oshmem_output(oshmem_memheap_base_framework.framework_output, \ "Error %s:%d - %s()", __SPML_FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) #define MEMHEAP_WARN(...) \ diff --git a/oshmem/mca/scoll/base/base.h b/oshmem/mca/scoll/base/base.h index dffa645db0..05f6201887 100644 --- a/oshmem/mca/scoll/base/base.h +++ b/oshmem/mca/scoll/base/base.h @@ -60,7 +60,7 @@ OSHMEM_DECLSPEC extern mca_base_framework_t oshmem_scoll_base_framework; #endif #define SCOLL_ERROR(...) \ - oshmem_output_verbose(0, oshmem_scoll_base_framework.framework_output, \ + oshmem_output(oshmem_scoll_base_framework.framework_output, \ "Error %s:%d - %s()", __SCOLL_FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) END_C_DECLS diff --git a/oshmem/mca/spml/base/base.h b/oshmem/mca/spml/base/base.h index 700d3883ec..ca0d85c87b 100644 --- a/oshmem/mca/spml/base/base.h +++ b/oshmem/mca/spml/base/base.h @@ -89,7 +89,7 @@ OSHMEM_DECLSPEC extern mca_base_framework_t oshmem_spml_base_framework; #endif #define SPML_ERROR(...) \ - oshmem_output_verbose(0, oshmem_spml_base_framework.framework_output, \ + oshmem_output(oshmem_spml_base_framework.framework_output, \ "Error %s:%d - %s()", __SPML_FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) #define SPML_WARNING(...) \ diff --git a/oshmem/mca/sshmem/base/base.h b/oshmem/mca/sshmem/base/base.h index a7c1df768a..3683018281 100644 --- a/oshmem/mca/sshmem/base/base.h +++ b/oshmem/mca/sshmem/base/base.h @@ -137,7 +137,7 @@ OSHMEM_DECLSPEC extern mca_base_framework_t oshmem_sshmem_base_framework; #endif #define SSHMEM_ERROR(...) \ - oshmem_output_verbose(0, oshmem_sshmem_base_framework.framework_output, \ + oshmem_output(oshmem_sshmem_base_framework.framework_output, \ "Error %s:%d - %s()", __SSHMEM_FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) #define SSHMEM_WARN(...) \ diff --git a/oshmem/util/oshmem_util.c b/oshmem/util/oshmem_util.c index 7cbb9d1041..3e3c12949d 100644 --- a/oshmem/util/oshmem_util.c +++ b/oshmem/util/oshmem_util.c @@ -17,11 +17,12 @@ #include "oshmem/constants.h" #include "oshmem/util/oshmem_util.h" -void oshmem_output_verbose(int level, int output_id, const char* prefix, const char* file, int line, const char* function, const char* format, ...) +void oshmem_output_verbose(int level, int output_id, const char* prefix, + const char* file, int line, const char* function, const char* format, ...) { va_list args; char *buff, *str; - int ret = 0; + int ret; UNREFERENCED_PARAMETER(ret); @@ -40,3 +41,28 @@ void oshmem_output_verbose(int level, int output_id, const char* prefix, const c free(buff); free(str); } + +void oshmem_output(int output_id, const char* prefix, const char* file, + int line, const char* function, const char* format, ...) +{ + va_list args; + char *buff, *str; + int ret = 0; + + UNREFERENCED_PARAMETER(ret); + + va_start(args, format); + + ret = vasprintf(&str, format, args); + assert(-1 != ret); + + ret = asprintf(&buff, "%s %s", prefix, str); + assert(-1 != ret); + + opal_output(output_id, buff, file, line, function); + + va_end(args); + + free(buff); + free(str); +} diff --git a/oshmem/util/oshmem_util.h b/oshmem/util/oshmem_util.h index 52e3f375db..671dacea79 100644 --- a/oshmem/util/oshmem_util.h +++ b/oshmem/util/oshmem_util.h @@ -13,6 +13,14 @@ #include "oshmem_config.h" -void oshmem_output_verbose(int level, int output_id, const char* prefix, const char* file, int line, const char* function, const char* format, ...); +void oshmem_output_verbose(int level, int output_id, const char* prefix, + const char* file, int line, const char* function, const char* format, ...); + +/* + * Temporary wrapper which ingores output verbosity level + * to ensure error messages are seeing by user + */ +void oshmem_output(int output_id, const char* prefix, const char* file, + int line, const char* function, const char* format, ...); #endif /* OSHMEM_UTIL_H */