2005-06-15 23:10:26 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-06-15 23:10:26 +04:00
|
|
|
* 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.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
2005-06-30 09:50:55 +04:00
|
|
|
#ifndef MCA_BTL_SELF_H
|
|
|
|
#define MCA_BTL_SELF_H
|
2005-06-15 23:10:26 +04:00
|
|
|
|
2005-12-11 01:04:28 +03:00
|
|
|
#ifdef HAVE_STDLIB_H
|
2005-06-15 23:10:26 +04:00
|
|
|
#include <stdlib.h>
|
2005-12-11 01:04:28 +03:00
|
|
|
#endif /* HAVE_STDLIB_H */
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
2005-06-15 23:10:26 +04:00
|
|
|
#include <sys/types.h>
|
2005-12-11 01:04:28 +03:00
|
|
|
#endif /* HAVE_SYS_TYPES_H */
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/class/ompi_free_list.h"
|
|
|
|
#include "ompi/class/ompi_bitmap.h"
|
|
|
|
#include "ompi/class/ompi_fifo.h"
|
2005-07-04 03:09:55 +04:00
|
|
|
#include "opal/event/event.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mca/pml/pml.h"
|
|
|
|
#include "ompi/mca/btl/btl.h"
|
|
|
|
#include "ompi/mca/btl/base/base.h"
|
2005-06-15 23:10:26 +04:00
|
|
|
|
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2005-06-30 09:50:55 +04:00
|
|
|
* Shared Memory (SELF) BTL module.
|
2005-06-15 23:10:26 +04:00
|
|
|
*/
|
2005-06-30 09:50:55 +04:00
|
|
|
struct mca_btl_self_component_t {
|
|
|
|
mca_btl_base_component_1_0_0_t super; /**< base BTL component */
|
2005-06-15 23:10:26 +04:00
|
|
|
int free_list_num; /**< initial size of free lists */
|
|
|
|
int free_list_max; /**< maximum size of free lists */
|
|
|
|
int free_list_inc; /**< number of elements to alloc when growing free lists */
|
2005-07-04 02:45:48 +04:00
|
|
|
opal_mutex_t self_lock;
|
2005-06-15 23:10:26 +04:00
|
|
|
ompi_free_list_t self_frags_eager; /**< free list of self first */
|
|
|
|
ompi_free_list_t self_frags_send; /**< free list of self second */
|
|
|
|
ompi_free_list_t self_frags_rdma; /**< free list of self second */
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_base_recv_reg_t self_reg[256];
|
2005-06-15 23:10:26 +04:00
|
|
|
};
|
2005-06-30 09:50:55 +04:00
|
|
|
typedef struct mca_btl_self_component_t mca_btl_self_component_t;
|
|
|
|
extern mca_btl_self_component_t mca_btl_self_component;
|
2005-06-15 23:10:26 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Register shared memory module parameters with the MCA framework
|
|
|
|
*/
|
2005-06-30 09:50:55 +04:00
|
|
|
extern int mca_btl_self_component_open(void);
|
2005-06-15 23:10:26 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Any final cleanup before being unloaded.
|
|
|
|
*/
|
2005-06-30 09:50:55 +04:00
|
|
|
extern int mca_btl_self_component_close(void);
|
2005-06-15 23:10:26 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* SELF module initialization.
|
|
|
|
*
|
2005-06-30 09:50:55 +04:00
|
|
|
* @param num_btls (OUT) Number of BTLs returned in BTL array.
|
|
|
|
* @param enable_progress_threads (IN) Flag indicating whether BTL is allowed to have progress threads
|
|
|
|
* @param enable_mpi_threads (IN) Flag indicating whether BTL must support multilple simultaneous invocations from different threads
|
2005-06-15 23:10:26 +04:00
|
|
|
*
|
|
|
|
*/
|
2005-06-30 09:50:55 +04:00
|
|
|
extern mca_btl_base_module_t** mca_btl_self_component_init(
|
|
|
|
int *num_btls,
|
2005-06-15 23:10:26 +04:00
|
|
|
bool enable_progress_threads,
|
|
|
|
bool enable_mpi_threads
|
|
|
|
);
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
extern mca_btl_base_module_t mca_btl_self;
|
2005-06-15 23:10:26 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2005-06-30 09:50:55 +04:00
|
|
|
* Cleanup any resources held by the BTL.
|
2005-06-15 23:10:26 +04:00
|
|
|
*
|
2005-06-30 09:50:55 +04:00
|
|
|
* @param btl BTL instance.
|
2005-06-15 23:10:26 +04:00
|
|
|
* @return OMPI_SUCCESS or error status on failure.
|
|
|
|
*/
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
extern int mca_btl_self_finalize(
|
|
|
|
struct mca_btl_base_module_t* btl
|
2005-06-15 23:10:26 +04:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2005-06-30 09:50:55 +04:00
|
|
|
* PML->BTL notification of change in the process list.
|
|
|
|
* PML->BTL Notification that a receive fragment has been matched.
|
2005-06-15 23:10:26 +04:00
|
|
|
* Called for message that is send from process with the virtual
|
|
|
|
* address of the shared memory segment being different than that of
|
|
|
|
* the receiver.
|
|
|
|
*
|
2005-06-30 09:50:55 +04:00
|
|
|
* @param btl (IN)
|
2005-06-15 23:10:26 +04:00
|
|
|
* @param proc (IN)
|
|
|
|
* @param peer (OUT)
|
|
|
|
* @return OMPI_SUCCESS or error status on failure.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
extern int mca_btl_self_add_procs(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
2005-06-15 23:10:26 +04:00
|
|
|
size_t nprocs,
|
|
|
|
struct ompi_proc_t **procs,
|
2005-06-30 09:50:55 +04:00
|
|
|
struct mca_btl_base_endpoint_t** peers,
|
2005-06-15 23:10:26 +04:00
|
|
|
struct ompi_bitmap_t* reachability
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2005-06-30 09:50:55 +04:00
|
|
|
* PML->BTL notification of change in the process list.
|
|
|
|
* PML->BTL Notification that a receive fragment has been matched.
|
2005-06-15 23:10:26 +04:00
|
|
|
* Called for message that is send from process with the virtual
|
|
|
|
* address of the shared memory segment being the same as that of
|
|
|
|
* the receiver.
|
|
|
|
*
|
2005-06-30 09:50:55 +04:00
|
|
|
* @param btl (IN)
|
2005-06-15 23:10:26 +04:00
|
|
|
* @param proc (IN)
|
|
|
|
* @param peer (OUT)
|
|
|
|
* @return OMPI_SUCCESS or error status on failure.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
extern int mca_btl_self_add_procs_same_base_addr(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
2005-06-15 23:10:26 +04:00
|
|
|
size_t nprocs,
|
|
|
|
struct ompi_proc_t **procs,
|
2005-06-30 09:50:55 +04:00
|
|
|
struct mca_btl_base_endpoint_t** peers,
|
2005-06-15 23:10:26 +04:00
|
|
|
ompi_bitmap_t* reachability
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2005-06-30 09:50:55 +04:00
|
|
|
* PML->BTL notification of change in the process list.
|
2005-06-15 23:10:26 +04:00
|
|
|
*
|
2005-06-30 09:50:55 +04:00
|
|
|
* @param btl (IN) BTL instance
|
2005-06-15 23:10:26 +04:00
|
|
|
* @param proc (IN) Peer process
|
|
|
|
* @param peer (IN) Peer addressing information.
|
|
|
|
* @return Status indicating if cleanup was successful
|
|
|
|
*
|
|
|
|
*/
|
2005-06-30 09:50:55 +04:00
|
|
|
extern int mca_btl_self_del_procs(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
2005-06-15 23:10:26 +04:00
|
|
|
size_t nprocs,
|
|
|
|
struct ompi_proc_t **procs,
|
2005-06-30 09:50:55 +04:00
|
|
|
struct mca_btl_base_endpoint_t **peers
|
2005-06-15 23:10:26 +04:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register a callback function that is called on receipt
|
|
|
|
* of a fragment.
|
|
|
|
*
|
2005-06-30 09:50:55 +04:00
|
|
|
* @param btl (IN) BTL module
|
2005-06-15 23:10:26 +04:00
|
|
|
* @return Status indicating if cleanup was successful
|
|
|
|
*
|
2005-06-30 09:50:55 +04:00
|
|
|
* When the process list changes, the PML notifies the BTL of the
|
2005-06-15 23:10:26 +04:00
|
|
|
* change, to provide the opportunity to cleanup or release any
|
|
|
|
* resources associated with the peer.
|
|
|
|
*/
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
extern int mca_btl_self_register(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_tag_t tag,
|
|
|
|
mca_btl_base_module_recv_cb_fn_t cbfunc,
|
2005-06-15 23:10:26 +04:00
|
|
|
void* cbdata
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate a segment.
|
|
|
|
*
|
2005-06-30 09:50:55 +04:00
|
|
|
* @param btl (IN) BTL module
|
2005-06-15 23:10:26 +04:00
|
|
|
* @param size (IN) Request segment size.
|
|
|
|
*/
|
2005-06-30 09:50:55 +04:00
|
|
|
extern mca_btl_base_descriptor_t* mca_btl_self_alloc(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
2005-06-15 23:10:26 +04:00
|
|
|
size_t size
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2005-06-30 09:50:55 +04:00
|
|
|
* Return a segment allocated by this BTL.
|
2005-06-15 23:10:26 +04:00
|
|
|
*
|
2005-06-30 09:50:55 +04:00
|
|
|
* @param btl (IN) BTL module
|
2005-06-15 23:10:26 +04:00
|
|
|
* @param segment (IN) Allocated segment.
|
|
|
|
*/
|
2005-06-30 09:50:55 +04:00
|
|
|
extern int mca_btl_self_free(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_descriptor_t* segment
|
2005-06-15 23:10:26 +04:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pack data
|
|
|
|
*
|
2005-06-30 09:50:55 +04:00
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param peer (IN) BTL peer addressing
|
2005-06-15 23:10:26 +04:00
|
|
|
*/
|
2005-06-30 09:50:55 +04:00
|
|
|
struct mca_btl_base_descriptor_t* mca_btl_self_prepare_src(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* endpoint,
|
2005-06-23 19:53:51 +04:00
|
|
|
struct mca_mpool_base_registration_t* registration,
|
2005-06-15 23:10:26 +04:00
|
|
|
struct ompi_convertor_t* convertor,
|
|
|
|
size_t reserve,
|
|
|
|
size_t* size
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepare data for RDMA
|
|
|
|
*
|
2005-06-30 09:50:55 +04:00
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param peer (IN) BTL peer addressing
|
2005-06-15 23:10:26 +04:00
|
|
|
*/
|
2005-06-30 09:50:55 +04:00
|
|
|
struct mca_btl_base_descriptor_t* mca_btl_self_prepare_dst(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* endpoint,
|
2005-06-23 19:53:51 +04:00
|
|
|
struct mca_mpool_base_registration_t* registration,
|
2005-06-15 23:10:26 +04:00
|
|
|
struct ompi_convertor_t* convertor,
|
|
|
|
size_t reserve,
|
|
|
|
size_t* size
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initiate a send to the peer.
|
|
|
|
*
|
2005-06-30 09:50:55 +04:00
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param peer (IN) BTL peer addressing
|
2005-06-15 23:10:26 +04:00
|
|
|
*/
|
2005-06-30 09:50:55 +04:00
|
|
|
extern int mca_btl_self_send(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* endpoint,
|
|
|
|
struct mca_btl_base_descriptor_t* descriptor,
|
|
|
|
mca_btl_base_tag_t tag
|
2005-06-15 23:10:26 +04:00
|
|
|
);
|
|
|
|
|
2005-06-20 20:38:19 +04:00
|
|
|
/**
|
|
|
|
* Initiate a put to the peer.
|
|
|
|
*
|
2005-06-30 09:50:55 +04:00
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param peer (IN) BTL peer addressing
|
2005-06-20 20:38:19 +04:00
|
|
|
*/
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
extern int mca_btl_self_rdma(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* endpoint,
|
|
|
|
struct mca_btl_base_descriptor_t* descriptor
|
2005-06-20 20:38:19 +04:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2005-06-15 23:10:26 +04:00
|
|
|
|
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|