2006-03-23 08:00:55 +03:00
|
|
|
/*
|
2006-04-07 10:03:32 +04:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2006-03-23 08:00:55 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2015-06-24 06:59:57 +03:00
|
|
|
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
2006-03-23 08:00:55 +03:00
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
2015-06-24 06:59:57 +03:00
|
|
|
*
|
2006-03-23 08:00:55 +03:00
|
|
|
* Additional copyrights may follow
|
2015-06-24 06:59:57 +03:00
|
|
|
*
|
2006-03-23 08:00:55 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
#ifndef _PERUSE_INTERNAL_H_
|
|
|
|
#define _PERUSE_INTERNAL_H_
|
|
|
|
|
2009-03-04 18:35:54 +03:00
|
|
|
#include "ompi_config.h"
|
2006-03-23 08:00:55 +03:00
|
|
|
#include "ompi/peruse/peruse.h"
|
|
|
|
#include "opal/class/opal_list.h"
|
|
|
|
#include "ompi/communicator/communicator.h"
|
|
|
|
#include "ompi/file/file.h"
|
|
|
|
#include "ompi/win/win.h"
|
|
|
|
|
2008-09-05 11:47:54 +04:00
|
|
|
BEGIN_C_DECLS
|
2006-03-23 08:00:55 +03:00
|
|
|
|
|
|
|
typedef int (ompi_peruse_callback_f)(peruse_event_h event_h,
|
2008-09-05 11:47:54 +04:00
|
|
|
MPI_Aint unique_id, void * spec, void * param);
|
2006-03-23 08:00:55 +03:00
|
|
|
|
|
|
|
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_peruse_t);
|
|
|
|
|
|
|
|
struct ompi_peruse_handle_t {
|
|
|
|
opal_list_item_t super; /**< Allow handle to be placed on a list */
|
|
|
|
opal_mutex_t lock; /**< Lock protecting the entry XXX needed?*/
|
|
|
|
int active; /**< Whether this handle has been activated */
|
|
|
|
int event; /**< Event being watched */
|
|
|
|
int type; /**< Object-type this event is registered on */
|
2008-09-05 11:47:54 +04:00
|
|
|
ompi_communicator_t* comm; /**< Corresponding communicator */
|
2006-03-23 08:00:55 +03:00
|
|
|
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 */
|
|
|
|
void * param; /**< Parameters being passed to callback */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct ompi_peruse_handle_t ompi_peruse_handle_t;
|
2006-08-24 20:38:08 +04:00
|
|
|
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_peruse_handle_t);
|
2006-03-23 08:00:55 +03:00
|
|
|
|
|
|
|
enum {
|
|
|
|
PERUSE_TYPE_INVALID=-1,
|
|
|
|
PERUSE_TYPE_COMM,
|
|
|
|
PERUSE_TYPE_FILE,
|
|
|
|
PERUSE_TYPE_WIN
|
|
|
|
};
|
|
|
|
|
2010-01-12 19:36:24 +03:00
|
|
|
extern int ompi_peruse_initialized;
|
|
|
|
extern int ompi_peruse_finalized;
|
|
|
|
|
|
|
|
#define OMPI_ERR_PERUSE_INIT_FINALIZE \
|
|
|
|
if( OPAL_UNLIKELY(!ompi_peruse_initialized || ompi_peruse_finalized) ) { \
|
|
|
|
return PERUSE_ERR_INIT; \
|
|
|
|
}
|
2006-03-23 08:00:55 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Module internal function declarations
|
|
|
|
*/
|
|
|
|
int ompi_peruse_init (void);
|
|
|
|
int ompi_peruse_finalize (void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Global macros
|
|
|
|
*/
|
|
|
|
|
2006-03-31 20:34:23 +04:00
|
|
|
#if OMPI_WANT_PERUSE
|
2006-03-23 08:00:55 +03:00
|
|
|
#define PERUSE_TRACE_COMM_EVENT(event, base_req, op) \
|
|
|
|
do { \
|
|
|
|
if( NULL != (base_req)->req_comm->c_peruse_handles ) { \
|
|
|
|
ompi_peruse_handle_t * _ptr = (base_req)->req_comm->c_peruse_handles[(event)]; \
|
|
|
|
if (NULL != _ptr && _ptr->active) { \
|
|
|
|
peruse_comm_spec_t _comm_spec; \
|
|
|
|
_comm_spec.comm = (base_req)->req_comm; \
|
|
|
|
_comm_spec.buf = (base_req)->req_addr; \
|
|
|
|
_comm_spec.count = (base_req)->req_count; \
|
|
|
|
_comm_spec.datatype = (base_req)->req_datatype; \
|
|
|
|
_comm_spec.peer = (base_req)->req_peer; \
|
|
|
|
_comm_spec.tag = (base_req)->req_tag; \
|
|
|
|
_comm_spec.operation = (op); \
|
|
|
|
_ptr->fn(_ptr, (MPI_Aint)(base_req), &_comm_spec, _ptr->param); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} while(0)
|
|
|
|
|
2006-06-27 00:08:33 +04:00
|
|
|
#define PERUSE_TRACE_COMM_OMPI_EVENT(event, base_req, size, op) \
|
|
|
|
do { \
|
|
|
|
if( NULL != (base_req)->req_comm->c_peruse_handles ) { \
|
|
|
|
ompi_peruse_handle_t * _ptr = (base_req)->req_comm->c_peruse_handles[(event)]; \
|
|
|
|
if (NULL != _ptr && _ptr->active) { \
|
|
|
|
peruse_comm_spec_t _comm_spec; \
|
|
|
|
_comm_spec.comm = (base_req)->req_comm; \
|
|
|
|
_comm_spec.buf = (base_req)->req_addr; \
|
|
|
|
_comm_spec.count = size; \
|
|
|
|
_comm_spec.datatype = MPI_PACKED; \
|
|
|
|
_comm_spec.peer = (base_req)->req_peer; \
|
|
|
|
_comm_spec.tag = (base_req)->req_tag; \
|
|
|
|
_comm_spec.operation = (op); \
|
|
|
|
_ptr->fn(_ptr, (MPI_Aint)(base_req), &_comm_spec, _ptr->param); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} while(0)
|
|
|
|
|
2006-03-31 20:34:23 +04:00
|
|
|
#define PERUSE_TRACE_MSG_EVENT(event, comm_ptr, hdr_peer, hdr_tag, op) \
|
|
|
|
do { \
|
|
|
|
if( NULL != (comm_ptr)->c_peruse_handles ) { \
|
|
|
|
ompi_peruse_handle_t * _ptr = (comm_ptr)->c_peruse_handles[(event)]; \
|
|
|
|
if (NULL != _ptr && _ptr->active) { \
|
|
|
|
peruse_comm_spec_t _comm_spec; \
|
|
|
|
_comm_spec.comm = (ompi_communicator_t*) (comm_ptr); \
|
|
|
|
_comm_spec.buf = NULL; \
|
|
|
|
_comm_spec.count = 0; \
|
|
|
|
_comm_spec.datatype = MPI_DATATYPE_NULL; \
|
|
|
|
_comm_spec.peer = (hdr_peer); \
|
|
|
|
_comm_spec.tag = (hdr_tag); \
|
|
|
|
_comm_spec.operation = (op); \
|
|
|
|
_ptr->fn (_ptr, (MPI_Aint)/*(unique_id)*/0, &_comm_spec, _ptr->param); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} while(0)
|
2006-03-23 08:00:55 +03:00
|
|
|
|
|
|
|
#else
|
2008-09-05 11:47:54 +04:00
|
|
|
|
2006-03-23 08:00:55 +03:00
|
|
|
#define PERUSE_TRACE_COMM_EVENT(event, base_req, op)
|
2006-06-27 00:08:33 +04:00
|
|
|
#define PERUSE_TRACE_COMM_OMPI_EVENT(event, base_req, size, op)
|
2006-03-23 08:00:55 +03:00
|
|
|
#define PERUSE_TRACE_MSG_EVENT(event, comm_ptr, hdr_peer, hdr_tag, op)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2008-09-05 11:47:54 +04:00
|
|
|
END_C_DECLS
|
|
|
|
|
2006-03-23 08:00:55 +03:00
|
|
|
#endif /* _PERUSE_INTERNAL_H_ */
|