diff --git a/ompi/peruse/peruse-internal.h b/ompi/peruse/peruse-internal.h index 187a38265a..0aea9a2c0a 100644 --- a/ompi/peruse/peruse-internal.h +++ b/ompi/peruse/peruse-internal.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * $COPYRIGHT$ * @@ -19,13 +19,10 @@ #include "ompi/file/file.h" #include "ompi/win/win.h" -#if defined(c_plusplus) || defined(__cplusplus) -extern "C" { -#endif - +BEGIN_C_DECLS typedef int (ompi_peruse_callback_f)(peruse_event_h event_h, - MPI_Aint unique_id, void * spec, void * param); + MPI_Aint unique_id, void * spec, void * param); OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_peruse_t); @@ -35,7 +32,7 @@ struct ompi_peruse_handle_t { int active; /**< Whether this handle has been activated */ int event; /**< Event being watched */ int type; /**< Object-type this event is registered on */ - ompi_communicator_t* comm; /**< Corresponding communicicator */ + ompi_communicator_t* comm; /**< Corresponding communicator */ ompi_file_t* file; /**< Corresponding file */ ompi_win_t* win; /**< Corresponding window, in case we have support */ ompi_peruse_callback_f* fn; /**< Callback function specified by user */ @@ -120,14 +117,13 @@ do { } while(0) #else + #define PERUSE_TRACE_COMM_EVENT(event, base_req, op) #define PERUSE_TRACE_COMM_OMPI_EVENT(event, base_req, size, op) #define PERUSE_TRACE_MSG_EVENT(event, comm_ptr, hdr_peer, hdr_tag, op) + #endif - -#if defined(c_plusplus) || defined(__cplusplus) -} -#endif +END_C_DECLS #endif /* _PERUSE_INTERNAL_H_ */ diff --git a/ompi/peruse/peruse.c b/ompi/peruse/peruse.c index 10db3af081..886838694d 100644 --- a/ompi/peruse/peruse.c +++ b/ompi/peruse/peruse.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart, + * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * $COPYRIGHT$ * @@ -12,10 +12,10 @@ */ #include "ompi_config.h" -#include "mpi.h" #ifdef HAVE_STRING_H # include #endif +#include "mpi.h" #include "ompi/peruse/peruse.h" #include "ompi/peruse/peruse-internal.h" #include "opal/class/opal_hash_table.h" @@ -64,7 +64,7 @@ const int PERUSE_num_events = (sizeof(PERUSE_events) / sizeof(peruse_event_assoc /* * PERUSE user-callable function */ -int PERUSE_Init (void) +OMPI_DECLSPEC int PERUSE_Init (void) { if (MPI_PARAM_CHECK) { if (!ompi_mpi_initialized || ompi_mpi_finalized) @@ -76,9 +76,9 @@ int PERUSE_Init (void) /* Query all implemented events */ -int PERUSE_Query_supported_events( int* num_supported, - char*** event_names, - int** events ) +OMPI_DECLSPEC int PERUSE_Query_supported_events( int* num_supported, + char*** event_names, + int** events ) { int i; *num_supported = PERUSE_num_events; @@ -96,7 +96,7 @@ int PERUSE_Query_supported_events( int* num_supported, /* Query supported events */ -int PERUSE_Query_event (const char* event_name, int* event) +OMPI_DECLSPEC int PERUSE_Query_event (const char* event_name, int* event) { int i; @@ -111,7 +111,7 @@ int PERUSE_Query_event (const char* event_name, int* event) /* Query event name */ -int PERUSE_Query_event_name (int event, char** event_name) +OMPI_DECLSPEC int PERUSE_Query_event_name (int event, char** event_name) { if (event < 0 || event > PERUSE_num_events || NULL == PERUSE_events[event].name) @@ -123,14 +123,14 @@ int PERUSE_Query_event_name (int event, char** event_name) /* Get environment variables that affect MPI library behavior */ -int PERUSE_Query_environment( int * env_size, char *** env ) +OMPI_DECLSPEC int PERUSE_Query_environment( int * env_size, char *** env ) { /* XXX tbd */ return PERUSE_SUCCESS; } /* Query the scope of queue metrics - global or per communicator */ -int PERUSE_Query_queue_event_scope (int * scope) +OMPI_DECLSPEC int PERUSE_Query_queue_event_scope (int * scope) { *scope = PERUSE_PER_COMM; @@ -142,11 +142,11 @@ int PERUSE_Query_queue_event_scope (int * scope) * II. Events, objects initialization and manipulation */ /* Initialize event associated with an MPI communicator */ -int PERUSE_Event_comm_register( int event, - MPI_Comm comm, - peruse_comm_callback_f * callback_fn, - void * param, - peruse_event_h * event_h ) +OMPI_DECLSPEC int PERUSE_Event_comm_register( int event, + MPI_Comm comm, + peruse_comm_callback_f * callback_fn, + void * param, + peruse_event_h * event_h ) { ompi_peruse_handle_t * handle; if (MPI_PARAM_CHECK) { @@ -192,7 +192,7 @@ int PERUSE_Event_comm_register( int event, /* Start collecting data (activate event) */ -int PERUSE_Event_activate (peruse_event_h event_h) +OMPI_DECLSPEC int PERUSE_Event_activate (peruse_event_h event_h) { ompi_peruse_handle_t* handle = (ompi_peruse_handle_t*)event_h; @@ -209,7 +209,7 @@ int PERUSE_Event_activate (peruse_event_h event_h) /* Stop collecting data (deactivate event) */ -int PERUSE_Event_deactivate (peruse_event_h event_h) +OMPI_DECLSPEC int PERUSE_Event_deactivate (peruse_event_h event_h) { ompi_peruse_handle_t* handle = (ompi_peruse_handle_t*)event_h; @@ -226,7 +226,7 @@ int PERUSE_Event_deactivate (peruse_event_h event_h) /* Free event handle */ -int PERUSE_Event_release (peruse_event_h * event_h) +OMPI_DECLSPEC int PERUSE_Event_release (peruse_event_h * event_h) { if (MPI_PARAM_CHECK) { if (PERUSE_EVENT_HANDLE_NULL == event_h) @@ -258,9 +258,9 @@ int PERUSE_Event_release (peruse_event_h * event_h) } \ /* Set a new comm callback */ -int PERUSE_Event_comm_callback_set( peruse_event_h event_h, - peruse_comm_callback_f* callback_fn, - void* param ) +OMPI_DECLSPEC int PERUSE_Event_comm_callback_set( peruse_event_h event_h, + peruse_comm_callback_f* callback_fn, + void* param ) { ompi_peruse_handle_t* handle = (ompi_peruse_handle_t*)event_h; @@ -275,9 +275,9 @@ int PERUSE_Event_comm_callback_set( peruse_event_h event_h, } /* Get the current comm callback */ -int PERUSE_Event_comm_callback_get( peruse_event_h event_h, - peruse_comm_callback_f** callback_fn, - void** param ) +OMPI_DECLSPEC int PERUSE_Event_comm_callback_get( peruse_event_h event_h, + peruse_comm_callback_f** callback_fn, + void** param ) { ompi_peruse_handle_t* handle = (ompi_peruse_handle_t*)event_h; @@ -292,7 +292,7 @@ int PERUSE_Event_comm_callback_get( peruse_event_h event_h, } /* Obtain event descriptor from an event handle (reverse lookup) */ -int PERUSE_Event_get( peruse_event_h event_h, int* event ) +OMPI_DECLSPEC int PERUSE_Event_get( peruse_event_h event_h, int* event ) { if (MPI_PARAM_CHECK) { if (NULL == event_h) @@ -308,7 +308,7 @@ int PERUSE_Event_get( peruse_event_h event_h, int* event ) /* Obtain MPI object associated with event handle */ -int PERUSE_Event_object_get( peruse_event_h event_h, void** mpi_object ) +OMPI_DECLSPEC int PERUSE_Event_object_get( peruse_event_h event_h, void** mpi_object ) { ompi_peruse_handle_t* p = (ompi_peruse_handle_t*)event_h; @@ -329,7 +329,7 @@ int PERUSE_Event_object_get( peruse_event_h event_h, void** mpi_object ) /* Propagaiont mode */ -int PERUSE_Event_propagate (peruse_event_h event_h, int mode) +OMPI_DECLSPEC int PERUSE_Event_propagate (peruse_event_h event_h, int mode) { return PERUSE_SUCCESS; } diff --git a/ompi/peruse/peruse.h b/ompi/peruse/peruse.h index 1125706fff..2a391157e5 100644 --- a/ompi/peruse/peruse.h +++ b/ompi/peruse/peruse.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2007 Los Alamos National Security, LLC. All rights * reserved. @@ -151,7 +151,7 @@ int PERUSE_Event_get( peruse_event_h event_h, int* event ); /* Obtain MPI object associated with event handle */ int PERUSE_Event_object_get( peruse_event_h event_h, void** mpi_object ); -/* Propagaiont mode */ +/* Propagation mode */ int PERUSE_Event_propagate( peruse_event_h event_h, int mode ); #endif diff --git a/ompi/peruse/peruse_module.c b/ompi/peruse/peruse_module.c index df73eddb9c..92135948fb 100644 --- a/ompi/peruse/peruse_module.c +++ b/ompi/peruse/peruse_module.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * $COPYRIGHT$ * @@ -13,7 +13,9 @@ */ #include "ompi_config.h" -#include +#ifdef HAVE_STDLIB_H +# include +#endif #include "mpi.h" #include "ompi/peruse/peruse.h" #include "ompi/peruse/peruse-internal.h" @@ -30,8 +32,8 @@ static void ompi_peruse_handle_construct (ompi_peruse_handle_t* p) p->event = PERUSE_EVENT_INVALID; p->type = PERUSE_TYPE_INVALID; p->comm = MPI_COMM_NULL; - /* p->win = MPI_WIN_NULL; */ /* p->file = MPI_FILE_NULL */ + /* p->win = MPI_WIN_NULL; */ p->fn = NULL; p->param = NULL; @@ -76,3 +78,4 @@ int ompi_peruse_finalize (void) return OMPI_SUCCESS; } +