Modified the output system to comply with a wider range of compilers.
Jelena: this should solve the issue you faced today. This commit was SVN r15668.
Этот коммит содержится в:
родитель
9e49b5272f
Коммит
17e10ff918
@ -27,9 +27,11 @@ endif
|
||||
SUBDIRS = $(MCA_pml_v_PROTOCOLS)
|
||||
|
||||
local_sources = \
|
||||
pml_v.c \
|
||||
pml_v.h \
|
||||
pml_v_component.c \
|
||||
pml_v.c \
|
||||
pml_v.h \
|
||||
pml_v_component.c \
|
||||
pml_v_output.h \
|
||||
pml_v_output.c \
|
||||
pml_v_protocol.h \
|
||||
pml_v_protocol_base.h \
|
||||
pml_v_protocol_base.c
|
||||
@ -38,12 +40,12 @@ mcacomponentdir = $(libdir)/openmpi
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_pml_v_la_SOURCES = $(local_sources)
|
||||
mca_pml_v_la_LIBADD =
|
||||
mca_pml_v_la_CFLAGS = -Wno-variadic-macros
|
||||
mca_pml_v_la_CFLAGS =
|
||||
mca_pml_v_la_LDFLAGS = -module -avoid-version
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_pml_v_la_SOURCES = $(local_sources)
|
||||
libmca_pml_v_la_LIBADD =
|
||||
libmca_pml_v_la_CFLAGS = -Wno-variadic-macros
|
||||
libmca_pml_v_la_CFLAGS =
|
||||
libmca_pml_v_la_LDFLAGS = -module -avoid-version
|
||||
|
||||
|
@ -13,21 +13,13 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "ompi/mca/pml/pml.h"
|
||||
|
||||
#include "pml_v_protocol.h"
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* TODO: Fix that crappy variadic stuff for non GNU C compilers */
|
||||
#ifdef __GNUC__
|
||||
# define V_OUTPUT(...) OPAL_OUTPUT((mca_pml_v.output, __VA_ARGS__))
|
||||
# define V_OUTPUT_VERBOSE(V, ...) OPAL_OUTPUT_VERBOSE((V, mca_pml_v.output, __VA_ARGS__))
|
||||
#else
|
||||
static inline void V_OUTPUT(char *format, ...) { OPAL_OUTPUT((mca_pml_v.output, "%s", format)); }
|
||||
static inline void V_OUTPUT_VERBOSE(int V, char * format, ...) {OPAL_OUTPUT_VERBOSE((V, mca_pml_v.output, "%s", format)); }
|
||||
#endif
|
||||
|
||||
struct mca_pml_v_t {
|
||||
int output;
|
||||
mca_pml_v_protocol_base_component_t protocol_component;
|
||||
@ -45,4 +37,6 @@ OMPI_DECLSPEC extern mca_pml_v_t mca_pml_v;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "pml_v_output.h"
|
||||
|
||||
#endif /* PML_V_H_HAS_BEEN_INCLUDED */
|
||||
|
@ -24,14 +24,11 @@
|
||||
#include "pml_v.h"
|
||||
#include "pml_v_protocol_base.h"
|
||||
|
||||
#include "ompi/mca/pml/ob1/pml_ob1.h"
|
||||
|
||||
static int mca_pml_v_component_open(void);
|
||||
static int mca_pml_v_component_close(void);
|
||||
static int mca_pml_v_component_parasite_close(void);
|
||||
|
||||
|
||||
static mca_pml_base_module_t *mca_pml_v_component_init(int* priority, bool, bool);
|
||||
static mca_pml_base_module_t *mca_pml_v_component_init(int* priority, bool enable_threads, bool enable_progress_threads);
|
||||
static int mca_pml_v_component_finalize(void);
|
||||
static int mca_pml_v_component_parasite_finalize(void);
|
||||
|
||||
@ -64,60 +61,38 @@ mca_pml_base_component_1_0_0_t mca_pml_v_component =
|
||||
/******************************************************************************/
|
||||
/* MCA level functions */
|
||||
|
||||
/* Gather some informations about the environment and selects the best protocol
|
||||
* considering environment and priority */
|
||||
/* Register MCA parameters and setup verbose output system
|
||||
*/
|
||||
static int mca_pml_v_component_open(void)
|
||||
{
|
||||
char *output;
|
||||
int verbose;
|
||||
opal_output_stream_t lds;
|
||||
char hostname[32] = "NA";
|
||||
char *output;
|
||||
int verbose;
|
||||
|
||||
output = mca_pml_v_param_register_string("output", "stderr");
|
||||
verbose = mca_pml_v_param_register_int("verbose", 0);
|
||||
output = mca_pml_v_param_register_string("output", "stderr");
|
||||
verbose = mca_pml_v_param_register_int("verbose", 0);
|
||||
|
||||
OBJ_CONSTRUCT(&lds, opal_output_stream_t);
|
||||
if(!output)
|
||||
{
|
||||
mca_pml_v.output = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!strcmp(output, "stdout"))
|
||||
{
|
||||
lds.lds_want_stdout = true;
|
||||
}
|
||||
else if(!strcmp(output, "stderr"))
|
||||
{
|
||||
lds.lds_want_stderr = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
lds.lds_want_file = true;
|
||||
lds.lds_file_suffix = output;
|
||||
}
|
||||
lds.lds_is_debugging = true;
|
||||
gethostname(hostname, 32);
|
||||
asprintf(&lds.lds_prefix, "[%s:%05d] pml_v: ", hostname, getpid());
|
||||
lds.lds_verbose_level = verbose;
|
||||
mca_pml_v.output = opal_output_open(&lds);
|
||||
free(lds.lds_prefix);
|
||||
}
|
||||
V_OUTPUT_VERBOSE(10, "pml_v.open: opening pml_v");
|
||||
return mca_pml_v_protocol_base_load_all();
|
||||
pml_v_output_init(output, verbose);
|
||||
|
||||
V_OUTPUT_VERBOSE(1, "loading pml_v");
|
||||
return mca_pml_v_protocol_base_load_all();
|
||||
}
|
||||
|
||||
/*
|
||||
* As any parasit, I dont want to die, so I will grab the mca_pml interface and put mine instead.
|
||||
* Once this is done, I will do my stuff and call the real func and die only when my host pml
|
||||
/* As any parasit, I dont want to die, so I will grab the mca_pml interface
|
||||
* and put those from the selected vprotocol instead. Once this is done,
|
||||
* I will do my stuff and call the real func and die only when my host pml
|
||||
* will.
|
||||
*/
|
||||
static int mca_pml_v_component_close(void)
|
||||
{
|
||||
/* choose one protocol (ignoring errors as we will be discarded soon if some occured) */
|
||||
/* choose one protocol (ignoring errors as we will be discarded soon if
|
||||
some occured) */
|
||||
/* TODO: dirty trick until pml_base_select gets fixed - have to be moved back to finalize */
|
||||
/* TODO: check for bozo case: no selected PML */
|
||||
/* mca_pml_v_protocol_base_select(enable_progress_threads, enable_mpi_threads); */
|
||||
|
||||
|
||||
/* Gather some informations about the environment and selects the best protocol
|
||||
* considering environment and priority */
|
||||
mca_pml_v_protocol_base_select(0, 0);
|
||||
|
||||
if(!strcmp(mca_pml_v.protocol_component.pmlm_version.mca_type_name, "vprotocol"))
|
||||
|
45
ompi/mca/pml/v/pml_v_output.c
Обычный файл
45
ompi/mca/pml/v/pml_v_output.c
Обычный файл
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 The Trustees of the University of Tennessee.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "pml_v_output.h"
|
||||
|
||||
int pml_v_output_init(char *output, int verbosity) {
|
||||
opal_output_stream_t lds;
|
||||
char hostname[32] = "NA";
|
||||
|
||||
OBJ_CONSTRUCT(&lds, opal_output_stream_t);
|
||||
if(!output) {
|
||||
mca_pml_v.output = 0;
|
||||
}
|
||||
else {
|
||||
if(!strcmp(output, "stdout")) {
|
||||
lds.lds_want_stdout = true;
|
||||
}
|
||||
else if(!strcmp(output, "stderr")) {
|
||||
lds.lds_want_stderr = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
lds.lds_want_file = true;
|
||||
lds.lds_file_suffix = output;
|
||||
}
|
||||
lds.lds_is_debugging = true;
|
||||
gethostname(hostname, 32);
|
||||
asprintf(&lds.lds_prefix, "[%s:%05d] pml_v: ", hostname, getpid());
|
||||
lds.lds_verbose_level = verbosity;
|
||||
mca_pml_v.output = opal_output_open(&lds);
|
||||
free(lds.lds_prefix);
|
||||
}
|
||||
return mca_pml_v.output;
|
||||
}
|
||||
|
||||
void pml_v_output_finalize(void) {
|
||||
opal_output_close(mca_pml_v.output);
|
||||
}
|
77
ompi/mca/pml/v/pml_v_output.h
Обычный файл
77
ompi/mca/pml/v/pml_v_output.h
Обычный файл
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 The Trustees of the University of Tennessee.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef PML_V_OUTPUT_H_HAS_BEEN_INCLUDED
|
||||
#define PML_V_OUTPUT_H_HAS_BEEN_INCLUDED
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "pml_v.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int pml_v_output_init(char *output, int verbosity);
|
||||
void pml_v_output_finalize(void);
|
||||
|
||||
/* Tricky stuff to define V_OUTPUT and V_OUTPUT_VERBOSE with variadic arguments
|
||||
*/
|
||||
#if defined(ACCEPT_C99)
|
||||
# define V_OUTPUT(ARGS...) OPAL_OUTPUT((mca_pml_v.output, __VA_ARGS__))
|
||||
# define V_OUTPUT_VERBOSE(V, ARGS...) OPAL_OUTPUT_VERBOSE((V, mca_pml_v.output, __VA_ARGS__))
|
||||
#elif defined(__GNUC__) && !defined(__STDC__)
|
||||
# define V_OUTPUT(ARGS...) OPAL_OUTPUT((mca_pml_v.output, ARGS))
|
||||
# define V_OUTPUT_VERBOSE(V, ARGS...) OPAL_OUTPUT_VERBOSE((V, mca_pml_v.output, ARGS))
|
||||
#else
|
||||
# if defined(OMPI_ENABLE_DEBUG)
|
||||
static inline void V_OUTPUT(char* fmt, ... ) {
|
||||
va_list list;
|
||||
|
||||
va_start(list, fmt);
|
||||
opal_output(mca_pml_v.output, fmt, list );
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
static inline void V_OUTPUT_VERBOSE(int V, char* fmt, ... ) {
|
||||
va_list list;
|
||||
|
||||
va_start(list, fmt);
|
||||
opal_output_verbose(mca_pml_v.output, V, fmt, list);
|
||||
va_end(list);
|
||||
}
|
||||
# else /* !defined(DEBUG) */
|
||||
/* Some compilers complain if we have ... and no
|
||||
corresponding va_start() */
|
||||
static inline void V_OUTPUT(char* fmt, ... ) {
|
||||
#if defined(__PGI)
|
||||
va_list list;
|
||||
|
||||
va_start(list, fmt);
|
||||
va_end(list);
|
||||
#endif
|
||||
}
|
||||
static inline void V_OUTPUT_VERBOSE(int V, char* fmt, ... ) {
|
||||
#if defined(__PGI)
|
||||
va_list list;
|
||||
|
||||
va_start(list, fmt);
|
||||
va_end(list);
|
||||
#endif
|
||||
}
|
||||
# endif /* defined(DEBUG) */
|
||||
#endif
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PML_V_OUTPUT_H_HAS_BEEN_INCLUDED */
|
@ -41,11 +41,11 @@ mcacomponentdir = $(libdir)/openmpi
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_vprotocol_example_la_SOURCES = $(local_sources)
|
||||
mca_vprotocol_example_la_LIBADD =
|
||||
mca_vprotocol_example_la_CFLAGS = -Wno-variadic-macros
|
||||
mca_vprotocol_example_la_CFLAGS =
|
||||
mca_vprotocol_example_la_LDFLAGS = -module -avoid-version
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_vprotocol_example_la_SOURCES = $(local_sources)
|
||||
libmca_vprotocol_example_la_LIBADD =
|
||||
libmca_vprotocol_example_la_CFLAGS = -Wno-variadic-macros
|
||||
libmca_vprotocol_example_la_CFLAGS =
|
||||
libmca_vprotocol_example_la_LDFLAGS = -module -avoid-version
|
||||
|
@ -50,11 +50,11 @@ mcacomponentdir = $(libdir)/openmpi
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_vprotocol_pessimist_la_SOURCES = $(local_sources)
|
||||
mca_vprotocol_pessimist_la_LIBADD =
|
||||
mca_vprotocol_pessimist_la_CFLAGS = -Wno-variadic-macros
|
||||
mca_vprotocol_pessimist_la_CFLAGS =
|
||||
mca_vprotocol_pessimist_la_LDFLAGS = -module -avoid-version
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_vprotocol_pessimist_la_SOURCES = $(local_sources)
|
||||
libmca_vprotocol_pessimist_la_LIBADD =
|
||||
libmca_vprotocol_pessimist_la_CFLAGS = -Wno-variadic-macros
|
||||
libmca_vprotocol_pessimist_la_CFLAGS =
|
||||
libmca_vprotocol_pessimist_la_LDFLAGS = -module -avoid-version
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "ompi/mca/pml/base/pml_base_request.h"
|
||||
|
||||
typedef uint64_t vprotocol_pessimist_clock_t;
|
||||
#define PRIpclock PRIx64
|
||||
|
||||
typedef enum {
|
||||
VPROTOCOL_PESSIMIST_EVENT_TYPE_MATCHING,
|
||||
|
@ -22,16 +22,17 @@ int mca_vprotocol_pessimist_isend(void *buf,
|
||||
ompi_communicator_t* comm,
|
||||
ompi_request_t** request )
|
||||
{
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
V_OUTPUT_VERBOSE(50, "pessimist:\tisend\tposted\t%x\tto %d\ttag %d\tsize %ld",
|
||||
mca_vprotocol_pessimist.clock, dst, tag, (long) count);
|
||||
V_OUTPUT_VERBOSE(50, "pessimist:\tisend\tposted\t%llx\tto %d\ttag %d\tsize %ld",
|
||||
(long long) mca_vprotocol_pessimist.clock, dst, tag, (long) count);
|
||||
|
||||
VPROTOCOL_PESSIMIST_EVENT_FLUSH();
|
||||
ret = mca_pml_v.host_pml.pml_isend(buf, count, datatype, dst, tag, sendmode, comm, request);
|
||||
VPESSIMIST_REQ_INIT(*request);
|
||||
VPROTOCOL_PESSIMIST_SENDER_BASED_COPY(*request);
|
||||
return ret;
|
||||
VPROTOCOL_PESSIMIST_EVENT_FLUSH();
|
||||
ret = mca_pml_v.host_pml.pml_isend(buf, count, datatype, dst, tag, sendmode,
|
||||
comm, request);
|
||||
VPESSIMIST_REQ_INIT(*request);
|
||||
VPROTOCOL_PESSIMIST_SENDER_BASED_COPY(*request);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int mca_vprotocol_pessimist_send(void *buf,
|
||||
@ -42,16 +43,17 @@ int mca_vprotocol_pessimist_send(void *buf,
|
||||
mca_pml_base_send_mode_t sendmode,
|
||||
ompi_communicator_t* comm )
|
||||
{
|
||||
ompi_request_t *request = MPI_REQUEST_NULL;
|
||||
int rc;
|
||||
ompi_request_t *request = MPI_REQUEST_NULL;
|
||||
int rc;
|
||||
|
||||
V_OUTPUT_VERBOSE(110, "pessimist:\tsend\tposted\t%x\tto %d\ttag %d\tsize %ld",
|
||||
mca_vprotocol_pessimist.clock, dst, tag, (long) count);
|
||||
V_OUTPUT_VERBOSE(110, "pessimist:\tsend\tposted\t%"PRIx64"\tto %d\ttag %d\tsize %z",
|
||||
mca_vprotocol_pessimist.clock, dst, tag, count);
|
||||
|
||||
VPROTOCOL_PESSIMIST_EVENT_FLUSH();
|
||||
mca_pml_v.host_pml.pml_isend(buf, count, datatype, dst, tag, sendmode, comm, &request);
|
||||
VPESSIMIST_REQ_INIT(request);
|
||||
VPROTOCOL_PESSIMIST_SENDER_BASED_COPY(request);
|
||||
VPROTOCOL_PESSIMIST_WAIT(&request, MPI_STATUS_IGNORE, rc);
|
||||
return rc;
|
||||
VPROTOCOL_PESSIMIST_EVENT_FLUSH();
|
||||
mca_pml_v.host_pml.pml_isend(buf, count, datatype, dst, tag, sendmode,
|
||||
comm, &request);
|
||||
VPESSIMIST_REQ_INIT(request);
|
||||
VPROTOCOL_PESSIMIST_SENDER_BASED_COPY(request);
|
||||
VPROTOCOL_PESSIMIST_WAIT(&request, MPI_STATUS_IGNORE, rc);
|
||||
return rc;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user