2006-01-28 18:38:37 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
2006-08-24 20:38:08 +04:00
|
|
|
* Copyright (c) 2004-2006 The Trustees of the University of Tennessee.
|
2006-01-28 18:38:37 +03:00
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2007-05-24 00:31:25 +04:00
|
|
|
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
2010-07-20 22:45:48 +04:00
|
|
|
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
|
2006-01-28 18:38:37 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OMPI_OSC_PT2PT_H
|
|
|
|
#define OMPI_OSC_PT2PT_H
|
|
|
|
|
2009-03-04 18:35:54 +03:00
|
|
|
#include "ompi_config.h"
|
2006-01-28 18:38:37 +03:00
|
|
|
#include "opal/class/opal_list.h"
|
|
|
|
#include "opal/class/opal_free_list.h"
|
|
|
|
#include "opal/class/opal_hash_table.h"
|
2009-11-27 17:49:24 +03:00
|
|
|
#include "opal/threads/threads.h"
|
2006-01-28 18:38:37 +03:00
|
|
|
|
|
|
|
#include "ompi/win/win.h"
|
|
|
|
#include "ompi/communicator/communicator.h"
|
2011-07-01 00:05:16 +04:00
|
|
|
#include "ompi/request/request.h"
|
2007-05-24 00:31:25 +04:00
|
|
|
#include "ompi/mca/osc/osc.h"
|
2006-01-28 18:38:37 +03:00
|
|
|
|
2007-05-21 06:21:25 +04:00
|
|
|
BEGIN_C_DECLS
|
2006-08-24 20:38:08 +04:00
|
|
|
|
2006-11-27 06:22:44 +03:00
|
|
|
#define CONTROL_MSG_TAG (-200)
|
|
|
|
|
2006-01-28 18:38:37 +03:00
|
|
|
struct ompi_osc_pt2pt_component_t {
|
|
|
|
/** Extend the basic osc component interface */
|
|
|
|
ompi_osc_base_component_t super;
|
|
|
|
|
2006-08-03 04:10:19 +04:00
|
|
|
/** max size of eager message */
|
2013-03-28 01:09:41 +04:00
|
|
|
unsigned long long p2p_c_eager_size;
|
2006-01-28 18:38:37 +03:00
|
|
|
|
|
|
|
/** free list of ompi_osc_pt2pt_sendreq_t structures */
|
|
|
|
opal_free_list_t p2p_c_sendreqs;
|
|
|
|
/** free list of ompi_osc_pt2pt_replyreq_t structures */
|
|
|
|
opal_free_list_t p2p_c_replyreqs;
|
|
|
|
/** free list of ompi_osc_pt2pt_longreq_t structures */
|
|
|
|
opal_free_list_t p2p_c_longreqs;
|
2006-08-03 04:10:19 +04:00
|
|
|
/** free list for eager / control meessages */
|
|
|
|
opal_free_list_t p2p_c_buffers;
|
2006-01-28 18:38:37 +03:00
|
|
|
};
|
|
|
|
typedef struct ompi_osc_pt2pt_component_t ompi_osc_pt2pt_component_t;
|
|
|
|
|
|
|
|
|
|
|
|
struct ompi_osc_pt2pt_module_t {
|
|
|
|
/** Extend the basic osc module interface */
|
2006-08-03 04:10:19 +04:00
|
|
|
ompi_osc_base_module_t super;
|
2006-01-28 18:38:37 +03:00
|
|
|
|
|
|
|
/** lock access to data structures in the current module */
|
|
|
|
opal_mutex_t p2p_lock;
|
|
|
|
|
2007-05-24 00:31:25 +04:00
|
|
|
/** condition variable for access to current module */
|
2007-05-21 06:21:25 +04:00
|
|
|
opal_condition_t p2p_cond;
|
|
|
|
|
2006-01-28 18:38:37 +03:00
|
|
|
/** lock for "atomic" window updates from reductions */
|
|
|
|
opal_mutex_t p2p_acc_lock;
|
|
|
|
|
|
|
|
/** pointer back to window */
|
|
|
|
ompi_win_t *p2p_win;
|
|
|
|
|
|
|
|
/** communicator created with this window */
|
|
|
|
ompi_communicator_t *p2p_comm;
|
|
|
|
|
2006-02-07 15:16:23 +03:00
|
|
|
/** list of ompi_osc_pt2pt_sendreq_t structures, and includes all
|
|
|
|
requests for this access epoch that have not already been
|
|
|
|
started. p2p_lock must be held when modifying this field. */
|
|
|
|
opal_list_t p2p_pending_sendreqs;
|
|
|
|
|
2006-11-28 00:41:29 +03:00
|
|
|
/** list of unsigned int counters for the number of requests to a
|
2006-02-07 15:16:23 +03:00
|
|
|
particular rank in p2p_comm for this access epoc. p2p_lock
|
|
|
|
must be held when modifying this field */
|
2006-11-28 00:41:29 +03:00
|
|
|
unsigned int *p2p_num_pending_sendreqs;
|
2006-02-07 15:16:23 +03:00
|
|
|
|
|
|
|
/** For MPI_Fence synchronization, the number of messages to send
|
|
|
|
in epoch. For Start/Complete, the number of updates for this
|
2006-09-21 23:57:57 +04:00
|
|
|
Complete. For lock, the number of
|
2006-02-07 21:45:18 +03:00
|
|
|
messages waiting for completion on on the origin side. Not
|
|
|
|
protected by p2p_lock - must use atomic counter operations. */
|
2007-05-22 00:53:02 +04:00
|
|
|
int32_t p2p_num_pending_out;
|
2006-02-07 15:16:23 +03:00
|
|
|
|
|
|
|
/** For MPI_Fence synchronization, the number of expected incoming
|
|
|
|
messages. For Post/Wait, the number of expected updates from
|
2006-02-07 21:45:18 +03:00
|
|
|
complete. For lock, the number of messages on the passive side
|
|
|
|
we are waiting for. Not protected by p2p_lock - must use
|
|
|
|
atomic counter operations. */
|
2007-05-22 00:53:02 +04:00
|
|
|
int32_t p2p_num_pending_in;
|
2006-01-28 18:38:37 +03:00
|
|
|
|
2006-09-21 23:57:57 +04:00
|
|
|
/** Number of "ping" messages from the remote post group we've
|
|
|
|
received */
|
2007-05-22 00:53:02 +04:00
|
|
|
int32_t p2p_num_post_msgs;
|
2006-09-21 23:57:57 +04:00
|
|
|
|
|
|
|
/** Number of "count" messages from the remote complete group
|
|
|
|
we've received */
|
2007-05-22 00:53:02 +04:00
|
|
|
int32_t p2p_num_complete_msgs;
|
2006-09-21 23:57:57 +04:00
|
|
|
|
2006-08-03 04:10:19 +04:00
|
|
|
/** cyclic counter for a unique tag for long messages. Not
|
2006-02-07 15:16:23 +03:00
|
|
|
protected by the p2p_lock - must use create_send_tag() to
|
|
|
|
create a send tag */
|
2006-01-28 18:38:37 +03:00
|
|
|
volatile int32_t p2p_tag_counter;
|
|
|
|
|
2006-02-07 15:16:23 +03:00
|
|
|
opal_list_t p2p_copy_pending_sendreqs;
|
2006-11-28 00:41:29 +03:00
|
|
|
unsigned int *p2p_copy_num_pending_sendreqs;
|
2006-02-07 15:16:23 +03:00
|
|
|
|
|
|
|
/* ********************* FENCE data ************************ */
|
|
|
|
/* an array of <sizeof(p2p_comm)> ints, each containing the value
|
|
|
|
1. */
|
|
|
|
int *p2p_fence_coll_counts;
|
2006-03-16 21:40:42 +03:00
|
|
|
|
2006-02-07 15:16:23 +03:00
|
|
|
/* ********************* PWSC data ************************ */
|
|
|
|
struct ompi_group_t *p2p_pw_group;
|
|
|
|
struct ompi_group_t *p2p_sc_group;
|
2006-09-22 00:49:15 +04:00
|
|
|
bool *p2p_sc_remote_active_ranks;
|
|
|
|
int *p2p_sc_remote_ranks;
|
2006-02-07 15:16:23 +03:00
|
|
|
|
|
|
|
/* ********************* LOCK data ************************ */
|
2006-02-07 21:45:18 +03:00
|
|
|
int32_t p2p_lock_status; /* one of 0, MPI_LOCK_EXCLUSIVE, MPI_LOCK_SHARED */
|
|
|
|
int32_t p2p_shared_count;
|
|
|
|
opal_list_t p2p_locks_pending;
|
2007-05-21 06:21:25 +04:00
|
|
|
opal_list_t p2p_unlocks_pending;
|
2006-02-07 21:45:18 +03:00
|
|
|
int32_t p2p_lock_received_ack;
|
2006-01-28 18:38:37 +03:00
|
|
|
};
|
|
|
|
typedef struct ompi_osc_pt2pt_module_t ompi_osc_pt2pt_module_t;
|
2006-08-24 20:38:08 +04:00
|
|
|
OMPI_MODULE_DECLSPEC extern ompi_osc_pt2pt_component_t mca_osc_pt2pt_component;
|
2006-01-28 18:38:37 +03:00
|
|
|
|
2007-05-21 06:21:25 +04:00
|
|
|
|
|
|
|
/**
|
2006-01-28 18:38:37 +03:00
|
|
|
* Helper macro for grabbing the module structure from a window instance
|
|
|
|
*/
|
2006-01-29 21:00:30 +03:00
|
|
|
#define P2P_MODULE(win) ((ompi_osc_pt2pt_module_t*) win->w_osc_module)
|
2006-01-28 18:38:37 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Component functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
int ompi_osc_pt2pt_component_init(bool enable_progress_threads,
|
2007-05-24 00:31:25 +04:00
|
|
|
bool enable_mpi_threads);
|
2006-01-28 18:38:37 +03:00
|
|
|
|
|
|
|
int ompi_osc_pt2pt_component_finalize(void);
|
|
|
|
|
|
|
|
int ompi_osc_pt2pt_component_query(struct ompi_win_t *win,
|
|
|
|
struct ompi_info_t *info,
|
|
|
|
struct ompi_communicator_t *comm);
|
|
|
|
|
|
|
|
int ompi_osc_pt2pt_component_select(struct ompi_win_t *win,
|
|
|
|
struct ompi_info_t *info,
|
|
|
|
struct ompi_communicator_t *comm);
|
|
|
|
|
2011-07-01 00:05:16 +04:00
|
|
|
/* helper function that properly sets up request handling */
|
|
|
|
int ompi_osc_pt2pt_component_irecv(void *buf,
|
|
|
|
size_t count,
|
|
|
|
struct ompi_datatype_t *datatype,
|
|
|
|
int src,
|
|
|
|
int tag,
|
|
|
|
struct ompi_communicator_t *comm,
|
|
|
|
struct ompi_request_t **request,
|
|
|
|
ompi_request_complete_fn_t callback,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
int ompi_osc_pt2pt_component_isend(void *buf,
|
|
|
|
size_t count,
|
|
|
|
struct ompi_datatype_t *datatype,
|
|
|
|
int dest,
|
|
|
|
int tag,
|
|
|
|
struct ompi_communicator_t *comm,
|
|
|
|
struct ompi_request_t **request,
|
|
|
|
ompi_request_complete_fn_t callback,
|
|
|
|
void *data);
|
2006-01-28 18:38:37 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Module interface function types
|
|
|
|
*/
|
|
|
|
int ompi_osc_pt2pt_module_free(struct ompi_win_t *win);
|
|
|
|
|
|
|
|
int ompi_osc_pt2pt_module_put(void *origin_addr,
|
|
|
|
int origin_count,
|
|
|
|
struct ompi_datatype_t *origin_dt,
|
|
|
|
int target,
|
2010-07-20 22:45:48 +04:00
|
|
|
OPAL_PTRDIFF_TYPE target_disp,
|
2006-01-28 18:38:37 +03:00
|
|
|
int target_count,
|
|
|
|
struct ompi_datatype_t *target_dt,
|
|
|
|
struct ompi_win_t *win);
|
|
|
|
|
|
|
|
int ompi_osc_pt2pt_module_accumulate(void *origin_addr,
|
|
|
|
int origin_count,
|
|
|
|
struct ompi_datatype_t *origin_dt,
|
|
|
|
int target,
|
2010-07-20 22:45:48 +04:00
|
|
|
OPAL_PTRDIFF_TYPE target_disp,
|
2006-01-28 18:38:37 +03:00
|
|
|
int target_count,
|
|
|
|
struct ompi_datatype_t *target_dt,
|
|
|
|
struct ompi_op_t *op,
|
|
|
|
struct ompi_win_t *win);
|
|
|
|
|
|
|
|
int ompi_osc_pt2pt_module_get(void *origin_addr,
|
|
|
|
int origin_count,
|
|
|
|
struct ompi_datatype_t *origin_dt,
|
|
|
|
int target,
|
2010-07-20 22:45:48 +04:00
|
|
|
OPAL_PTRDIFF_TYPE target_disp,
|
2006-01-28 18:38:37 +03:00
|
|
|
int target_count,
|
|
|
|
struct ompi_datatype_t *target_dt,
|
|
|
|
struct ompi_win_t *win);
|
|
|
|
|
|
|
|
int ompi_osc_pt2pt_module_fence(int assert, struct ompi_win_t *win);
|
|
|
|
|
|
|
|
int ompi_osc_pt2pt_module_start(struct ompi_group_t *group,
|
|
|
|
int assert,
|
|
|
|
struct ompi_win_t *win);
|
|
|
|
int ompi_osc_pt2pt_module_complete(struct ompi_win_t *win);
|
|
|
|
|
|
|
|
int ompi_osc_pt2pt_module_post(struct ompi_group_t *group,
|
|
|
|
int assert,
|
|
|
|
struct ompi_win_t *win);
|
|
|
|
|
|
|
|
int ompi_osc_pt2pt_module_wait(struct ompi_win_t *win);
|
|
|
|
|
|
|
|
int ompi_osc_pt2pt_module_test(struct ompi_win_t *win,
|
2006-01-31 05:44:08 +03:00
|
|
|
int *flag);
|
2006-01-28 18:38:37 +03:00
|
|
|
|
|
|
|
int ompi_osc_pt2pt_module_lock(int lock_type,
|
|
|
|
int target,
|
|
|
|
int assert,
|
|
|
|
struct ompi_win_t *win);
|
|
|
|
|
|
|
|
int ompi_osc_pt2pt_module_unlock(int target,
|
|
|
|
struct ompi_win_t *win);
|
|
|
|
|
2006-02-07 21:45:18 +03:00
|
|
|
/*
|
|
|
|
* passive side sync interface functions
|
|
|
|
*/
|
|
|
|
int ompi_osc_pt2pt_passive_lock(ompi_osc_pt2pt_module_t *module,
|
|
|
|
int32_t origin,
|
|
|
|
int32_t lock_type);
|
|
|
|
|
|
|
|
int ompi_osc_pt2pt_passive_unlock(ompi_osc_pt2pt_module_t *module,
|
|
|
|
int32_t origin,
|
|
|
|
int32_t count);
|
2007-05-24 00:31:25 +04:00
|
|
|
|
2007-05-21 06:21:25 +04:00
|
|
|
int ompi_osc_pt2pt_passive_unlock_complete(ompi_osc_pt2pt_module_t *module);
|
2006-01-28 18:38:37 +03:00
|
|
|
|
2007-05-21 06:21:25 +04:00
|
|
|
END_C_DECLS
|
2006-01-28 18:38:37 +03:00
|
|
|
|
|
|
|
#endif /* OMPI_OSC_PT2PT_H */
|