1
1

OSHMEM: refactoring to reuse common functions from different components.

This is preparation for moving verbs dependent code out from memheap/base component

Refs: #3763

This commit was SVN r30454.
Этот коммит содержится в:
Mike Dubman 2014-01-28 07:30:36 +00:00
родитель 0feddcd92b
Коммит 30e1e49a9e
15 изменённых файлов: 91 добавлений и 27 удалений

Просмотреть файл

@ -78,6 +78,7 @@ include request/Makefile.am
include runtime/Makefile.am
include shmem/Makefile.am
include tools/Makefile.am
include util/Makefile.am
# Ensure that the man page directory exists before we try to make man
# page files (because oshmem/shmem/man/man3 has no config.status-generated

Просмотреть файл

@ -122,7 +122,5 @@ enum {
#define MEMCHECKER(x)
#endif /* OMPI_WANT_MEMCHECKER */
void oshmem_output_verbose(int level, int output_id, const char* prefix, const char* file, int line, const char* function, const char* format, ...);
#endif /* OSHMEM_CONSTANTS_H */

Просмотреть файл

@ -15,6 +15,7 @@
#include "opal/mca/mca.h"
#include "oshmem/mca/atomic/atomic.h"
#include "oshmem/util/oshmem_util.h"
BEGIN_C_DECLS

Просмотреть файл

@ -15,6 +15,7 @@
#include "opal/mca/mca.h"
#include "oshmem/mca/atomic/atomic.h"
#include "oshmem/util/oshmem_util.h"
/* This component does uses SPML:IKRIT */
#include "oshmem/mca/spml/ikrit/spml_ikrit.h"

Просмотреть файл

@ -21,6 +21,7 @@
#include "oshmem/mca/memheap/memheap.h"
#include "oshmem/mca/memheap/base/base.h"
#include "oshmem/mca/spml/spml.h"
#include "oshmem/util/oshmem_util.h"
#include "opal/class/opal_hash_table.h"
#include "ompi/mca/btl/btl.h"
#include <string.h>

Просмотреть файл

@ -21,6 +21,7 @@
#include "oshmem/mca/memheap/memheap.h"
#include "oshmem/mca/memheap/base/base.h"
#include "oshmem/mca/spml/spml.h"
#include "oshmem/util/oshmem_util.h"
#include "opal/class/opal_hash_table.h"
#include "ompi/mca/btl/btl.h"
#include <string.h>

Просмотреть файл

@ -15,6 +15,7 @@
#include "opal/mca/mca.h"
#include "oshmem/mca/scoll/scoll.h"
#include "oshmem/util/oshmem_util.h"
BEGIN_C_DECLS

Просмотреть файл

@ -15,6 +15,7 @@
#include "shmem.h"
#include "opal/mca/mca.h"
#include "oshmem/mca/scoll/scoll.h"
#include "oshmem/util/oshmem_util.h"
#include "scoll_fca_api.h"
#include "scoll_fca_debug.h"

Просмотреть файл

@ -17,6 +17,7 @@
#include "oshmem_config.h"
#include "oshmem/request/request.h"
#include "oshmem/mca/spml/spml.h"
#include "oshmem/util/oshmem_util.h"
#include "oshmem/mca/spml/base/spml_base_putreq.h"
#include "oshmem/proc/proc.h"
#include "oshmem/mca/spml/base/spml_base_request.h"

Просмотреть файл

@ -17,6 +17,7 @@
#include "oshmem_config.h"
#include "oshmem/request/request.h"
#include "oshmem/mca/spml/spml.h"
#include "oshmem/util/oshmem_util.h"
#include "oshmem/mca/spml/base/spml_base_putreq.h"
#include "oshmem/proc/proc.h"
#include "oshmem/mca/spml/base/spml_base_request.h"

Просмотреть файл

@ -124,26 +124,3 @@ int oshmem_shmem_abort(int errcode)
return OSHMEM_SUCCESS;
}
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;
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_verbose(level, output_id, buff, file, line, function);
va_end(args);
free(buff);
free(str);
}

Просмотреть файл

@ -12,17 +12,20 @@
*/
#ifndef SHMEM_API_LOGGER_H
#define SHMEM_API_LOGGER_H
#include "oshmem_config.h"
#include "opal/util/output.h"
#include "oshmem/util/oshmem_util.h"
OSHMEM_DECLSPEC extern int shmem_api_logger_output;
#ifdef __BASE_FILE__
#define __SPML_FILE__ __BASE_FILE__
#else
#define __SPML_FILE__ __FILE__
#endif
void oshmem_output_verbose(int level, int output_id, const char* prefix, const char* file, int line, const char* function, const char* format, ...);
#ifdef OPAL_ENABLE_DEBUG
#define SHMEM_API_VERBOSE(level, ...) \
oshmem_output_verbose(level, shmem_api_logger_output, \

19
oshmem/util/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,19 @@
#
# Copyright (c) 2014 Mellanox Technologies, Inc.
# All rights reserved.
# # $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
#
# This makefile.am does not stand on its own - it is included from oshmem/Makefile.am
headers += \
util/oshmem_util.h
liboshmem_la_SOURCES += \
util/oshmem_util.c

42
oshmem/util/oshmem_util.c Обычный файл
Просмотреть файл

@ -0,0 +1,42 @@
/*
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "oshmem_config.h"
#include <stdarg.h>
#include <stdio.h>
#include "opal/util/output.h"
#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, ...)
{
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_verbose(level, output_id, buff, file, line, function);
va_end(args);
free(buff);
free(str);
}

16
oshmem/util/oshmem_util.h Обычный файл
Просмотреть файл

@ -0,0 +1,16 @@
/*
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OSHMEM_UTIL_H
#define 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, ...);
#endif /* OSHMEM_UTIL_H */