1
1

working checkin of bmi to btl name change. Also changed ib to mvapi. Should

probably change mpool/vapi to mpool/mvapi soon.

This commit was SVN r6225.
Этот коммит содержится в:
Galen Shipman 2005-06-30 05:50:55 +00:00
родитель bd4d647e62
Коммит db286e1a31
100 изменённых файлов: 3544 добавлений и 7195 удалений

Просмотреть файл

@ -871,6 +871,7 @@ MCA_ns_NO_CONFIGURE_SUBDIRS=""
MCA_soh_NO_CONFIGURE_SUBDIRS=""
MCA_allocator_NO_CONFIGURE_SUBDIRS=""
MCA_btl_NO_CONFIGURE_SUBDIRS=""
MCA_coll_NO_CONFIGURE_SUBDIRS=""
MCA_io_NO_CONFIGURE_SUBDIRS=""
MCA_pml_NO_CONFIGURE_SUBDIRS=""

Просмотреть файл

@ -148,7 +148,7 @@ libmpi_la_LIBADD = \
info/libinfo.la \
mca/base/libmca_base.la \
mca/allocator/base/libmca_allocator_base.la $(MCA_allocator_STATIC_LTLIBS) \
mca/bmi/base/libmca_bmi_base.la $(MCA_bmi_STATIC_LTLIBS) \
mca/btl/base/libmca_btl_base.la $(MCA_btl_STATIC_LTLIBS) \
mca/coll/base/libmca_coll_base.la $(MCA_coll_STATIC_LTLIBS) \
$(MCA_common_STATIC_LTLIBS) \
mca/errmgr/base/libmca_errmgr_base.la \

Просмотреть файл

@ -16,17 +16,17 @@
include $(top_srcdir)/config/Makefile.options
SUBDIRS = base $(MCA_bmi_STATIC_SUBDIRS)
DIST_SUBDIRS = base $(MCA_bmi_ALL_SUBDIRS)
SUBDIRS = base $(MCA_btl_STATIC_SUBDIRS)
DIST_SUBDIRS = base $(MCA_btl_ALL_SUBDIRS)
# Source code files
headers = bmi.h
headers = btl.h
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/mca/bmi
ompidir = $(includedir)/openmpi/mca/btl
ompi_HEADERS = $(headers)
else
ompidir = $(includedir)

Просмотреть файл

@ -16,8 +16,8 @@
/**
* @file
*/
#ifndef MCA_BMI_BASE_H
#define MCA_BMI_BASE_H
#ifndef MCA_BTL_BASE_H
#define MCA_BTL_BASE_H
#include "ompi_config.h"
#include "class/ompi_list.h"
@ -49,7 +49,7 @@ typedef struct mca_btl_base_recv_reg_t mca_btl_base_recv_reg_t;
OBJ_CLASS_DECLARATION(mca_btl_base_selected_module_t);
/*
* Global functions for MCA: overall BMI open and close
* Global functions for MCA: overall BTL open and close
*/
OMPI_DECLSPEC int mca_btl_base_open(void);
@ -69,4 +69,4 @@ OMPI_DECLSPEC extern ompi_list_t mca_btl_base_modules_initialized;
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* MCA_BMI_BASE_H */
#endif /* MCA_BTL_BASE_H */

Просмотреть файл

@ -1,505 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* Bit Mover Interface (BMI)
*
*
* BMI Initialization:
*
* During library initialization, all available BMI components are
* loaded and opened via their mca_base_open_component_fn_t
* function. The BMI open function should register any mca parameters
* used to tune/adjust the behaviour of the BMI (mca_base_param_register_int(),
* mca_base_param_register_string()). Note that the open function may fail
* if the resources (e.g. shared libraries, etc) required by the network
* transport are not available.
*
* The mca_bmi_base_component_init_fn_t() is then called for each of the
* components that are succesfully opened. The component init function may
* return either:
*
* (1) a NULL list of BMI modules if the transport is not available,
* (2) a list containing a single BMI module, where the BMI provides
* a layer of abstraction over multiple physical devices (e.g. NICs),
* (3) a list containing multiple BMI modules where each BMI module
* corresponds to a single physical device.
*
* During module initialization, the module should post any addressing
* information required by its peers. An example would be the TCP
* listen port opened by the TCP module for incoming connection
* requests. This information is published to peers via the
* mca_base_modex_send() interface. Note that peer information is not
* guaranteed to be available via mca_base_modex_recv() during the
* module's init function. However, it will be available during
* BMI selection (mca_bmi_base_add_proc_fn_t()).
*
* BMI Selection:
*
* The upper layer builds an ordered list of the available BMI modules sorted
* by their exclusivity ranking. This is a relative ranking that is used
* to determine the set of BMIs that may be used to reach a given destination.
* During startup the BMI modules are queried via their
* mca_bmi_base_add_proc_fn_t() to determine if they are able to reach
* a given destination. The BMI module with the highest ranking that
* returns success is selected. Subsequent BMI modules are selected only
* if they have the same exclusivity ranking.
*
* An example of how this might be used:
*
* BMI Exclusivity Comments
* -------- ----------- ------------------
* LO 100 Selected exclusively for local process
* SM 50 Selected exclusively for other processes on host
* IB 0 Selected based on network reachability
* IB 0 Selected based on network reachability
* TCP 0 Selected based on network reachability
* TCP 0 Selected based on network reachability
*
* When a BMI module is selected, it may choose to optionally return a
* pointer to an an mca_bmi_base_endpoint_t data structure to the PML.
* This pointer is treated as an opaque handle by the PML and is
* returned to the BMI on subsequent data transfer calls to the
* corresponding destination process. The actual contents of the
* data structure are defined on a per BMI basis, and may be used to
* cache addressing or connection information, such as a TCP socket
* or IB queue pair.
*
* Progress:
*
* By default, the library provides for polling based progress of outstanding
* requests. The BMI component exports an interface function (bmim_progress)
* that is called in a polling mode by the PML during calls into the MPI
* library. Note that the bmim_progress() function is called on the BMI component
* rather than each BMI module. This implies that the BMI author is responsible
* for iterating over the pending operations in each of the BMI modules associated
* with the component.
*
* On platforms where threading support is provided, the library provides the
* option of building with asynchronous threaded progress. In this case, the BMI
* author is responsible for providing a thread to progress pending operations.
* A thread is associated with the BMI component/module such that transport specific
* functionality/APIs may be used to block the thread ubmil a pending operation
* completes. This thread MUST NOT poll for completion as this would oversubscribe
* the CPU.
*
* Note that in the threaded case the PML may choose to use a hybrid approach,
* such that polling is implemented from the user thread for a fixed number of
* cycles before relying on the background thread(s) to complete requests. If
* possible the BMI should support the use of both modes concurrebmiy.
*
*/
#include "mca/mca.h"
#ifndef MCA_BMI_H
#define MCA_BMI_H
#include "include/types.h"
#include "class/ompi_free_list.h"
/*
* BMI types
*/
struct mca_bmi_base_module_t;
struct mca_bmi_base_endpoint_t;
struct mca_bmi_base_descriptor_t;
struct mca_mpool_base_resources_t;
/* send/recv operations require tag matching */
typedef uint8_t mca_bmi_base_tag_t;
/* reserved tag values */
#define MCA_BMI_TAG_BMI 0
#define MCA_BMI_TAG_PML 1
#define MCA_BMI_TAG_USR 2
/* prefered protocol */
#define MCA_BMI_FLAGS_SEND 1
#define MCA_BMI_FLAGS_RDMA 2
/**
* Asynchronous callback function on completion of an operation.
*/
typedef void (*mca_bmi_base_completion_fn_t)(
struct mca_bmi_base_module_t*,
struct mca_bmi_base_endpoint_t*,
struct mca_bmi_base_descriptor_t*,
int status);
/**
* Describes a region/segment of memory that is addressable
* by an BMI.
*/
struct mca_bmi_base_segment_t {
ompi_ptr_t seg_addr;
uint32_t seg_len;
union {
uint32_t key32[2];
uint64_t key64;
uint8_t key8[8];
} seg_key;
};
typedef struct mca_bmi_base_segment_t mca_bmi_base_segment_t;
/**
* A descriptor that holds the parameters to a send/put/get
* operation along w/ a callback routine that is called on
* completion of the request.
*/
struct mca_bmi_base_descriptor_t {
ompi_free_list_item_t super;
mca_bmi_base_segment_t *des_src;
size_t des_src_cnt;
mca_bmi_base_segment_t *des_dst;
size_t des_dst_cnt;
mca_bmi_base_completion_fn_t des_cbfunc;
void* des_cbdata;
int32_t des_flags;
};
typedef struct mca_bmi_base_descriptor_t mca_bmi_base_descriptor_t;
OBJ_CLASS_DECLARATION(mca_bmi_base_descriptor_t);
#define MCA_BMI_DES_FLAGS_DEREGISTER 0x0001
#define MCA_BMI_DES_FLAGS_PRIORITY 0x0002
/**
* Maximum number of allowed segments in src/dst fields of a descriptor.
*/
#define MCA_BMI_DES_MAX_SEGMENTS 16
/*
* BMI base header, stores the tag at a minimum
*/
struct mca_bmi_base_header_t{
mca_bmi_base_tag_t tag;
};
typedef struct mca_bmi_base_header_t mca_bmi_base_header_t;
/*
* BMI component interface functions and datatype.
*/
/**
* MCA->BMI Initializes the BMI component and creates specific BMI
* module(s).
*
* @param num_bmis (OUT) Returns the number of bmi modules created, or 0
* if the transport is not available.
*
* @param enable_progress_threads (IN) Whether this component is
* allowed to run a hidden/progress thread or not.
*
* @param enable_mpi_threads (IN) Whether support for multiple MPI
* threads is enabled or not (i.e., MPI_THREAD_MULTIPLE), which
* indicates whether multiple threads may invoke this component
* simultaneously or not.
*
* @return Array of pointers to BMI modules, or NULL if the transport
* is not available.
*
* During component initialization, the BMI component should discover
* the physical devices that are available for the given transport,
* and create a BMI module to represent each device. Any addressing
* information required by peers to reach the device should be published
* during this function via the mca_base_modex_send() interface.
*
*/
typedef struct mca_bmi_base_module_t** (*mca_bmi_base_component_init_fn_t)(
int *num_bmis,
bool enable_progress_threads,
bool enable_mpi_threads
);
/**
* MCA->BMI Called to progress outstanding requests for
* non-threaded polling environments.
*
* @param tstamp Current time.
* @return OMPI_SUCCESS or error code on failure.
*/
typedef int (*mca_bmi_base_component_progress_fn_t)(void);
/**
* BMI component descriptor. Contains component version information
* and component open/close/init functions.
*/
struct mca_bmi_base_component_1_0_0_t {
mca_base_component_t bmi_version;
mca_base_component_data_1_0_0_t bmi_data;
mca_bmi_base_component_init_fn_t bmi_init;
mca_bmi_base_component_progress_fn_t bmi_progress;
};
typedef struct mca_bmi_base_component_1_0_0_t mca_bmi_base_component_1_0_0_t;
typedef struct mca_bmi_base_component_1_0_0_t mca_bmi_base_component_t;
/*
* BMI module interface functions and datatype.
*/
/**
* MCA->BMI Clean up any resources held by BMI module
* before the module is unloaded.
*
* @param bmi (IN) BMI module.
*
* Prior to unloading a BMI module, the MCA framework will call
* the BMI finalize method of the module. Any resources held by
* the BMI should be released and if required the memory corresponding
* to the BMI module freed.
*
*/
typedef int (*mca_bmi_base_module_finalize_fn_t)(
struct mca_bmi_base_module_t* bmi
);
/**
* PML->BMI notification of change in the process list.
*
* @param bmi (IN) BMI module
* @param nprocs (IN) Number of processes
* @param procs (IN) Set of processes
* @param endpoint (OUT) Set of (optional) mca_bmi_base_endpoint_t structures by BMI.
* @param reachable (OUT) Bitmask indicating set of peer processes that are reachable by this BMI.
* @return OMPI_SUCCESS or error status on failure.
*
* The mca_bmi_base_module_add_procs_fn_t() is called by the PML to
* determine the set of BMIs that should be used to reach each process.
* Any addressing information exported by the peer via the mca_base_modex_send()
* function should be available during this call via the corresponding
* mca_base_modex_recv() function. The BMI may utilize this information to
* determine reachability of each peer process.
*
* For each process that is reachable by the BMI, the bit corresponding to the index
* into the proc array (nprocs) should be set in the reachable bitmask. The PML
* provides the BMI the option to return a pointer to a data structure defined
* by the BMI that is returned to the BMI on subsequent calls to the BMI data
* transfer functions (e.g bmi_send). This may be used by the BMI to cache any addressing
* or connection information (e.g. TCP socket, IP queue pair).
*/
typedef int (*mca_bmi_base_module_add_procs_fn_t)(
struct mca_bmi_base_module_t* bmi,
size_t nprocs,
struct ompi_proc_t** procs,
struct mca_bmi_base_endpoint_t** endpoints,
struct ompi_bitmap_t* reachable
);
/**
* Notification of change to the process list.
*
* @param bmi (IN) BMI module
* @param nprocs (IN) Number of processes
* @param proc (IN) Set of processes
* @param peer (IN) Set of peer addressing information.
* @return Status indicating if cleanup was successful
*
* When the process list changes, the PML notifies the BMI of the
* change, to provide the opportunity to cleanup or release any
* resources associated with the peer.
*/
typedef int (*mca_bmi_base_module_del_procs_fn_t)(
struct mca_bmi_base_module_t* bmi,
size_t nprocs,
struct ompi_proc_t** procs,
struct mca_bmi_base_endpoint_t**
);
/**
* Callback function that is called asynchronously on receipt
* of data by the transport layer.
*/
typedef void (*mca_bmi_base_module_recv_cb_fn_t)(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_tag_t tag,
mca_bmi_base_descriptor_t* descriptor,
void* cbdata
);
/**
* Register a callback function that is called on receipt
* of a fragment.
*
* @param bmi (IN) BMI module
* @return Status indicating if cleanup was successful
*
* When the process list changes, the PML notifies the BMI of the
* change, to provide the opportunity to cleanup or release any
* resources associated with the peer.
*/
typedef int (*mca_bmi_base_module_register_fn_t)(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_tag_t tag,
mca_bmi_base_module_recv_cb_fn_t cbfunc,
void* cbdata
);
/**
* Allocate a descriptor with a segment of the requested size.
* Note that the BMI layer may choose to return a smaller size
* if it cannot support the request.
*
* @param bmi (IN) BMI module
* @param size (IN) Request segment size.
*/
typedef mca_bmi_base_descriptor_t* (*mca_bmi_base_module_alloc_fn_t)(
struct mca_bmi_base_module_t* bmi,
size_t size
);
/**
* Return a descriptor allocated from this BMI via alloc/prepare.
*
* @param bmi (IN) BMI module
* @param segment (IN) Descriptor allocated from the BMI
*/
typedef int (*mca_bmi_base_module_free_fn_t)(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_descriptor_t* descriptor
);
/**
* Prepare a descriptor for send/rdma using the supplied
* convertor. If the convertor references data that is contigous,
* the descriptor may simply point to the user buffer. Otherwise,
* this routine is responsible for allocating buffer space and
* packing if required.
*
* @param bmi (IN) BMI module
* @param endpoint (IN) BMI peer addressing
* @param convertor (IN) Data type convertor
* @param reserve (IN) Additional bytes requested by upper layer to precede user data
* @param size (IN/OUT) Number of bytes to prepare (IN), number of bytes actually prepared (OUT)
*/
typedef struct mca_bmi_base_descriptor_t* (*mca_bmi_base_module_prepare_fn_t)(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size
);
/**
* Initiate an asynchronous send.
*
* @param bmi (IN) BMI module
* @param endpoint (IN) BMI addressing information
* @param descriptor (IN) Description of the data to be transfered
* @param tag (IN) The tag value used to notify the peer.
*/
typedef int (*mca_bmi_base_module_send_fn_t)(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_descriptor_t* descriptor,
mca_bmi_base_tag_t tag
);
/**
* Initiate an asynchronous put.
*
* @param bmi (IN) BMI module
* @param endpoint (IN) BMI addressing information
* @param descriptor (IN) Description of the data to be transferred
*/
typedef int (*mca_bmi_base_module_put_fn_t)(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_descriptor_t* descriptor
);
/**
* Initiate an asynchronous get.
*
* @param bmi (IN) BMI module
* @param endpoint (IN) BMI addressing information
* @param descriptor (IN) Description of the data to be transferred
*
*/
typedef int (*mca_bmi_base_module_get_fn_t)(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_descriptor_t* descriptor
);
/**
* BMI module interface functions and attributes.
*/
struct mca_bmi_base_module_t {
/* BMI common attributes */
mca_bmi_base_component_t* bmi_component; /**< pointer back to the BMI component structure */
size_t bmi_eager_limit; /**< maximum size of first fragment -- eager send */
size_t bmi_min_send_size; /**< threshold below which the BMI should not fragment */
size_t bmi_max_send_size; /**< maximum send fragment size supported by the BMI */
size_t bmi_min_rdma_size; /**< threshold below which the BMI should not fragment */
size_t bmi_max_rdma_size; /**< maximum rdma fragment size supported by the BMI */
uint32_t bmi_exclusivity; /**< indicates this BMI should be used exclusively */
uint32_t bmi_latency; /**< relative ranking of latency used to prioritize bmis */
uint32_t bmi_bandwidth; /**< bandwidth (Mbytes/sec) supported by each endpoint */
uint32_t bmi_flags; /**< flags (put/get...) */
/* BMI function table */
mca_bmi_base_module_add_procs_fn_t bmi_add_procs;
mca_bmi_base_module_del_procs_fn_t bmi_del_procs;
mca_bmi_base_module_register_fn_t bmi_register;
mca_bmi_base_module_finalize_fn_t bmi_finalize;
mca_bmi_base_module_alloc_fn_t bmi_alloc;
mca_bmi_base_module_free_fn_t bmi_free;
mca_bmi_base_module_prepare_fn_t bmi_prepare_src;
mca_bmi_base_module_prepare_fn_t bmi_prepare_dst;
mca_bmi_base_module_send_fn_t bmi_send;
mca_bmi_base_module_put_fn_t bmi_put;
mca_bmi_base_module_get_fn_t bmi_get;
};
typedef struct mca_bmi_base_module_t mca_bmi_base_module_t;
/*
* Macro for use in modules that are of type bmi v1.0.0
*/
#define MCA_BMI_BASE_VERSION_1_0_0 \
/* coll v1.0 is chained to MCA v1.0 */ \
MCA_BASE_VERSION_1_0_0, \
/* bmi v1.0 */ \
"bmi", 1, 0, 0
#endif /* OMPI_MCA_BMI_H */

505
src/mca/btl/btl.h Обычный файл
Просмотреть файл

@ -0,0 +1,505 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* Bit Mover Interface (BTL)
*
*
* BTL Initialization:
*
* During library initialization, all available BTL components are
* loaded and opened via their mca_base_open_component_fn_t
* function. The BTL open function should register any mca parameters
* used to tune/adjust the behaviour of the BTL (mca_base_param_register_int(),
* mca_base_param_register_string()). Note that the open function may fail
* if the resources (e.g. shared libraries, etc) required by the network
* transport are not available.
*
* The mca_btl_base_component_init_fn_t() is then called for each of the
* components that are succesfully opened. The component init function may
* return either:
*
* (1) a NULL list of BTL modules if the transport is not available,
* (2) a list containing a single BTL module, where the BTL provides
* a layer of abstraction over multiple physical devices (e.g. NICs),
* (3) a list containing multiple BTL modules where each BTL module
* corresponds to a single physical device.
*
* During module initialization, the module should post any addressing
* information required by its peers. An example would be the TCP
* listen port opened by the TCP module for incoming connection
* requests. This information is published to peers via the
* mca_base_modex_send() interface. Note that peer information is not
* guaranteed to be available via mca_base_modex_recv() during the
* module's init function. However, it will be available during
* BTL selection (mca_btl_base_add_proc_fn_t()).
*
* BTL Selection:
*
* The upper layer builds an ordered list of the available BTL modules sorted
* by their exclusivity ranking. This is a relative ranking that is used
* to determine the set of BTLs that may be used to reach a given destination.
* During startup the BTL modules are queried via their
* mca_btl_base_add_proc_fn_t() to determine if they are able to reach
* a given destination. The BTL module with the highest ranking that
* returns success is selected. Subsequent BTL modules are selected only
* if they have the same exclusivity ranking.
*
* An example of how this might be used:
*
* BTL Exclusivity Comments
* -------- ----------- ------------------
* LO 100 Selected exclusively for local process
* SM 50 Selected exclusively for other processes on host
* IB 0 Selected based on network reachability
* IB 0 Selected based on network reachability
* TCP 0 Selected based on network reachability
* TCP 0 Selected based on network reachability
*
* When a BTL module is selected, it may choose to optionally return a
* pointer to an an mca_btl_base_endpoint_t data structure to the PML.
* This pointer is treated as an opaque handle by the PML and is
* returned to the BTL on subsequent data transfer calls to the
* corresponding destination process. The actual contents of the
* data structure are defined on a per BTL basis, and may be used to
* cache addressing or connection information, such as a TCP socket
* or IB queue pair.
*
* Progress:
*
* By default, the library provides for polling based progress of outstanding
* requests. The BTL component exports an interface function (btlm_progress)
* that is called in a polling mode by the PML during calls into the MPI
* library. Note that the btlm_progress() function is called on the BTL component
* rather than each BTL module. This implies that the BTL author is responsible
* for iterating over the pending operations in each of the BTL modules associated
* with the component.
*
* On platforms where threading support is provided, the library provides the
* option of building with asynchronous threaded progress. In this case, the BTL
* author is responsible for providing a thread to progress pending operations.
* A thread is associated with the BTL component/module such that transport specific
* functionality/APIs may be used to block the thread ubtll a pending operation
* completes. This thread MUST NOT poll for completion as this would oversubscribe
* the CPU.
*
* Note that in the threaded case the PML may choose to use a hybrid approach,
* such that polling is implemented from the user thread for a fixed number of
* cycles before relying on the background thread(s) to complete requests. If
* possible the BTL should support the use of both modes concurrebtly.
*
*/
#include "mca/mca.h"
#ifndef MCA_BTL_H
#define MCA_BTL_H
#include "include/types.h"
#include "class/ompi_free_list.h"
/*
* BTL types
*/
struct mca_btl_base_module_t;
struct mca_btl_base_endpoint_t;
struct mca_btl_base_descriptor_t;
struct mca_mpool_base_resources_t;
/* send/recv operations require tag matching */
typedef uint8_t mca_btl_base_tag_t;
/* reserved tag values */
#define MCA_BTL_TAG_BTL 0
#define MCA_BTL_TAG_PML 1
#define MCA_BTL_TAG_USR 2
/* prefered protocol */
#define MCA_BTL_FLAGS_SEND 1
#define MCA_BTL_FLAGS_RDMA 2
/**
* Asynchronous callback function on completion of an operation.
*/
typedef void (*mca_btl_base_completion_fn_t)(
struct mca_btl_base_module_t*,
struct mca_btl_base_endpoint_t*,
struct mca_btl_base_descriptor_t*,
int status);
/**
* Describes a region/segment of memory that is addressable
* by an BTL.
*/
struct mca_btl_base_segment_t {
ompi_ptr_t seg_addr;
uint32_t seg_len;
union {
uint32_t key32[2];
uint64_t key64;
uint8_t key8[8];
} seg_key;
};
typedef struct mca_btl_base_segment_t mca_btl_base_segment_t;
/**
* A descriptor that holds the parameters to a send/put/get
* operation along w/ a callback routine that is called on
* completion of the request.
*/
struct mca_btl_base_descriptor_t {
ompi_free_list_item_t super;
mca_btl_base_segment_t *des_src;
size_t des_src_cnt;
mca_btl_base_segment_t *des_dst;
size_t des_dst_cnt;
mca_btl_base_completion_fn_t des_cbfunc;
void* des_cbdata;
int32_t des_flags;
};
typedef struct mca_btl_base_descriptor_t mca_btl_base_descriptor_t;
OBJ_CLASS_DECLARATION(mca_btl_base_descriptor_t);
#define MCA_BTL_DES_FLAGS_DEREGISTER 0x0001
#define MCA_BTL_DES_FLAGS_PRIORITY 0x0002
/**
* Maximum number of allowed segments in src/dst fields of a descriptor.
*/
#define MCA_BTL_DES_MAX_SEGMENTS 16
/*
* BTL base header, stores the tag at a minimum
*/
struct mca_btl_base_header_t{
mca_btl_base_tag_t tag;
};
typedef struct mca_btl_base_header_t mca_btl_base_header_t;
/*
* BTL component interface functions and datatype.
*/
/**
* MCA->BTL Initializes the BTL component and creates specific BTL
* module(s).
*
* @param num_btls (OUT) Returns the number of btl modules created, or 0
* if the transport is not available.
*
* @param enable_progress_threads (IN) Whether this component is
* allowed to run a hidden/progress thread or not.
*
* @param enable_mpi_threads (IN) Whether support for multiple MPI
* threads is enabled or not (i.e., MPI_THREAD_MULTIPLE), which
* indicates whether multiple threads may invoke this component
* simultaneously or not.
*
* @return Array of pointers to BTL modules, or NULL if the transport
* is not available.
*
* During component initialization, the BTL component should discover
* the physical devices that are available for the given transport,
* and create a BTL module to represent each device. Any addressing
* information required by peers to reach the device should be published
* during this function via the mca_base_modex_send() interface.
*
*/
typedef struct mca_btl_base_module_t** (*mca_btl_base_component_init_fn_t)(
int *num_btls,
bool enable_progress_threads,
bool enable_mpi_threads
);
/**
* MCA->BTL Called to progress outstanding requests for
* non-threaded polling environments.
*
* @param tstamp Current time.
* @return OMPI_SUCCESS or error code on failure.
*/
typedef int (*mca_btl_base_component_progress_fn_t)(void);
/**
* BTL component descriptor. Contains component version information
* and component open/close/init functions.
*/
struct mca_btl_base_component_1_0_0_t {
mca_base_component_t btl_version;
mca_base_component_data_1_0_0_t btl_data;
mca_btl_base_component_init_fn_t btl_init;
mca_btl_base_component_progress_fn_t btl_progress;
};
typedef struct mca_btl_base_component_1_0_0_t mca_btl_base_component_1_0_0_t;
typedef struct mca_btl_base_component_1_0_0_t mca_btl_base_component_t;
/*
* BTL module interface functions and datatype.
*/
/**
* MCA->BTL Clean up any resources held by BTL module
* before the module is unloaded.
*
* @param btl (IN) BTL module.
*
* Prior to unloading a BTL module, the MCA framework will call
* the BTL finalize method of the module. Any resources held by
* the BTL should be released and if required the memory corresponding
* to the BTL module freed.
*
*/
typedef int (*mca_btl_base_module_finalize_fn_t)(
struct mca_btl_base_module_t* btl
);
/**
* PML->BTL notification of change in the process list.
*
* @param btl (IN) BTL module
* @param nprocs (IN) Number of processes
* @param procs (IN) Set of processes
* @param endpoint (OUT) Set of (optional) mca_btl_base_endpoint_t structures by BTL.
* @param reachable (OUT) Bitmask indicating set of peer processes that are reachable by this BTL.
* @return OMPI_SUCCESS or error status on failure.
*
* The mca_btl_base_module_add_procs_fn_t() is called by the PML to
* determine the set of BTLs that should be used to reach each process.
* Any addressing information exported by the peer via the mca_base_modex_send()
* function should be available during this call via the corresponding
* mca_base_modex_recv() function. The BTL may utilize this information to
* determine reachability of each peer process.
*
* For each process that is reachable by the BTL, the bit corresponding to the index
* into the proc array (nprocs) should be set in the reachable bitmask. The PML
* provides the BTL the option to return a pointer to a data structure defined
* by the BTL that is returned to the BTL on subsequent calls to the BTL data
* transfer functions (e.g btl_send). This may be used by the BTL to cache any addressing
* or connection information (e.g. TCP socket, IP queue pair).
*/
typedef int (*mca_btl_base_module_add_procs_fn_t)(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t** procs,
struct mca_btl_base_endpoint_t** endpoints,
struct ompi_bitmap_t* reachable
);
/**
* Notification of change to the process list.
*
* @param btl (IN) BTL module
* @param nprocs (IN) Number of processes
* @param proc (IN) Set of processes
* @param peer (IN) Set of peer addressing information.
* @return Status indicating if cleanup was successful
*
* When the process list changes, the PML notifies the BTL of the
* change, to provide the opportunity to cleanup or release any
* resources associated with the peer.
*/
typedef int (*mca_btl_base_module_del_procs_fn_t)(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t** procs,
struct mca_btl_base_endpoint_t**
);
/**
* Callback function that is called asynchronously on receipt
* of data by the transport layer.
*/
typedef void (*mca_btl_base_module_recv_cb_fn_t)(
struct mca_btl_base_module_t* btl,
mca_btl_base_tag_t tag,
mca_btl_base_descriptor_t* descriptor,
void* cbdata
);
/**
* Register a callback function that is called on receipt
* of a fragment.
*
* @param btl (IN) BTL module
* @return Status indicating if cleanup was successful
*
* When the process list changes, the PML notifies the BTL of the
* change, to provide the opportunity to cleanup or release any
* resources associated with the peer.
*/
typedef int (*mca_btl_base_module_register_fn_t)(
struct mca_btl_base_module_t* btl,
mca_btl_base_tag_t tag,
mca_btl_base_module_recv_cb_fn_t cbfunc,
void* cbdata
);
/**
* Allocate a descriptor with a segment of the requested size.
* Note that the BTL layer may choose to return a smaller size
* if it cannot support the request.
*
* @param btl (IN) BTL module
* @param size (IN) Request segment size.
*/
typedef mca_btl_base_descriptor_t* (*mca_btl_base_module_alloc_fn_t)(
struct mca_btl_base_module_t* btl,
size_t size
);
/**
* Return a descriptor allocated from this BTL via alloc/prepare.
*
* @param btl (IN) BTL module
* @param segment (IN) Descriptor allocated from the BTL
*/
typedef int (*mca_btl_base_module_free_fn_t)(
struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* descriptor
);
/**
* Prepare a descriptor for send/rdma using the supplied
* convertor. If the convertor references data that is contigous,
* the descriptor may simply point to the user buffer. Otherwise,
* this routine is responsible for allocating buffer space and
* packing if required.
*
* @param btl (IN) BTL module
* @param endpoint (IN) BTL peer addressing
* @param convertor (IN) Data type convertor
* @param reserve (IN) Additional bytes requested by upper layer to precede user data
* @param size (IN/OUT) Number of bytes to prepare (IN), number of bytes actually prepared (OUT)
*/
typedef struct mca_btl_base_descriptor_t* (*mca_btl_base_module_prepare_fn_t)(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* endpoint,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size
);
/**
* Initiate an asynchronous send.
*
* @param btl (IN) BTL module
* @param endpoint (IN) BTL addressing information
* @param descriptor (IN) Description of the data to be transfered
* @param tag (IN) The tag value used to notify the peer.
*/
typedef int (*mca_btl_base_module_send_fn_t)(
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
);
/**
* Initiate an asynchronous put.
*
* @param btl (IN) BTL module
* @param endpoint (IN) BTL addressing information
* @param descriptor (IN) Description of the data to be transferred
*/
typedef int (*mca_btl_base_module_put_fn_t)(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* endpoint,
struct mca_btl_base_descriptor_t* descriptor
);
/**
* Initiate an asynchronous get.
*
* @param btl (IN) BTL module
* @param endpoint (IN) BTL addressing information
* @param descriptor (IN) Description of the data to be transferred
*
*/
typedef int (*mca_btl_base_module_get_fn_t)(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* endpoint,
struct mca_btl_base_descriptor_t* descriptor
);
/**
* BTL module interface functions and attributes.
*/
struct mca_btl_base_module_t {
/* BTL common attributes */
mca_btl_base_component_t* btl_component; /**< pointer back to the BTL component structure */
size_t btl_eager_limit; /**< maximum size of first fragment -- eager send */
size_t btl_min_send_size; /**< threshold below which the BTL should not fragment */
size_t btl_max_send_size; /**< maximum send fragment size supported by the BTL */
size_t btl_min_rdma_size; /**< threshold below which the BTL should not fragment */
size_t btl_max_rdma_size; /**< maximum rdma fragment size supported by the BTL */
uint32_t btl_exclusivity; /**< indicates this BTL should be used exclusively */
uint32_t btl_latency; /**< relative ranking of latency used to prioritize btls */
uint32_t btl_bandwidth; /**< bandwidth (Mbytes/sec) supported by each endpoint */
uint32_t btl_flags; /**< flags (put/get...) */
/* BTL function table */
mca_btl_base_module_add_procs_fn_t btl_add_procs;
mca_btl_base_module_del_procs_fn_t btl_del_procs;
mca_btl_base_module_register_fn_t btl_register;
mca_btl_base_module_finalize_fn_t btl_finalize;
mca_btl_base_module_alloc_fn_t btl_alloc;
mca_btl_base_module_free_fn_t btl_free;
mca_btl_base_module_prepare_fn_t btl_prepare_src;
mca_btl_base_module_prepare_fn_t btl_prepare_dst;
mca_btl_base_module_send_fn_t btl_send;
mca_btl_base_module_put_fn_t btl_put;
mca_btl_base_module_get_fn_t btl_get;
};
typedef struct mca_btl_base_module_t mca_btl_base_module_t;
/*
* Macro for use in modules that are of type btl v1.0.0
*/
#define MCA_BTL_BASE_VERSION_1_0_0 \
/* coll v1.0 is chained to MCA v1.0 */ \
MCA_BASE_VERSION_1_0_0, \
/* btl v1.0 */ \
"btl", 1, 0, 0
#endif /* OMPI_MCA_BTL_H */

Просмотреть файл

Просмотреть файл

@ -1,3 +0,0 @@
ompi
twoodall
gshipman

Просмотреть файл

@ -1,56 +0,0 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# 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.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Use the top-level Makefile.options
include $(top_ompi_srcdir)/config/Makefile.options
sources = \
bmi_ib.c \
bmi_ib.h \
bmi_ib_component.c \
bmi_ib_endpoint.c \
bmi_ib_endpoint.h \
bmi_ib_frag.c \
bmi_ib_frag.h \
bmi_ib_proc.c \
bmi_ib_proc.h \
bmi_ib_error.h
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if OMPI_BUILD_bmi_ib_DSO
lib =
lib_sources =
component = mca_bmi_ib.la
component_sources = $(sources)
else
lib = libmca_bmi_ib.la
lib_sources = $(sources)
component =
component_sources =
endif
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component)
mca_bmi_ib_la_SOURCES = $(component_sources)
mca_bmi_ib_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(lib)
libmca_bmi_ib_la_SOURCES = $(lib_sources)
libmca_bmi_ib_la_LDFLAGS = -module -avoid-version

Просмотреть файл

@ -1,832 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <string.h>
#include "util/output.h"
#include "util/if.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "bmi_ib.h"
#include "bmi_ib_frag.h"
#include "bmi_ib_proc.h"
#include "bmi_ib_endpoint.h"
#include "datatype/convertor.h"
#include "mca/common/vapi/vapi_mem_reg.h"
#include "mca/mpool/base/base.h"
#include "mca/mpool/mpool.h"
#include "mca/mpool/vapi/mpool_vapi.h"
mca_bmi_ib_module_t mca_bmi_ib_module = {
{
&mca_bmi_ib_component.super,
0, /* max size of first fragment */
0, /* min send fragment size */
0, /* max send fragment size */
0, /* min rdma fragment size */
0, /* max rdma fragment size */
0, /* exclusivity */
0, /* latency */
0, /* bandwidth */
0, /* TODO this should be PUT bmi flags */
mca_bmi_ib_add_procs,
mca_bmi_ib_del_procs,
mca_bmi_ib_register,
mca_bmi_ib_finalize,
/* we need alloc free, pack */
mca_bmi_ib_alloc,
mca_bmi_ib_free,
mca_bmi_ib_prepare_src,
mca_bmi_ib_prepare_dst,
mca_bmi_ib_send,
mca_bmi_ib_put,
NULL /* get */
}
};
int mca_bmi_ib_add_procs(
struct mca_bmi_base_module_t* bmi,
size_t nprocs,
struct ompi_proc_t **ompi_procs,
struct mca_bmi_base_endpoint_t** peers,
ompi_bitmap_t* reachable)
{
mca_bmi_ib_module_t* ib_bmi = (mca_bmi_ib_module_t*)bmi;
int i, rc;
for(i = 0; i < (int) nprocs; i++) {
struct ompi_proc_t* ompi_proc = ompi_procs[i];
mca_bmi_ib_proc_t* ib_proc;
mca_bmi_base_endpoint_t* ib_peer;
if(NULL == (ib_proc = mca_bmi_ib_proc_create(ompi_proc))) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
/*
* Check to make sure that the peer has at least as many interface
* addresses exported as we are trying to use. If not, then
* don't bind this PTL instance to the proc.
*/
OMPI_THREAD_LOCK(&ib_proc->proc_lock);
/* The bmi_proc datastructure is shared by all IB PTL
* instances that are trying to reach this destination.
* Cache the peer instance on the bmi_proc.
*/
ib_peer = OBJ_NEW(mca_bmi_ib_endpoint_t);
if(NULL == ib_peer) {
OMPI_THREAD_UNLOCK(&module_proc->proc_lock);
return OMPI_ERR_OUT_OF_RESOURCE;
}
ib_peer->endpoint_bmi = ib_bmi;
rc = mca_bmi_ib_proc_insert(ib_proc, ib_peer);
if(rc != OMPI_SUCCESS) {
OBJ_RELEASE(ib_peer);
OMPI_THREAD_UNLOCK(&module_proc->proc_lock);
continue;
}
ompi_bitmap_set_bit(reachable, i);
OMPI_THREAD_UNLOCK(&module_proc->proc_lock);
peers[i] = ib_peer;
}
return OMPI_SUCCESS;
}
int mca_bmi_ib_del_procs(struct mca_bmi_base_module_t* bmi,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t ** peers)
{
/* Stub */
DEBUG_OUT("Stub\n");
return OMPI_SUCCESS;
}
int mca_bmi_ib_register(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_tag_t tag,
mca_bmi_base_module_recv_cb_fn_t cbfunc,
void* cbdata)
{
/* TODO add register stuff here... */
mca_bmi_ib_module_t* ib_bmi = (mca_bmi_ib_module_t*) bmi;
OMPI_THREAD_LOCK(&ib->bmi.ib_lock);
ib_bmi->ib_reg[tag].cbfunc = cbfunc;
ib_bmi->ib_reg[tag].cbdata = cbdata;
OMPI_THREAD_UNLOCK(&ib->bmi.ib_lock);
return OMPI_SUCCESS;
}
/**
* Allocate a segment.
*
* @param bmi (IN) BMI module
* @param size (IN) Request segment size.
*/
mca_bmi_base_descriptor_t* mca_bmi_ib_alloc(
struct mca_bmi_base_module_t* bmi,
size_t size)
{
mca_bmi_ib_frag_t* frag;
mca_bmi_ib_module_t* ib_bmi;
int rc;
ib_bmi = (mca_bmi_ib_module_t*) bmi;
if(size <= mca_bmi_ib_component.eager_limit){
MCA_BMI_IB_FRAG_ALLOC_EAGER(bmi, frag, rc);
frag->segment.seg_len =
size <= mca_bmi_ib_component.eager_limit ?
size: mca_bmi_ib_component.eager_limit ;
} else {
MCA_BMI_IB_FRAG_ALLOC_MAX(bmi, frag, rc);
frag->segment.seg_len =
size <= mca_bmi_ib_component.max_send_size ?
size: mca_bmi_ib_component.max_send_size ;
}
frag->segment.seg_len = size <= ib_bmi->super.bmi_eager_limit ? size : ib_bmi->super.bmi_eager_limit;
frag->base.des_flags = 0;
return (mca_bmi_base_descriptor_t*)frag;
}
/**
*
*
*/
int mca_bmi_ib_free(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_descriptor_t* des)
{
mca_bmi_ib_frag_t* frag = (mca_bmi_ib_frag_t*)des;
if(frag->size == 0) {
MCA_BMI_IB_FRAG_RETURN_FRAG(bmi, frag);
OBJ_RELEASE(frag->vapi_reg);
}
else if(frag->size == mca_bmi_ib_component.max_send_size){
MCA_BMI_IB_FRAG_RETURN_MAX(bmi, frag);
} else if(frag->size == mca_bmi_ib_component.eager_limit){
MCA_BMI_IB_FRAG_RETURN_EAGER(bmi, frag);
}
return OMPI_SUCCESS;
}
/**
* Pack data and return a descriptor that can be
* used for send/put.
*
* @param bmi (IN) BMI module
* @param peer (IN) BMI peer addressing
*/
mca_bmi_base_descriptor_t* mca_bmi_ib_prepare_src(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size
)
{
mca_bmi_ib_module_t* ib_bmi;
mca_bmi_ib_frag_t* frag;
mca_mpool_vapi_registration_t * vapi_reg;
struct iovec iov;
int32_t iov_count = 1;
size_t max_data = *size;
int32_t free_after;
int rc;
ib_bmi = (mca_bmi_ib_module_t*) bmi;
vapi_reg = (mca_mpool_vapi_registration_t*) registration;
/** if the data fits in the eager limit and we aren't told to pinn then we
simply pack, if the data fits in the eager limit and the data is non contiguous
then we pack **/
if(NULL != vapi_reg && 0 == ompi_convertor_need_buffers(convertor)){
bool is_leave_pinned = vapi_reg->is_leave_pinned;
MCA_BMI_IB_FRAG_ALLOC_FRAG(bmi, frag, rc);
if(NULL == frag){
return NULL;
}
iov.iov_len = max_data;
iov.iov_base = NULL;
ompi_convertor_pack(convertor, &iov, &iov_count, &max_data, &free_after);
/* first we will try to find this address in the memory tree (from MPI_Alloc_mem) */
frag->segment.seg_len = max_data;
frag->segment.seg_addr.pval = iov.iov_base;
size_t reg_len;
reg_len = (unsigned char*)vapi_reg->bound - (unsigned char*)iov.iov_base + 1;
if(frag->segment.seg_len > reg_len) {
size_t new_len = vapi_reg->bound - vapi_reg->base + 1
+ frag->segment.seg_len - reg_len;
void * base_addr = vapi_reg->base;
rc = mca_mpool_base_remove((void*) vapi_reg->base);
if(OMPI_SUCCESS != rc) {
ompi_output(0, "%s:%d:%s error removing memory region from memory pool tree", __FILE__, __LINE__, __func__);
return NULL;
}
if(is_leave_pinned) {
if(NULL == ompi_list_remove_item(&ib_bmi->reg_mru_list, (ompi_list_item_t*) vapi_reg)){
ompi_output(0,"%s:%d:%s error removing item from reg_mru_list", __FILE__, __LINE__, __func__);
return NULL;
}
}
OBJ_RELEASE(vapi_reg);
ib_bmi->ib_pool->mpool_register(ib_bmi->ib_pool,
base_addr,
new_len,
(mca_mpool_base_registration_t**) &vapi_reg);
rc = mca_mpool_base_insert(vapi_reg->base,
vapi_reg->bound - vapi_reg->base + 1,
ib_bmi->ib_pool,
(void*) (&ib_bmi->super),
(mca_mpool_base_registration_t*) vapi_reg);
if(rc != OMPI_SUCCESS) {
ompi_output(0,"%s:%d:%s error inserting memory region into memory pool tree", __FILE__, __LINE__, __func__);
return NULL;
}
OBJ_RETAIN(vapi_reg);
if(is_leave_pinned) {
vapi_reg->is_leave_pinned = is_leave_pinned;
ompi_list_append(&ib_bmi->reg_mru_list, (ompi_list_item_t*) vapi_reg);
}
}
else if(is_leave_pinned) {
if(NULL == ompi_list_remove_item(&ib_bmi->reg_mru_list, (ompi_list_item_t*) vapi_reg)) {
ompi_output(0,"%s:%d:%s error removing item from reg_mru_list", __FILE__, __LINE__, __func__);
return NULL;
}
ompi_list_append(&ib_bmi->reg_mru_list, (ompi_list_item_t*) vapi_reg);
}
frag->mem_hndl = vapi_reg->hndl;
frag->sg_entry.len = max_data;
frag->sg_entry.lkey = vapi_reg->l_key;
frag->sg_entry.addr = (VAPI_virt_addr_t) (MT_virt_addr_t) iov.iov_base;
frag->segment.seg_key.key32[0] = (uint32_t) vapi_reg->l_key;
frag->base.des_src = &frag->segment;
frag->base.des_src_cnt = 1;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->base.des_flags = 0;
frag->vapi_reg = vapi_reg;
OBJ_RETAIN(vapi_reg);
return &frag->base;
} else if((mca_bmi_ib_component.leave_pinned || max_data > bmi->bmi_max_send_size) &&
ompi_convertor_need_buffers(convertor) == 0 &&
reserve == 0)
{
MCA_BMI_IB_FRAG_ALLOC_FRAG(bmi, frag, rc);
if(NULL == frag){
return NULL;
}
iov.iov_len = max_data;
iov.iov_base = NULL;
ompi_convertor_pack(convertor, &iov, &iov_count, &max_data, &free_after);
frag->segment.seg_len = max_data;
frag->segment.seg_addr.pval = iov.iov_base;
frag->base.des_flags = 0;
if(mca_bmi_ib_component.leave_pinned) {
if(mca_bmi_ib_component.reg_mru_len <= ib_bmi->reg_mru_list.ompi_list_length ) {
mca_mpool_vapi_registration_t* old_reg =
(mca_mpool_vapi_registration_t*)
ompi_list_remove_last(&ib_bmi->reg_mru_list);
if( NULL == old_reg) {
ompi_output(0,"%s:%d:%s error removing item from reg_mru_list", __FILE__, __LINE__, __func__);
return NULL;
}
rc = mca_mpool_base_remove((void*) old_reg->base);
if(OMPI_SUCCESS != rc) {
ompi_output(0,"%s:%d:%s error removing memory region from memory pool tree", __FILE__, __LINE__, __func__);
return NULL;
}
OBJ_RELEASE(old_reg);
}
ib_bmi->ib_pool->mpool_register(ib_bmi->ib_pool,
iov.iov_base,
max_data,
(mca_mpool_base_registration_t**) &vapi_reg);
rc = mca_mpool_base_insert(vapi_reg->base,
vapi_reg->bound - vapi_reg->base + 1,
ib_bmi->ib_pool,
(void*) (&ib_bmi->super),
(mca_mpool_base_registration_t*) vapi_reg);
if(rc != OMPI_SUCCESS)
return NULL;
OBJ_RETAIN(vapi_reg);
vapi_reg->is_leave_pinned = true;
ompi_list_append(&ib_bmi->reg_mru_list, (ompi_list_item_t*) vapi_reg);
} else {
ib_bmi->ib_pool->mpool_register(ib_bmi->ib_pool,
iov.iov_base,
max_data,
(mca_mpool_base_registration_t**) &vapi_reg);
vapi_reg->is_leave_pinned = false;
}
frag->mem_hndl = vapi_reg->hndl;
frag->sg_entry.len = max_data;
frag->sg_entry.lkey = vapi_reg->l_key;
frag->sg_entry.addr = (VAPI_virt_addr_t) (MT_virt_addr_t) iov.iov_base;
frag->segment.seg_key.key32[0] = (uint32_t) vapi_reg->l_key;
frag->base.des_src = &frag->segment;
frag->base.des_src_cnt = 1;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->vapi_reg = vapi_reg;
OBJ_RETAIN(vapi_reg);
return &frag->base;
} else if (max_data+reserve <= bmi->bmi_eager_limit) {
MCA_BMI_IB_FRAG_ALLOC_EAGER(bmi, frag, rc);
if(NULL == frag) {
return NULL;
}
iov.iov_len = max_data;
iov.iov_base = frag->segment.seg_addr.pval + reserve;
rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data, &free_after);
*size = max_data;
if( rc < 0 ) {
MCA_BMI_IB_FRAG_RETURN_EAGER(bmi, frag);
return NULL;
}
frag->segment.seg_len = max_data + reserve;
frag->segment.seg_key.key32[0] = (uint32_t) frag->sg_entry.lkey;
frag->base.des_src = &frag->segment;
frag->base.des_src_cnt = 1;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->base.des_flags = 0;
return &frag->base;
}
/** if the data fits in the max limit and we aren't told to pinn then we
simply pack, if the data is non contiguous then we pack **/
else if(max_data + reserve <= ib_bmi->super.bmi_max_send_size) {
MCA_BMI_IB_FRAG_ALLOC_MAX(bmi, frag, rc);
if(NULL == frag) {
return NULL;
}
if(max_data + reserve > frag->size){
max_data = frag->size - reserve;
}
iov.iov_len = max_data;
iov.iov_base = (unsigned char*) frag->segment.seg_addr.pval + reserve;
rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data, &free_after);
*size = max_data;
if( rc < 0 ) {
MCA_BMI_IB_FRAG_RETURN_MAX(bmi, frag);
return NULL;
}
frag->segment.seg_len = max_data + reserve;
frag->segment.seg_key.key32[0] = (uint32_t) frag->sg_entry.lkey;
frag->base.des_src = &frag->segment;
frag->base.des_src_cnt = 1;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->base.des_flags=0;
return &frag->base;
}
return NULL;
}
/**
* Pack data
*
* @param bmi (IN) BMI module
* @param peer (IN) BMI peer addressing
*/
mca_bmi_base_descriptor_t* mca_bmi_ib_prepare_dst(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size)
{
mca_bmi_ib_module_t* ib_bmi;
mca_bmi_ib_frag_t* frag;
mca_mpool_vapi_registration_t * vapi_reg;
int rc;
size_t reg_len;
ib_bmi = (mca_bmi_ib_module_t*) bmi;
vapi_reg = (mca_mpool_vapi_registration_t*) registration;
MCA_BMI_IB_FRAG_ALLOC_FRAG(bmi, frag, rc);
if(NULL == frag){
return NULL;
}
frag->segment.seg_len = *size;
frag->segment.seg_addr.pval = convertor->pBaseBuf + convertor->bConverted;
frag->base.des_flags = 0;
if(NULL!= vapi_reg){
reg_len = (unsigned char*)vapi_reg->bound - (unsigned char*)frag->segment.seg_addr.pval + 1;
bool is_leave_pinned = vapi_reg->is_leave_pinned;
if(frag->segment.seg_len > reg_len ) {
size_t new_len = vapi_reg->bound - vapi_reg->base + 1
+ frag->segment.seg_len - reg_len;
void * base_addr = vapi_reg->base;
rc = mca_mpool_base_remove((void*) vapi_reg->base);
if(OMPI_SUCCESS != rc) {
ompi_output(0,"%s:%d:%s error removing memory region from memory pool tree", __FILE__, __LINE__, __func__);
return NULL;
}
if(is_leave_pinned) {
if(NULL == ompi_list_remove_item(&ib_bmi->reg_mru_list, (ompi_list_item_t*) vapi_reg)) {
ompi_output(0,"%s:%d:%s error removing item from reg_mru_list", __FILE__, __LINE__, __func__);
return NULL;
}
}
OBJ_RELEASE(vapi_reg);
ib_bmi->ib_pool->mpool_register(ib_bmi->ib_pool,
base_addr,
new_len,
(mca_mpool_base_registration_t**) &vapi_reg);
rc = mca_mpool_base_insert(vapi_reg->base,
vapi_reg->bound - vapi_reg->base + 1,
ib_bmi->ib_pool,
(void*) (&ib_bmi->super),
(mca_mpool_base_registration_t*) vapi_reg);
if(OMPI_SUCCESS != rc) {
ompi_output(0,"%s:%d:%s error inserting memory region into memory pool tree", __FILE__, __LINE__, __func__);
return NULL;
}
OBJ_RETAIN(vapi_reg);
if(is_leave_pinned) {
vapi_reg->is_leave_pinned = is_leave_pinned;
ompi_list_append(&ib_bmi->reg_mru_list, (ompi_list_item_t*) vapi_reg);
}
}
else if(is_leave_pinned){
if(NULL == ompi_list_remove_item(&ib_bmi->reg_mru_list, (ompi_list_item_t*) vapi_reg)) {
ompi_output(0,"%s:%d:%s error removing item from reg_mru_list", __FILE__, __LINE__, __func__);
return NULL;
}
ompi_list_append(&ib_bmi->reg_mru_list, (ompi_list_item_t*) vapi_reg);
}
} else {
if(mca_bmi_ib_component.leave_pinned) {
if( mca_bmi_ib_component.reg_mru_len <= ib_bmi->reg_mru_list.ompi_list_length ) {
mca_mpool_vapi_registration_t* old_reg =
(mca_mpool_vapi_registration_t*)
ompi_list_remove_last(&ib_bmi->reg_mru_list);
if( NULL == old_reg) {
ompi_output(0,"%s:%d:%s error removing item from reg_mru_list", __FILE__, __LINE__, __func__);
return NULL;
}
rc = mca_mpool_base_remove((void*) old_reg->base);
if(OMPI_SUCCESS !=rc ) {
ompi_output(0,"%s:%d:%s error removing memory region from memory pool tree", __FILE__, __LINE__, __func__);
return NULL;
}
OBJ_RELEASE(old_reg);
}
ib_bmi->ib_pool->mpool_register(ib_bmi->ib_pool,
frag->segment.seg_addr.pval,
*size,
(mca_mpool_base_registration_t**) &vapi_reg);
vapi_reg->is_leave_pinned = true;
rc = mca_mpool_base_insert(vapi_reg->base,
vapi_reg->bound - vapi_reg->base + 1,
ib_bmi->ib_pool,
(void*) (&ib_bmi->super),
(mca_mpool_base_registration_t*) vapi_reg);
if(OMPI_SUCCESS != rc){
ompi_output(0,"%s:%d:%s error inserting memory region into memory pool", __FILE__, __LINE__, __func__);
return NULL;
}
OBJ_RETAIN(vapi_reg);
ompi_list_append(&ib_bmi->reg_mru_list, (ompi_list_item_t*) vapi_reg);
} else {
ib_bmi->ib_pool->mpool_register(ib_bmi->ib_pool,
frag->segment.seg_addr.pval,
*size,
(mca_mpool_base_registration_t**) &vapi_reg);
vapi_reg->is_leave_pinned=false;
}
}
frag->mem_hndl = vapi_reg->hndl;
frag->sg_entry.len = *size;
frag->sg_entry.lkey = vapi_reg->l_key;
frag->sg_entry.addr = (VAPI_virt_addr_t) (MT_virt_addr_t) frag->segment.seg_addr.pval;
frag->segment.seg_key.key32[0] = (uint32_t) vapi_reg->l_key;
frag->base.des_dst = &frag->segment;
frag->base.des_dst_cnt = 1;
frag->base.des_src = NULL;
frag->base.des_src_cnt = 0;
frag->vapi_reg = vapi_reg;
OBJ_RETAIN(vapi_reg);
return &frag->base;
}
int mca_bmi_ib_finalize(struct mca_bmi_base_module_t* bmi)
{
mca_bmi_ib_module_t* ib_bmi;
ib_bmi = (mca_bmi_ib_module_t*) bmi;
if(ib_bmi->send_free_eager.fl_num_allocated !=
ib_bmi->send_free_eager.super.ompi_list_length){
ompi_output(0, "bmi ib send_free_eager frags: %d allocated %d returned \n",
ib_bmi->send_free_eager.fl_num_allocated,
ib_bmi->send_free_eager.super.ompi_list_length);
}
if(ib_bmi->send_free_max.fl_num_allocated !=
ib_bmi->send_free_max.super.ompi_list_length){
ompi_output(0, "bmi ib send_free_max frags: %d allocated %d returned \n",
ib_bmi->send_free_max.fl_num_allocated,
ib_bmi->send_free_max.super.ompi_list_length);
}
if(ib_bmi->send_free_frag.fl_num_allocated !=
ib_bmi->send_free_frag.super.ompi_list_length){
ompi_output(0, "bmi ib send_free_frag frags: %d allocated %d returned \n",
ib_bmi->send_free_frag.fl_num_allocated,
ib_bmi->send_free_frag.super.ompi_list_length);
}
if(ib_bmi->recv_free_eager.fl_num_allocated !=
ib_bmi->recv_free_eager.super.ompi_list_length){
ompi_output(0, "bmi ib recv_free_eager frags: %d allocated %d returned \n",
ib_bmi->recv_free_eager.fl_num_allocated,
ib_bmi->recv_free_eager.super.ompi_list_length);
}
if(ib_bmi->recv_free_max.fl_num_allocated !=
ib_bmi->recv_free_max.super.ompi_list_length){
ompi_output(0, "bmi ib recv_free_max frags: %d allocated %d returned \n",
ib_bmi->recv_free_max.fl_num_allocated,
ib_bmi->recv_free_max.super.ompi_list_length);
}
return OMPI_SUCCESS;
}
/*
* Initiate a send. If this is the first fragment, use the fragment
* descriptor allocated with the send requests, otherwise obtain
* one from the free list. Initialize the fragment and foward
* on to the peer.
*/
int mca_bmi_ib_send(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_descriptor_t* descriptor,
mca_bmi_base_tag_t tag)
{
mca_bmi_ib_frag_t* frag = (mca_bmi_ib_frag_t*)descriptor;
frag->endpoint = endpoint;
frag->hdr->tag = tag;
frag->type = MCA_BMI_IB_FRAG_SEND;
frag->rc = mca_bmi_ib_endpoint_send(endpoint, frag);
return frag->rc;
}
/*
* RDMA local buffer to remote buffer address.
*/
int mca_bmi_ib_put( mca_bmi_base_module_t* bmi,
mca_bmi_base_endpoint_t* endpoint,
mca_bmi_base_descriptor_t* descriptor)
{
mca_bmi_ib_module_t* ib_bmi = (mca_bmi_ib_module_t*) bmi;
mca_bmi_ib_frag_t* frag = (mca_bmi_ib_frag_t*) descriptor;
frag->endpoint = endpoint;
frag->sr_desc.opcode = VAPI_RDMA_WRITE;
frag->sr_desc.remote_qp = endpoint->rem_qp_num_low;
frag->sr_desc.remote_addr = (VAPI_virt_addr_t) (MT_virt_addr_t) frag->base.des_dst->seg_addr.pval;
frag->sr_desc.r_key = frag->base.des_dst->seg_key.key32[0];
frag->sg_entry.addr = (VAPI_virt_addr_t) (MT_virt_addr_t) frag->base.des_src->seg_addr.pval;
frag->sg_entry.len = frag->base.des_src->seg_len;
frag->ret = VAPI_post_sr(ib_bmi->nic,
endpoint->lcl_qp_hndl_low,
&frag->sr_desc);
if(VAPI_OK != frag->ret){
return OMPI_ERROR;
}
mca_bmi_ib_endpoint_post_rr(endpoint, 1);
return OMPI_SUCCESS;
}
/*
* Asynchronous event handler to detect unforseen
* events. Usually, such events are catastrophic.
* Should have a robust mechanism to handle these
* events and abort the OMPI application if necessary.
*
*/
static void async_event_handler(VAPI_hca_hndl_t hca_hndl,
VAPI_event_record_t * event_p,
void *priv_data)
{
switch (event_p->type) {
case VAPI_QP_PATH_MIGRATED:
case VAPI_EEC_PATH_MIGRATED:
case VAPI_QP_COMM_ESTABLISHED:
case VAPI_EEC_COMM_ESTABLISHED:
case VAPI_SEND_QUEUE_DRAINED:
case VAPI_PORT_ACTIVE:
{
DEBUG_OUT("Got an asynchronous event: %s\n",
VAPI_event_record_sym(event_p->type));
break;
}
case VAPI_CQ_ERROR:
case VAPI_LOCAL_WQ_INV_REQUEST_ERROR:
case VAPI_LOCAL_WQ_ACCESS_VIOL_ERROR:
case VAPI_LOCAL_WQ_CATASTROPHIC_ERROR:
case VAPI_PATH_MIG_REQ_ERROR:
case VAPI_LOCAL_EEC_CATASTROPHIC_ERROR:
case VAPI_LOCAL_CATASTROPHIC_ERROR:
case VAPI_PORT_ERROR:
{
ompi_output(0, "Got an asynchronous event: %s (%s)",
VAPI_event_record_sym(event_p->type),
VAPI_event_syndrome_sym(event_p->
syndrome));
break;
}
default:
ompi_output(0, "Warning!! Got an undefined "
"asynchronous event\n");
}
}
int mca_bmi_ib_module_init(mca_bmi_ib_module_t *ib_bmi)
{
/* Allocate Protection Domain */
VAPI_ret_t ret;
uint32_t cqe_cnt = 0;
ret = VAPI_alloc_pd(ib_bmi->nic, &ib_bmi->ptag);
if(ret != VAPI_OK) {
MCA_BMI_IB_VAPI_ERROR(ret, "VAPI_alloc_pd");
return OMPI_ERROR;
}
ret = VAPI_create_cq(ib_bmi->nic, ib_bmi->ib_cq_size,
&ib_bmi->cq_hndl_low, &cqe_cnt);
if( VAPI_OK != ret) {
MCA_BMI_IB_VAPI_ERROR(ret, "VAPI_create_cq");
return OMPI_ERROR;
}
ret = VAPI_create_cq(ib_bmi->nic, ib_bmi->ib_cq_size,
&ib_bmi->cq_hndl_high, &cqe_cnt);
if( VAPI_OK != ret) {
MCA_BMI_IB_VAPI_ERROR(ret, "VAPI_create_cq");
return OMPI_ERROR;
}
if(cqe_cnt <= 0) {
ompi_output(0, "%s: error creating completion queue ", __func__);
return OMPI_ERROR;
}
ret = EVAPI_set_async_event_handler(ib_bmi->nic,
async_event_handler, 0, &ib_bmi->async_handler);
if(VAPI_OK != ret) {
MCA_BMI_IB_VAPI_ERROR(ret, "EVAPI_set_async_event_handler");
return OMPI_ERROR;
}
return OMPI_SUCCESS;
}

Просмотреть файл

@ -1,386 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*/
#ifndef MCA_PTL_IB_H
#define MCA_PTL_IB_H
/* Standard system includes */
#include <sys/types.h>
#include <string.h>
/* Open MPI includes */
#include "class/ompi_free_list.h"
#include "class/ompi_bitmap.h"
#include "event/event.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "util/output.h"
#include "mca/mpool/mpool.h"
#include "bmi_ib_error.h"
#include "mca/bmi/bmi.h"
#include "mca/bmi/base/base.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
#define MCA_BMI_IB_LEAVE_PINNED 1
/**
* Infiniband (IB) BMI component.
*/
struct mca_bmi_ib_component_t {
mca_bmi_base_component_1_0_0_t super; /**< base BMI component */
uint32_t ib_num_bmis;
/**< number of hcas available to the IB component */
struct mca_bmi_ib_module_t *ib_bmis;
/**< array of available PTLs */
int ib_free_list_num;
/**< initial size of free lists */
int ib_free_list_max;
/**< maximum size of free lists */
int ib_free_list_inc;
/**< number of elements to alloc when growing free lists */
ompi_list_t ib_procs;
/**< list of ib proc structures */
ompi_event_t ib_send_event;
/**< event structure for sends */
ompi_event_t ib_recv_event;
/**< event structure for recvs */
ompi_mutex_t ib_lock;
/**< lock for accessing module state */
int ib_mem_registry_hints_log_size;
/**< log2 size of hints hash array used by memory registry */
char* ib_mpool_name;
/**< name of ib memory pool */
uint32_t ib_rr_buf_max;
/**< the maximum number of posted rr */
uint32_t ib_rr_buf_min;
/**< the minimum number of posted rr */
size_t eager_limit;
size_t max_send_size;
uint32_t leave_pinned;
uint32_t reg_mru_len;
}; typedef struct mca_bmi_ib_component_t mca_bmi_ib_component_t;
extern mca_bmi_ib_component_t mca_bmi_ib_component;
typedef mca_bmi_base_recv_reg_t mca_bmi_ib_recv_reg_t;
/**
* IB PTL Interface
*/
struct mca_bmi_ib_module_t {
mca_bmi_base_module_t super; /**< base PTL interface */
bool bmi_inited;
mca_bmi_ib_recv_reg_t ib_reg[256];
VAPI_hca_id_t hca_id; /**< ID of HCA */
IB_port_t port_id; /**< ID of the PORT */
VAPI_hca_port_t port; /**< IB port of this PTL */
VAPI_hca_hndl_t nic; /**< NIC handle */
VAPI_pd_hndl_t ptag; /**< Protection Domain tag */
VAPI_cq_hndl_t cq_hndl_high; /**< High Priority Completion Queue handle */
VAPI_cq_hndl_t cq_hndl_low; /**< Low Priority Completion Queue handle */
EVAPI_async_handler_hndl_t async_handler;
/**< Async event handler used to detect weird/unknown events */
ompi_free_list_t send_free_eager; /**< free list of eager buffer descriptors */
ompi_free_list_t send_free_max; /**< free list of max buffer descriptors */
ompi_free_list_t send_free_frag; /**< free list of frags only... used for pining memory */
ompi_free_list_t recv_free_eager; /**< High priority free list of buffer descriptors */
ompi_free_list_t recv_free_max; /**< Low priority free list of buffer descriptors */
ompi_list_t reg_mru_list; /**< a most recently used list of mca_mpool_vapi_registration_t
entries, this allows us to keep a working set of memory pinned */
ompi_list_t repost; /**< list of buffers to repost */
ompi_mutex_t ib_lock; /**< module level lock */
mca_mpool_base_module_t* ib_pool; /**< ib memory pool */
uint32_t rr_posted_high; /**< number of high priority rr posted to the nic*/
uint32_t rr_posted_low; /**< number of low priority rr posted to the nic*/
VAPI_rr_desc_t* rr_desc_post;
/**< an array to allow posting of rr in one swoop */
size_t ib_inline_max; /**< max size of inline send*/
size_t ib_pin_min; /**< min size to pin memory*/
uint32_t ib_cq_size; /**< Max outstanding CQE on the CQ */
uint32_t ib_wq_size; /**< Max outstanding WR on the WQ */
uint32_t ib_sg_list_size; /**< Max scatter/gather descriptor entries on the WQ*/
uint32_t ib_pkey_ix;
uint32_t ib_psn;
uint32_t ib_qp_ous_rd_atom;
uint32_t ib_mtu;
uint32_t ib_min_rnr_timer;
uint32_t ib_timeout;
uint32_t ib_retry_count;
uint32_t ib_rnr_retry;
uint32_t ib_max_rdma_dst_ops;
uint32_t ib_service_level;
uint32_t ib_static_rate;
uint32_t ib_src_path_bits;
}; typedef struct mca_bmi_ib_module_t mca_bmi_ib_module_t;
struct mca_bmi_ib_frag_t;
extern mca_bmi_ib_module_t mca_bmi_ib_module;
/**
* Register IB component parameters with the MCA framework
*/
extern int mca_bmi_ib_component_open(void);
/**
* Any final cleanup before being unloaded.
*/
extern int mca_bmi_ib_component_close(void);
/**
* IB component initialization.
*
* @param num_bmi_modules (OUT) Number of BMIs returned in BMI array.
* @param allow_multi_user_threads (OUT) Flag indicating wether BMI supports user threads (TRUE)
* @param have_hidden_threads (OUT) Flag indicating wether BMI uses threads (TRUE)
*
* (1) read interface list from kernel and compare against component parameters
* then create a BMI instance for selected interfaces
* (2) setup IB listen socket for incoming connection attempts
* (3) publish BMI addressing info
*
*/
extern mca_bmi_base_module_t** mca_bmi_ib_component_init(
int *num_bmi_modules,
bool allow_multi_user_threads,
bool have_hidden_threads
);
/**
* IB component progress.
*/
extern int mca_bmi_ib_component_progress(
void
);
/**
* Register a callback function that is called on receipt
* of a fragment.
*
* @param bmi (IN) BMI module
* @return Status indicating if cleanup was successful
*
* When the process list changes, the PML notifies the BMI of the
* change, to provide the opportunity to cleanup or release any
* resources associated with the peer.
*/
int mca_bmi_ib_register(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_tag_t tag,
mca_bmi_base_module_recv_cb_fn_t cbfunc,
void* cbdata
);
/**
* Cleanup any resources held by the BMI.
*
* @param bmi BMI instance.
* @return OMPI_SUCCESS or error status on failure.
*/
extern int mca_bmi_ib_finalize(
struct mca_bmi_base_module_t* bmi
);
/**
* PML->BMI notification of change in the process list.
*
* @param bmi (IN)
* @param nprocs (IN) Number of processes
* @param procs (IN) Set of processes
* @param peers (OUT) Set of (optional) peer addressing info.
* @param peers (IN/OUT) Set of processes that are reachable via this BMI.
* @return OMPI_SUCCESS or error status on failure.
*
*/
extern int mca_bmi_ib_add_procs(
struct mca_bmi_base_module_t* bmi,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t** peers,
ompi_bitmap_t* reachable
);
/**
* PML->BMI notification of change in the process list.
*
* @param bmi (IN) BMI instance
* @param nproc (IN) Number of processes.
* @param procs (IN) Set of processes.
* @param peers (IN) Set of peer data structures.
* @return Status indicating if cleanup was successful
*
*/
extern int mca_bmi_ib_del_procs(
struct mca_bmi_base_module_t* bmi,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t** peers
);
/**
* PML->BMI Initiate a send of the specified size.
*
* @param bmi (IN) BMI instance
* @param bmi_base_peer (IN) BMI peer addressing
* @param send_request (IN/OUT) Send request (allocated by PML via mca_bmi_base_request_alloc_fn_t)
* @param size (IN) Number of bytes PML is requesting BMI to deliver
* @param flags (IN) Flags that should be passed to the peer via the message header.
* @param request (OUT) OMPI_SUCCESS if the BMI was able to queue one or more fragments
*/
extern int mca_bmi_ib_send(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* bmi_peer,
struct mca_bmi_base_descriptor_t* descriptor,
mca_bmi_base_tag_t tag
);
/**
* PML->BMI Initiate a put of the specified size.
*
* @param bmi (IN) BMI instance
* @param bmi_base_peer (IN) BMI peer addressing
* @param send_request (IN/OUT) Send request (allocated by PML via mca_bmi_base_request_alloc_fn_t)
* @param size (IN) Number of bytes PML is requesting BMI to deliver
* @param flags (IN) Flags that should be passed to the peer via the message header.
* @param request (OUT) OMPI_SUCCESS if the BMI was able to queue one or more fragments
*/
extern int mca_bmi_ib_put(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* bmi_peer,
struct mca_bmi_base_descriptor_t* decriptor
);
/**
* Allocate a descriptor.
*
* @param bmi (IN) BMI module
* @param size (IN) Requested descriptor size.
*/
extern mca_bmi_base_descriptor_t* mca_bmi_ib_alloc(
struct mca_bmi_base_module_t* bmi,
size_t size);
/**
* Return a segment allocated by this BMI.
*
* @param bmi (IN) BMI module
* @param descriptor (IN) Allocated descriptor.
*/
extern int mca_bmi_ib_free(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_descriptor_t* des);
/**
* Pack data and return a descriptor that can be
* used for send/put.
*
* @param bmi (IN) BMI module
* @param peer (IN) BMI peer addressing
*/
mca_bmi_base_descriptor_t* mca_bmi_ib_prepare_src(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* peer,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size
);
/**
* Allocate a descriptor initialized for RDMA write.
*
* @param bmi (IN) BMI module
* @param peer (IN) BMI peer addressing
*/
extern mca_bmi_base_descriptor_t* mca_bmi_ib_prepare_dst(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* peer,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size);
/**
* Return a send fragment to the modules free list.
*
* @param bmi (IN) BMI instance
* @param frag (IN) IB send fragment
*
*/
extern void mca_bmi_ib_send_frag_return(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_ib_frag_t*
);
int mca_bmi_ib_module_init(mca_bmi_ib_module_t* ib_bmi);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

Просмотреть файл

@ -1,599 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "include/constants.h"
#include "event/event.h"
#include "util/if.h"
#include "util/argv.h"
#include "util/output.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "mca/base/mca_base_param.h"
#include "mca/base/mca_base_module_exchange.h"
#include "mca/errmgr/errmgr.h"
#include "mca/common/vapi/vapi_mem_reg.h"
#include "mca/mpool/base/base.h"
#include "bmi_ib.h"
#include "bmi_ib_frag.h"
#include "bmi_ib_endpoint.h"
#include "mca/bmi/base/base.h"
#include <vapi.h>
#include <vapi_common.h>
#include "datatype/convertor.h"
#include "mca/mpool/vapi/mpool_vapi.h"
mca_bmi_ib_component_t mca_bmi_ib_component = {
{
/* First, the mca_base_component_t struct containing meta information
about the component itself */
{
/* Indicate that we are a pml v1.0.0 component (which also implies a
specific MCA version) */
MCA_BMI_BASE_VERSION_1_0_0,
"ib", /* MCA component name */
1, /* MCA component major version */
0, /* MCA component minor version */
0, /* MCA component release version */
mca_bmi_ib_component_open, /* component open */
mca_bmi_ib_component_close /* component close */
},
/* Next the MCA v1.0.0 component meta data */
{
/* Whether the component is checkpointable or not */
false
},
mca_bmi_ib_component_init,
mca_bmi_ib_component_progress,
}
};
/*
* utility routines for parameter registration
*/
static inline char* mca_bmi_ib_param_register_string(
const char* param_name,
const char* default_value)
{
char *param_value;
int id = mca_base_param_register_string("bmi","ib",param_name,NULL,default_value);
mca_base_param_lookup_string(id, &param_value);
return param_value;
}
static inline int mca_bmi_ib_param_register_int(
const char* param_name,
int default_value)
{
int id = mca_base_param_register_int("bmi","ib",param_name,NULL,default_value);
int param_value = default_value;
mca_base_param_lookup_int(id,&param_value);
return param_value;
}
/*
* Called by MCA framework to open the component, registers
* component parameters.
*/
int mca_bmi_ib_component_open(void)
{
int param, value;
/* initialize state */
mca_bmi_ib_component.ib_num_bmis=0;
mca_bmi_ib_component.ib_bmis=NULL;
/* initialize objects */
OBJ_CONSTRUCT(&mca_bmi_ib_component.ib_procs, ompi_list_t);
/* OBJ_CONSTRUCT (&mca_bmi_ib_component.ib_recv_frags, ompi_free_list_t); */
/* register IB component parameters */
mca_bmi_ib_component.ib_free_list_num =
mca_bmi_ib_param_register_int ("free_list_num", 8);
mca_bmi_ib_component.ib_free_list_max =
mca_bmi_ib_param_register_int ("free_list_max", 1024);
mca_bmi_ib_component.ib_free_list_inc =
mca_bmi_ib_param_register_int ("free_list_inc", 32);
mca_bmi_ib_component.ib_mem_registry_hints_log_size =
mca_bmi_ib_param_register_int ("hints_log_size", 8);
mca_bmi_ib_component.ib_mpool_name =
mca_bmi_ib_param_register_string("mpool", "ib");
mca_bmi_ib_component.ib_rr_buf_max =
mca_bmi_ib_param_register_int("rr_buf_max", 16);
mca_bmi_ib_component.ib_rr_buf_min =
mca_bmi_ib_param_register_int("rr_buf_min", 8);
mca_bmi_ib_component.reg_mru_len =
mca_bmi_ib_param_register_int("reg_mru_len", 16);
mca_bmi_ib_module.super.bmi_exclusivity =
mca_bmi_ib_param_register_int ("exclusivity", 0);
mca_bmi_ib_module.super.bmi_eager_limit =
mca_bmi_ib_param_register_int ("eager_limit", (64*1024))
- sizeof(mca_bmi_ib_header_t);
mca_bmi_ib_module.super.bmi_min_send_size =
mca_bmi_ib_param_register_int ("min_send_size", (64*1024))
- sizeof(mca_bmi_ib_header_t);
mca_bmi_ib_module.super.bmi_max_send_size =
mca_bmi_ib_param_register_int ("max_send_size", (128*1024))
- sizeof(mca_bmi_ib_header_t);
mca_bmi_ib_module.ib_pin_min =
mca_bmi_ib_param_register_int("ib_pin_min", 128*1024);
mca_bmi_ib_module.ib_cq_size =
mca_bmi_ib_param_register_int("ib_cq_size",
40000);
mca_bmi_ib_module.ib_wq_size =
mca_bmi_ib_param_register_int("ib_wq_size",
10000);
mca_bmi_ib_module.ib_sg_list_size =
mca_bmi_ib_param_register_int("ib_sg_list_size",
1);
mca_bmi_ib_module.ib_pkey_ix =
mca_bmi_ib_param_register_int("ib_pkey_ix",
0);
mca_bmi_ib_module.ib_psn =
mca_bmi_ib_param_register_int("ib_psn",
0);
mca_bmi_ib_module.ib_qp_ous_rd_atom =
mca_bmi_ib_param_register_int("ib_qp_ous_rd_atom",
1);
mca_bmi_ib_module.ib_mtu =
mca_bmi_ib_param_register_int("ib_mtu",
MTU1024);
mca_bmi_ib_module.ib_min_rnr_timer =
mca_bmi_ib_param_register_int("ib_min_rnr_timer",
5);
mca_bmi_ib_module.ib_timeout =
mca_bmi_ib_param_register_int("ib_timeout",
10);
mca_bmi_ib_module.ib_retry_count =
mca_bmi_ib_param_register_int("ib_retry_count",
7);
mca_bmi_ib_module.ib_rnr_retry =
mca_bmi_ib_param_register_int("ib_rnr_retry",
7);
mca_bmi_ib_module.ib_max_rdma_dst_ops =
mca_bmi_ib_param_register_int("ib_max_rdma_dst_ops",
16);
mca_bmi_ib_module.ib_service_level =
mca_bmi_ib_param_register_int("ib_service_level",
0);
mca_bmi_ib_module.ib_static_rate =
mca_bmi_ib_param_register_int("ib_static_rate",
0);
mca_bmi_ib_module.ib_src_path_bits =
mca_bmi_ib_param_register_int("ib_src_path_bits",
0);
mca_bmi_ib_module.super.bmi_min_rdma_size =
mca_bmi_ib_param_register_int("min_rdma_size",
1024*1024);
mca_bmi_ib_module.super.bmi_max_rdma_size =
mca_bmi_ib_param_register_int("max_rdma_size",
1024*1024);
mca_bmi_ib_module.super.bmi_flags =
mca_bmi_ib_param_register_int("flags",
MCA_BMI_FLAGS_RDMA);
param = mca_base_param_find("mpi", NULL, "leave_pinned");
mca_base_param_lookup_int(param, &value);
mca_bmi_ib_component.leave_pinned = value;
mca_bmi_ib_component.max_send_size = mca_bmi_ib_module.super.bmi_max_send_size;
mca_bmi_ib_component.eager_limit = mca_bmi_ib_module.super.bmi_eager_limit;
return OMPI_SUCCESS;
}
/*
* component cleanup - sanity checking of queue lengths
*/
int mca_bmi_ib_component_close(void)
{
return OMPI_SUCCESS;
}
/*
* IB component initialization:
* (1) read interface list from kernel and compare against component parameters
* then create a BMI instance for selected interfaces
* (2) setup IB listen socket for incoming connection attempts
* (3) register BMI parameters with the MCA
*/
mca_bmi_base_module_t** mca_bmi_ib_component_init(int *num_bmi_modules,
bool enable_progress_threads,
bool enable_mpi_threads)
{
VAPI_ret_t vapi_ret;
VAPI_hca_id_t* hca_ids;
VAPI_hca_hndl_t hca_hndl;
VAPI_hca_vendor_t hca_vendor;
VAPI_hca_cap_t hca_cap;
VAPI_hca_port_t hca_port;
uint32_t num_hcas;
mca_bmi_base_module_t** bmis;
uint32_t i,j, length;
struct mca_mpool_base_resources_t hca_pd;
ompi_list_t bmi_list;
mca_bmi_ib_module_t * ib_bmi;
mca_bmi_base_selected_module_t* ib_selected;
ompi_list_item_t* item;
/* initialization */
*num_bmi_modules = 0;
/* Determine the number of hca's available on the host */
vapi_ret=EVAPI_list_hcas(0, &num_hcas, NULL);
if( VAPI_EAGAIN != vapi_ret || 0 == num_hcas ) {
ompi_output(0,"No hca's found on this host \n");
return NULL;
}
/* Allocate space for the hca's */
hca_ids = (VAPI_hca_id_t*) malloc(num_hcas * sizeof(VAPI_hca_id_t));
if(NULL == hca_ids) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return NULL;
}
/* obtain a list of the hca's on this host */
vapi_ret=EVAPI_list_hcas(num_hcas, &num_hcas, hca_ids);
if( VAPI_OK != vapi_ret ) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return NULL;
}
/** We must loop through all the hca id's, get there handles and
for each hca we query the number of ports on the hca and set up
a distinct bmi module for each hca port */
OBJ_CONSTRUCT(&bmi_list, ompi_list_t);
OBJ_CONSTRUCT(&mca_bmi_ib_component.ib_lock, ompi_mutex_t);
for(i = 0; i < num_hcas; i++){
vapi_ret = EVAPI_get_hca_hndl(hca_ids[i], &hca_hndl);
if(VAPI_OK != vapi_ret) {
ompi_output(0, "%s:error getting hca handle\n", __func__);
return NULL;
}
vapi_ret = VAPI_query_hca_cap(hca_hndl, &hca_vendor, &hca_cap);
if(VAPI_OK != vapi_ret) {
ompi_output(0, "%s:error getting hca properties\n", __func__);
return NULL;
}
/* Note ports are 1 based hence j = 1 */
for(j = 1; j <= hca_cap.phys_port_num; j++){
vapi_ret = VAPI_query_hca_port_prop(hca_hndl, (IB_port_t) j, &hca_port);
if(VAPI_OK != vapi_ret) {
ompi_output(0, "%s:error getting hca port properties\n", __func__);
return NULL;
}
if( PORT_ACTIVE == hca_port.state ){
ib_bmi = (mca_bmi_ib_module_t*) malloc(sizeof(mca_bmi_ib_module_t));
memcpy(ib_bmi, &mca_bmi_ib_module, sizeof(mca_bmi_ib_module));
ib_selected = OBJ_NEW(mca_bmi_base_selected_module_t);
ib_selected->bmi_module = (mca_bmi_base_module_t*) ib_bmi;
memcpy(ib_bmi->hca_id, hca_ids[i], sizeof(VAPI_hca_id_t));
ib_bmi->nic = hca_hndl;
ib_bmi->port_id = (IB_port_t) j;
ib_bmi->port = hca_port;
ompi_list_append(&bmi_list, (ompi_list_item_t*) ib_selected);
mca_bmi_ib_component.ib_num_bmis ++;
}
}
}
/* Allocate space for bmi modules */
mca_bmi_ib_component.ib_bmis = (mca_bmi_ib_module_t*) malloc(sizeof(mca_bmi_ib_module_t) *
mca_bmi_ib_component.ib_num_bmis);
if(NULL == mca_bmi_ib_component.ib_bmis) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return NULL;
}
bmis = (struct mca_bmi_base_module_t**)
malloc(mca_bmi_ib_component.ib_num_bmis * sizeof(struct mca_bmi_ib_module_t*));
if(NULL == bmis) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return NULL;
}
for(i = 0; i < mca_bmi_ib_component.ib_num_bmis; i++){
item = ompi_list_remove_first(&bmi_list);
ib_selected = (mca_bmi_base_selected_module_t*)item;
ib_bmi = (mca_bmi_ib_module_t*) ib_selected->bmi_module;
memcpy(&(mca_bmi_ib_component.ib_bmis[i]), ib_bmi , sizeof(mca_bmi_ib_module_t));
free(ib_selected);
free(ib_bmi);
ib_bmi = &mca_bmi_ib_component.ib_bmis[i];
/* Initialize the modules function pointers */
/* Initialize module state */
OBJ_CONSTRUCT(&ib_bmi->ib_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&ib_bmi->send_free_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&ib_bmi->send_free_max, ompi_free_list_t);
OBJ_CONSTRUCT(&ib_bmi->send_free_frag, ompi_free_list_t);
OBJ_CONSTRUCT(&ib_bmi->recv_free_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&ib_bmi->recv_free_max, ompi_free_list_t);
OBJ_CONSTRUCT(&ib_bmi->repost, ompi_list_t);
OBJ_CONSTRUCT(&ib_bmi->reg_mru_list, ompi_list_t);
if(mca_bmi_ib_module_init(ib_bmi) != OMPI_SUCCESS) {
free(hca_ids);
return NULL;
}
hca_pd.hca = ib_bmi->nic;
hca_pd.pd_tag = ib_bmi->ptag;
/* initialize the memory pool using the hca */
ib_bmi->ib_pool =
mca_mpool_base_module_create(mca_bmi_ib_component.ib_mpool_name,
&ib_bmi->super,
&hca_pd);
if(NULL == ib_bmi->ib_pool) {
ompi_output(0, "%s: error creating vapi memory pool! aborting ib bmi initialization", __func__);
return NULL;
}
/* Initialize pool of send fragments */
length = sizeof(mca_bmi_ib_frag_t) +
sizeof(mca_bmi_ib_header_t) +
ib_bmi->super.bmi_eager_limit+
2*MCA_BMI_IB_FRAG_ALIGN;
ompi_free_list_init(&ib_bmi->send_free_eager,
length,
OBJ_CLASS(mca_bmi_ib_send_frag_eager_t),
mca_bmi_ib_component.ib_free_list_num,
mca_bmi_ib_component.ib_free_list_max,
mca_bmi_ib_component.ib_free_list_inc,
ib_bmi->ib_pool);
ompi_free_list_init(&ib_bmi->recv_free_eager,
length,
OBJ_CLASS(mca_bmi_ib_recv_frag_eager_t),
mca_bmi_ib_component.ib_free_list_num,
mca_bmi_ib_component.ib_free_list_max,
mca_bmi_ib_component.ib_free_list_inc,
ib_bmi->ib_pool);
length = sizeof(mca_bmi_ib_frag_t) +
sizeof(mca_bmi_ib_header_t) +
ib_bmi->super.bmi_max_send_size+
2*MCA_BMI_IB_FRAG_ALIGN;
ompi_free_list_init(&ib_bmi->send_free_max,
length,
OBJ_CLASS(mca_bmi_ib_send_frag_max_t),
mca_bmi_ib_component.ib_free_list_num,
mca_bmi_ib_component.ib_free_list_max,
mca_bmi_ib_component.ib_free_list_inc,
ib_bmi->ib_pool);
/* Initialize pool of receive fragments */
ompi_free_list_init (&ib_bmi->recv_free_max,
length,
OBJ_CLASS (mca_bmi_ib_recv_frag_max_t),
mca_bmi_ib_component.ib_free_list_num,
mca_bmi_ib_component.ib_free_list_max,
mca_bmi_ib_component.ib_free_list_inc, ib_bmi->ib_pool);
length = sizeof(mca_bmi_ib_frag_t) +
sizeof(mca_bmi_ib_header_t)+
2*MCA_BMI_IB_FRAG_ALIGN;
ompi_free_list_init(&ib_bmi->send_free_frag,
length,
OBJ_CLASS(mca_bmi_ib_send_frag_frag_t),
mca_bmi_ib_component.ib_free_list_num,
mca_bmi_ib_component.ib_free_list_max,
mca_bmi_ib_component.ib_free_list_inc,
ib_bmi->ib_pool);
/* Initialize the rr_desc_post array for posting of rr*/
ib_bmi->rr_desc_post = (VAPI_rr_desc_t*) malloc((mca_bmi_ib_component.ib_rr_buf_max * sizeof(VAPI_rr_desc_t)));
/* This is now done by the memory pool passed to free_list_init.. Initialize the send descriptors */
/* if(mca_bmi_ib_send_frag_register(ib_bmi) != OMPI_SUCCESS) { */
/* free(hca_ids); */
/* return NULL; */
/* } */
bmis[i] = &ib_bmi->super;
}
/* Post OOB receive to support dynamic connection setup */
mca_bmi_ib_post_recv();
*num_bmi_modules = mca_bmi_ib_component.ib_num_bmis;
free(hca_ids);
return bmis;
}
/*
* IB component progress.
*/
int mca_bmi_ib_component_progress()
{
uint32_t i;
int count = 0;
mca_bmi_ib_frag_t* frag;
/* Poll for completions */
for(i = 0; i < mca_bmi_ib_component.ib_num_bmis; i++) {
VAPI_ret_t ret;
VAPI_wc_desc_t comp;
mca_bmi_ib_module_t* ib_bmi = &mca_bmi_ib_component.ib_bmis[i];
do{
ret = VAPI_poll_cq(ib_bmi->nic, ib_bmi->cq_hndl_high, &comp);
if(VAPI_OK == ret) {
if(comp.status != VAPI_SUCCESS) {
ompi_output(0, "Got error : %s, Vendor code : %d Frag : %p",
VAPI_wc_status_sym(comp.status),
comp.vendor_err_syndrome, comp.id);
return OMPI_ERROR;
}
/* Handle n/w completions */
switch(comp.opcode) {
case VAPI_CQE_RQ_RDMA_WITH_IMM:
if(comp.imm_data_valid){
ompi_output(0, "Got an RQ_RDMA_WITH_IMM!\n");
}
break;
case VAPI_CQE_SQ_RDMA_WRITE:
case VAPI_CQE_SQ_SEND_DATA :
/* Process a completed send */
frag = (mca_bmi_ib_frag_t*) comp.id;
frag->rc = OMPI_SUCCESS;
frag->base.des_cbfunc(&ib_bmi->super, frag->endpoint, &frag->base, frag->rc);
count++;
break;
case VAPI_CQE_RQ_SEND_DATA:
DEBUG_OUT(0, "%s:%d ib recv under redesign\n", __FILE__, __LINE__);
frag = (mca_bmi_ib_frag_t*) comp.id;
frag->rc=OMPI_SUCCESS;
frag->segment.seg_len = comp.byte_len-((unsigned char*) frag->segment.seg_addr.pval - (unsigned char*) frag->hdr);
/* advance the segment address past the header and subtract from the length..*/
ib_bmi->ib_reg[frag->hdr->tag].cbfunc(&ib_bmi->super, frag->hdr->tag, &frag->base, ib_bmi->ib_reg[frag->hdr->tag].cbdata);
OMPI_FREE_LIST_RETURN(&(ib_bmi->recv_free_eager), (ompi_list_item_t*) frag);
OMPI_THREAD_ADD32(&ib_bmi->rr_posted_high, -1);
mca_bmi_ib_endpoint_post_rr(((mca_bmi_ib_frag_t*)comp.id)->endpoint, 0);
count++;
break;
default:
ompi_output(0, "Errorneous network completion");
break;
}
}
}
while(VAPI_OK == ret);
ret = VAPI_poll_cq(ib_bmi->nic, ib_bmi->cq_hndl_low, &comp);
if(VAPI_OK == ret) {
if(comp.status != VAPI_SUCCESS) {
ompi_output(0, "Got error : %s, Vendor code : %d Frag : %p",
VAPI_wc_status_sym(comp.status),
comp.vendor_err_syndrome, comp.id);
return OMPI_ERROR;
}
/* Handle n/w completions */
switch(comp.opcode) {
case VAPI_CQE_SQ_RDMA_WRITE:
case VAPI_CQE_SQ_SEND_DATA :
/* Process a completed send */
frag = (mca_bmi_ib_frag_t*) comp.id;
frag->rc = OMPI_SUCCESS;
frag->base.des_cbfunc(&ib_bmi->super, frag->endpoint, &frag->base, frag->rc);
count++;
break;
case VAPI_CQE_RQ_SEND_DATA:
DEBUG_OUT(0, "%s:%d ib recv under redesign\n", __FILE__, __LINE__);
frag = (mca_bmi_ib_frag_t*) comp.id;
frag->rc=OMPI_SUCCESS;
frag->segment.seg_len = comp.byte_len-((unsigned char*) frag->segment.seg_addr.pval - (unsigned char*) frag->hdr);
/* advance the segment address past the header and subtract from the length..*/
ib_bmi->ib_reg[frag->hdr->tag].cbfunc(&ib_bmi->super, frag->hdr->tag, &frag->base, ib_bmi->ib_reg[frag->hdr->tag].cbdata);
OMPI_FREE_LIST_RETURN(&(ib_bmi->recv_free_max), (ompi_list_item_t*) frag);
OMPI_THREAD_ADD32(&ib_bmi->rr_posted_low, -1);
mca_bmi_ib_endpoint_post_rr(((mca_bmi_ib_frag_t*)comp.id)->endpoint, 0);
count++;
break;
default:
ompi_output(0, "Errorneous network completion");
break;
}
}
}
return count;
}

Просмотреть файл

@ -1,801 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <sys/time.h>
#include <time.h>
#include "include/types.h"
#include "mca/pml/base/pml_base_sendreq.h"
#include "mca/ns/base/base.h"
#include "mca/oob/base/base.h"
#include "mca/rml/rml.h"
#include "mca/errmgr/errmgr.h"
#include "dps/dps.h"
#include "bmi_ib.h"
#include "bmi_ib_endpoint.h"
#include "bmi_ib_proc.h"
#include "bmi_ib_frag.h"
#include "class/ompi_free_list.h"
static void mca_bmi_ib_endpoint_construct(mca_bmi_base_endpoint_t* endpoint);
static void mca_bmi_ib_endpoint_destruct(mca_bmi_base_endpoint_t* endpoint);
int mca_bmi_ib_endpoint_create_qp(
mca_bmi_ib_module_t* ib_bmi,
VAPI_hca_hndl_t nic,
VAPI_pd_hndl_t ptag,
VAPI_cq_hndl_t cq_hndl,
VAPI_qp_hndl_t* qp_hndl,
VAPI_qp_prop_t* qp_prop,
int transport_type);
int mca_bmi_ib_endpoint_qp_init_query(
mca_bmi_ib_module_t* ib_bmi,
VAPI_hca_hndl_t nic,
VAPI_qp_hndl_t qp_hndl,
VAPI_qp_num_t remote_qp_num,
IB_lid_t remote_lid,
IB_port_t port_id
);
static inline int mca_bmi_ib_endpoint_post_send(mca_bmi_ib_module_t* ib_bmi, mca_bmi_ib_endpoint_t * endpoint, mca_bmi_ib_frag_t * frag)
{
frag->sr_desc.remote_qkey = 0;
frag->sg_entry.addr = (VAPI_virt_addr_t) (MT_virt_addr_t) frag->hdr;
VAPI_qp_hndl_t qp_hndl;
if(frag->base.des_flags && MCA_BMI_DES_FLAGS_PRIORITY && frag->size <= ib_bmi->super.bmi_eager_limit){
frag->sr_desc.remote_qp = endpoint->rem_qp_num_high;
qp_hndl = endpoint->lcl_qp_hndl_high;
} else {
frag->sr_desc.remote_qp = endpoint->rem_qp_num_low;
qp_hndl = endpoint->lcl_qp_hndl_low;
}
frag->sr_desc.opcode = VAPI_SEND;
frag->sg_entry.len = frag->segment.seg_len + ((unsigned char*) frag->segment.seg_addr.pval - (unsigned char*) frag->hdr); /* sizeof(mca_bmi_ib_header_t); */
if(frag->sg_entry.len <= ib_bmi->ib_inline_max) {
frag->ret = EVAPI_post_inline_sr(ib_bmi->nic,
qp_hndl,
&frag->sr_desc);
}else {
frag->ret = VAPI_post_sr(ib_bmi->nic,
qp_hndl,
&frag->sr_desc);
}
if(VAPI_OK != frag->ret)
return OMPI_ERROR;
mca_bmi_ib_endpoint_post_rr(endpoint, 1);
return OMPI_SUCCESS;
}
OBJ_CLASS_INSTANCE(mca_bmi_ib_endpoint_t,
ompi_list_item_t, mca_bmi_ib_endpoint_construct,
mca_bmi_ib_endpoint_destruct);
/*
* Initialize state of the endpoint instance.
*
*/
static void mca_bmi_ib_endpoint_construct(mca_bmi_base_endpoint_t* endpoint)
{
endpoint->endpoint_bmi = 0;
endpoint->endpoint_proc = 0;
endpoint->endpoint_tstamp = 0.0;
endpoint->endpoint_state = MCA_BMI_IB_CLOSED;
endpoint->endpoint_retries = 0;
OBJ_CONSTRUCT(&endpoint->endpoint_send_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&endpoint->endpoint_recv_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&endpoint->pending_send_frags, ompi_list_t);
}
/*
* Destroy a endpoint
*
*/
static void mca_bmi_ib_endpoint_destruct(mca_bmi_base_endpoint_t* endpoint)
{
}
/*
* Send connection information to remote endpoint using OOB
*
*/
static void mca_bmi_ib_endpoint_send_cb(
int status,
orte_process_name_t* endpoint,
orte_buffer_t* buffer,
orte_rml_tag_t tag,
void* cbdata)
{
OBJ_RELEASE(buffer);
}
static int mca_bmi_ib_endpoint_send_connect_req(mca_bmi_base_endpoint_t* endpoint)
{
orte_buffer_t* buffer = OBJ_NEW(orte_buffer_t);
int rc;
if(NULL == buffer) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* pack the info in the send buffer */
rc = orte_dps.pack(buffer, &endpoint->lcl_qp_prop_high.qp_num, 1, ORTE_UINT32);
if(rc != ORTE_SUCCESS) {
ORTE_ERROR_LOG(rc);
return rc;
}
rc = orte_dps.pack(buffer, &endpoint->lcl_qp_prop_low.qp_num, 1, ORTE_UINT32);
if(rc != ORTE_SUCCESS) {
ORTE_ERROR_LOG(rc);
return rc;
}
rc = orte_dps.pack(buffer, &endpoint->endpoint_bmi->port.lid, 1, ORTE_UINT32);
if(rc != ORTE_SUCCESS) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* send to endpoint */
rc = orte_rml.send_buffer_nb(&endpoint->endpoint_proc->proc_guid, buffer, ORTE_RML_TAG_DYNAMIC-1, 0,
mca_bmi_ib_endpoint_send_cb, NULL);
DEBUG_OUT("Sending High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
endpoint->lcl_qp_prop_high.qp_num,
endpoint->lcl_qp_prop_low.qp_num,
endpoint->endpoint_bmi->port.lid);
if(rc < 0) {
ORTE_ERROR_LOG(rc);
return rc;
}
return OMPI_SUCCESS;
}
/*
* Send connect ACK to remote endpoint
*
*/
static int mca_bmi_ib_endpoint_send_connect_ack(mca_bmi_base_endpoint_t* endpoint)
{
orte_buffer_t* buffer = OBJ_NEW(orte_buffer_t);
int rc;
uint32_t zero = 0;
/* pack the info in the send buffer */
if(ORTE_SUCCESS != (rc = orte_dps.pack(buffer, &zero, 1, ORTE_UINT32))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if(ORTE_SUCCESS != (rc = orte_dps.pack(buffer, &zero, 1, ORTE_UINT32))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if(ORTE_SUCCESS != (rc = orte_dps.pack(buffer, &zero, 1, ORTE_UINT32))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* send to endpoint */
rc = orte_rml.send_buffer_nb(&endpoint->endpoint_proc->proc_guid, buffer, ORTE_RML_TAG_DYNAMIC-1, 0,
mca_bmi_ib_endpoint_send_cb, NULL);
if(rc < 0) {
ORTE_ERROR_LOG(rc);
}
return rc;
}
/*
* Set remote connection info
*
* XXX: Currently size is unutilized, this shall change
* as soon as we add more info to be exchanged at connection
* setup.
*
*/
static int mca_bmi_ib_endpoint_set_remote_info(mca_bmi_base_endpoint_t* endpoint, orte_buffer_t* buffer)
{
int rc;
size_t cnt = 1;
rc = orte_dps.unpack(buffer, &endpoint->rem_qp_num_high, &cnt, ORTE_UINT32);
if(ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
return rc;
}
rc = orte_dps.unpack(buffer, &endpoint->rem_qp_num_low, &cnt, ORTE_UINT32);
if(ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
return rc;
}
rc = orte_dps.unpack(buffer, &endpoint->rem_lid, &cnt, ORTE_UINT32);
if(ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
return rc;
}
DEBUG_OUT("Received High Priority QP num = %d, Low Priority QP num %d, LID = %d",
endpoint->rem_qp_num_high,
endpoint->rem_qp_num_low,
endpoint->rem_lid);
return ORTE_SUCCESS;
}
/*
* Start to connect to the endpoint. We send our Queue Pair
* information over the TCP OOB communication mechanism.
* On completion of our send, a send completion handler
* is called.
*
*/
static int mca_bmi_ib_endpoint_start_connect(mca_bmi_base_endpoint_t* endpoint)
{
int rc;
/* Create the High Priority Queue Pair */
if(OMPI_SUCCESS != (rc = mca_bmi_ib_endpoint_create_qp(endpoint->endpoint_bmi,
endpoint->endpoint_bmi->nic,
endpoint->endpoint_bmi->ptag,
endpoint->endpoint_bmi->cq_hndl_high,
&endpoint->lcl_qp_hndl_high,
&endpoint->lcl_qp_prop_high,
VAPI_TS_RC))) {
ompi_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
return rc;
}
/* Create the Low Priority Queue Pair */
if(OMPI_SUCCESS != (rc = mca_bmi_ib_endpoint_create_qp(endpoint->endpoint_bmi,
endpoint->endpoint_bmi->nic,
endpoint->endpoint_bmi->ptag,
endpoint->endpoint_bmi->cq_hndl_low,
&endpoint->lcl_qp_hndl_low,
&endpoint->lcl_qp_prop_low,
VAPI_TS_RC))) {
ompi_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
return rc;
}
DEBUG_OUT("Initialized High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
endpoint->lcl_qp_prop_high.qp_num,
endpoint->lcl_qp_prop_low.qp_num,
ib_bmi->port.lid);
/* Send connection info over to remote endpoint */
endpoint->endpoint_state = MCA_BMI_IB_CONNECTING;
if(OMPI_SUCCESS != (rc = mca_bmi_ib_endpoint_send_connect_req(endpoint))) {
ompi_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
return rc;
}
return OMPI_SUCCESS;
}
/*
* Reply to a `start - connect' message
*
*/
static int mca_bmi_ib_endpoint_reply_start_connect(mca_bmi_ib_endpoint_t *endpoint, orte_buffer_t* buffer)
{
int rc;
/* Create the High Priority Queue Pair */
if(OMPI_SUCCESS != (rc = mca_bmi_ib_endpoint_create_qp(endpoint->endpoint_bmi,
endpoint->endpoint_bmi->nic,
endpoint->endpoint_bmi->ptag,
endpoint->endpoint_bmi->cq_hndl_high,
&endpoint->lcl_qp_hndl_high,
&endpoint->lcl_qp_prop_high,
VAPI_TS_RC))) {
ompi_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
return rc;
}
/* Create the Low Priority Queue Pair */
if(OMPI_SUCCESS != (rc = mca_bmi_ib_endpoint_create_qp(endpoint->endpoint_bmi,
endpoint->endpoint_bmi->nic,
endpoint->endpoint_bmi->ptag,
endpoint->endpoint_bmi->cq_hndl_low,
&endpoint->lcl_qp_hndl_low,
&endpoint->lcl_qp_prop_low,
VAPI_TS_RC))) {
ompi_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
return rc;
}
DEBUG_OUT("Initialized High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
endpoint->lcl_qp_prop_high.qp_num,
endpoint->lcl_qp_prop_low.qp_num,
ib_bmi->port.lid);
/* Set the remote side info */
mca_bmi_ib_endpoint_set_remote_info(endpoint, buffer);
/* Connect to endpoint */
rc = mca_bmi_ib_endpoint_connect(endpoint);
if(rc != OMPI_SUCCESS) {
ompi_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
return rc;
}
/* Send connection info over to remote endpoint */
if(OMPI_SUCCESS != (rc = mca_bmi_ib_endpoint_send_connect_req(endpoint))) {
ompi_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
return rc;
}
return OMPI_SUCCESS;
}
/*
*
*/
static void mca_bmi_ib_endpoint_connected(mca_bmi_ib_endpoint_t *endpoint)
{
endpoint->endpoint_state = MCA_BMI_IB_CONNECTED;
mca_bmi_ib_progress_send_frags(endpoint);
}
/*
* Non blocking OOB recv callback.
* Read incoming QP and other info, and if this endpoint
* is trying to connect, reply with our QP info,
* otherwise try to modify QP's and establish
* reliable connection
*
*/
static void mca_bmi_ib_endpoint_recv(
int status,
orte_process_name_t* endpoint,
orte_buffer_t* buffer,
orte_rml_tag_t tag,
void* cbdata)
{
mca_bmi_ib_proc_t *ib_proc;
mca_bmi_ib_endpoint_t *ib_endpoint;
int endpoint_state;
int rc;
for(ib_proc = (mca_bmi_ib_proc_t*)
ompi_list_get_first(&mca_bmi_ib_component.ib_procs);
ib_proc != (mca_bmi_ib_proc_t*)
ompi_list_get_end(&mca_bmi_ib_component.ib_procs);
ib_proc = (mca_bmi_ib_proc_t*)ompi_list_get_next(ib_proc)) {
if(ib_proc->proc_guid.vpid == endpoint->vpid) {
/* Try to get the endpoint instance of this proc */
/* Limitation: Right now, we have only 1 endpoint
* for every process. Need several changes, some
* in PML/BMI interface to set this right */
ib_endpoint = ib_proc->proc_endpoints[0];
endpoint_state = ib_endpoint->endpoint_state;
/* Update status */
switch(endpoint_state) {
case MCA_BMI_IB_CLOSED :
/* We had this connection closed before.
* The endpoint is trying to connect. Move the
* status of this connection to CONNECTING,
* and then reply with our QP information */
if(OMPI_SUCCESS != (rc = mca_bmi_ib_endpoint_reply_start_connect(ib_endpoint, buffer))) {
ompi_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
break;
}
/* Setup state as connected */
ib_endpoint->endpoint_state = MCA_BMI_IB_CONNECT_ACK;
break;
case MCA_BMI_IB_CONNECTING :
mca_bmi_ib_endpoint_set_remote_info(ib_endpoint, buffer);
if(OMPI_SUCCESS != (rc = mca_bmi_ib_endpoint_connect(ib_endpoint))) {
ompi_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
break;
}
/* Setup state as connected */
mca_bmi_ib_endpoint_connected(ib_endpoint);
/* Send him an ack */
mca_bmi_ib_endpoint_send_connect_ack(ib_endpoint);
break;
case MCA_BMI_IB_CONNECT_ACK:
mca_bmi_ib_endpoint_connected(ib_endpoint);
break;
case MCA_BMI_IB_CONNECTED :
break;
default :
ompi_output(0, "Connected -> Connecting not possible.\n");
}
break;
}
}
/* Okay, now that we are done receiving,
* re-post the buffer */
mca_bmi_ib_post_recv();
}
void mca_bmi_ib_post_recv()
{
DEBUG_OUT("");
orte_rml.recv_buffer_nb(
ORTE_RML_NAME_ANY,
ORTE_RML_TAG_DYNAMIC-1,
0,
mca_bmi_ib_endpoint_recv,
NULL);
}
/*
* Attempt to send a fragment using a given endpoint. If the endpoint is not
* connected, queue the fragment and start the connection as required.
*/
int mca_bmi_ib_endpoint_send(
mca_bmi_base_endpoint_t* endpoint,
mca_bmi_ib_frag_t* frag
)
{
int rc;
mca_bmi_ib_module_t *ib_bmi;
OMPI_THREAD_LOCK(&endpoint->endpoint_send_lock);
switch(endpoint->endpoint_state) {
case MCA_BMI_IB_CONNECTING:
DEBUG_OUT("Queing because state is connecting");
ompi_list_append(&endpoint->pending_send_frags,
(ompi_list_item_t *)frag);
rc = OMPI_SUCCESS;
break;
case MCA_BMI_IB_CONNECT_ACK:
DEBUG_OUT("Queuing because waiting for ack");
ompi_list_append(&endpoint->pending_send_frags,
(ompi_list_item_t *)frag);
rc = OMPI_SUCCESS;
break;
case MCA_BMI_IB_CLOSED:
DEBUG_OUT("Connection to endpoint closed ... connecting ...");
ompi_list_append(&endpoint->pending_send_frags,
(ompi_list_item_t *)frag);
rc = mca_bmi_ib_endpoint_start_connect(endpoint);
break;
case MCA_BMI_IB_FAILED:
rc = OMPI_ERR_UNREACH;
break;
case MCA_BMI_IB_CONNECTED:
{
ib_bmi = endpoint->endpoint_bmi;
DEBUG_OUT("Send to : %d, len : %d, frag : %p",
endpoint->endpoint_proc->proc_guid.vpid,
frag->ib_buf.desc.sg_entry.len,
frag);
rc = mca_bmi_ib_endpoint_post_send(ib_bmi, endpoint, frag);
break;
}
default:
rc = OMPI_ERR_UNREACH;
}
OMPI_THREAD_UNLOCK(&endpoint->endpoint_send_lock);
return rc;
}
void mca_bmi_ib_progress_send_frags(mca_bmi_ib_endpoint_t* endpoint)
{
ompi_list_item_t *frag_item;
mca_bmi_ib_frag_t *frag;
mca_bmi_ib_module_t* ib_bmi;
/*Check if endpoint is connected */
if(endpoint->endpoint_state != MCA_BMI_IB_CONNECTED) {
return;
}
/* While there are frags in the list,
* process them */
while(!ompi_list_is_empty(&(endpoint->pending_send_frags))) {
frag_item = ompi_list_remove_first(&(endpoint->pending_send_frags));
frag = (mca_bmi_ib_frag_t *) frag_item;
ib_bmi = endpoint->endpoint_bmi;
/* We need to post this one */
if(OMPI_SUCCESS != mca_bmi_ib_endpoint_post_send(ib_bmi, endpoint, frag))
ompi_output(0, "error in mca_bmi_ib_endpoint_send");
}
}
/*
* Complete connection to endpoint.
*/
int mca_bmi_ib_endpoint_connect(
mca_bmi_ib_endpoint_t *endpoint)
{
int rc;
/* Connection establishment RC */
rc = mca_bmi_ib_endpoint_qp_init_query(endpoint->endpoint_bmi,
endpoint->endpoint_bmi->nic,
endpoint->lcl_qp_hndl_high,
endpoint->rem_qp_num_high,
endpoint->rem_lid,
endpoint->endpoint_bmi->port_id);
rc = mca_bmi_ib_endpoint_qp_init_query(endpoint->endpoint_bmi,
endpoint->endpoint_bmi->nic,
endpoint->lcl_qp_hndl_low,
endpoint->rem_qp_num_low,
endpoint->rem_lid,
endpoint->endpoint_bmi->port_id);
if(rc != OMPI_SUCCESS) {
return rc;
}
mca_bmi_ib_endpoint_post_rr(endpoint, 0);
return OMPI_SUCCESS;
}
int mca_bmi_ib_endpoint_create_qp(
mca_bmi_ib_module_t* ib_bmi,
VAPI_hca_hndl_t nic,
VAPI_pd_hndl_t ptag,
VAPI_cq_hndl_t cq_hndl,
VAPI_qp_hndl_t* qp_hndl,
VAPI_qp_prop_t* qp_prop,
int transport_type)
{
VAPI_ret_t ret;
VAPI_qp_init_attr_t qp_init_attr;
switch(transport_type) {
case VAPI_TS_RC: /* Set up RC qp parameters */
qp_init_attr.cap.max_oust_wr_rq = ib_bmi->ib_wq_size;
qp_init_attr.cap.max_oust_wr_sq = ib_bmi->ib_wq_size;
qp_init_attr.cap.max_sg_size_rq = ib_bmi->ib_sg_list_size;
qp_init_attr.cap.max_sg_size_sq = ib_bmi->ib_sg_list_size;
qp_init_attr.pd_hndl = ptag;
/* We don't have Reliable Datagram Handle right now */
qp_init_attr.rdd_hndl = 0;
/* Signal all work requests on this queue pair */
qp_init_attr.rq_sig_type = VAPI_SIGNAL_REQ_WR;
qp_init_attr.sq_sig_type = VAPI_SIGNAL_REQ_WR;
/* Use Reliable Connected transport service */
qp_init_attr.ts_type = VAPI_TS_RC;
/* Set Send and Recv completion queues */
qp_init_attr.rq_cq_hndl = cq_hndl;
qp_init_attr.sq_cq_hndl = cq_hndl;
break;
case VAPI_TS_UD: /* Set up UD qp parameters */
default:
return OMPI_ERR_NOT_IMPLEMENTED;
}
ret = VAPI_create_qp(nic, &qp_init_attr,
qp_hndl, qp_prop);
if(VAPI_OK != ret) {
MCA_BMI_IB_VAPI_ERROR(ret, "VAPI_create_qp");
return OMPI_ERROR;
}
return OMPI_SUCCESS;
}
int mca_bmi_ib_endpoint_qp_init_query(
mca_bmi_ib_module_t* ib_bmi,
VAPI_hca_hndl_t nic,
VAPI_qp_hndl_t qp_hndl,
VAPI_qp_num_t remote_qp_num,
IB_lid_t remote_lid,
IB_port_t port_id
)
{
VAPI_ret_t ret;
VAPI_qp_attr_t qp_attr;
VAPI_qp_attr_mask_t qp_attr_mask;
VAPI_qp_init_attr_t qp_init_attr;
VAPI_qp_cap_t qp_cap;
/* Modifying QP to INIT */
QP_ATTR_MASK_CLR_ALL(qp_attr_mask);
qp_attr.qp_state = VAPI_INIT;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_QP_STATE);
qp_attr.pkey_ix = ib_bmi->ib_pkey_ix;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_PKEY_IX);
qp_attr.port = port_id;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_PORT);
qp_attr.remote_atomic_flags = VAPI_EN_REM_WRITE | VAPI_EN_REM_READ;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_REMOTE_ATOMIC_FLAGS);
ret = VAPI_modify_qp(nic, qp_hndl,
&qp_attr, &qp_attr_mask, &qp_cap);
if(VAPI_OK != ret) {
MCA_BMI_IB_VAPI_ERROR(ret, "VAPI_modify_qp");
return OMPI_ERROR;
}
DEBUG_OUT("Modified to init..Qp %d", qp_hndl);
/********************** INIT --> RTR ************************/
QP_ATTR_MASK_CLR_ALL(qp_attr_mask);
qp_attr.qp_state = VAPI_RTR;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_QP_STATE);
qp_attr.qp_ous_rd_atom = ib_bmi->ib_qp_ous_rd_atom;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_QP_OUS_RD_ATOM);
qp_attr.path_mtu = ib_bmi->ib_mtu;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_PATH_MTU);
qp_attr.rq_psn = ib_bmi->ib_psn;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_RQ_PSN);
qp_attr.pkey_ix = ib_bmi->ib_pkey_ix;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_PKEY_IX);
qp_attr.min_rnr_timer = ib_bmi->ib_min_rnr_timer;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_MIN_RNR_TIMER);
qp_attr.av.sl = ib_bmi->ib_service_level;
qp_attr.av.grh_flag = FALSE;
qp_attr.av.static_rate = ib_bmi->ib_static_rate;
qp_attr.av.src_path_bits = ib_bmi->ib_src_path_bits;
qp_attr.dest_qp_num = remote_qp_num;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_DEST_QP_NUM);
qp_attr.av.dlid = remote_lid;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_AV);
ret = VAPI_modify_qp(nic, qp_hndl,
&qp_attr, &qp_attr_mask, &qp_cap);
if(VAPI_OK != ret) {
MCA_BMI_IB_VAPI_ERROR(ret, "VAPI_modify_qp");
return OMPI_ERROR;
}
DEBUG_OUT("Modified to RTR..Qp %d", qp_hndl);
/************** RTS *******************/
QP_ATTR_MASK_CLR_ALL(qp_attr_mask);
qp_attr.qp_state = VAPI_RTS;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_QP_STATE);
qp_attr.sq_psn = ib_bmi->ib_psn;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_SQ_PSN);
qp_attr.timeout = ib_bmi->ib_timeout;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_TIMEOUT);
qp_attr.retry_count = ib_bmi->ib_retry_count;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_RETRY_COUNT);
qp_attr.rnr_retry = ib_bmi->ib_rnr_retry;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_RNR_RETRY);
qp_attr.ous_dst_rd_atom = ib_bmi->ib_max_rdma_dst_ops;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_OUS_DST_RD_ATOM);
ret = VAPI_modify_qp(nic, qp_hndl,
&qp_attr, &qp_attr_mask, &qp_cap);
if(VAPI_OK != ret) {
MCA_BMI_IB_VAPI_ERROR(ret, "VAPI_modify_qp");
return OMPI_ERROR;
}
DEBUG_OUT("Modified to RTS..Qp %d", qp_hndl);
ret = VAPI_query_qp(nic, qp_hndl, &qp_attr, &qp_attr_mask, &qp_init_attr );
if (ret != VAPI_OK) {
ompi_output(0, "error querying the queue pair");
return OMPI_ERROR;
}
ib_bmi->ib_inline_max = qp_init_attr.cap.max_inline_data_sq;
return OMPI_SUCCESS;
}

Просмотреть файл

@ -1,220 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MCA_BMI_IB_ENDPOINT_H
#define MCA_BMI_IB_ENDPOINT_H
#include "class/ompi_list.h"
#include "event/event.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "bmi_ib_frag.h"
#include "bmi_ib.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
#define MAX_POST_RR (16)
OBJ_CLASS_DECLARATION(mca_bmi_ib_endpoint_t);
/**
* State of IB endpoint connection.
*/
typedef enum {
/* Defines the state in which this BMI instance
* has started the process of connection */
MCA_BMI_IB_CONNECTING,
/* Waiting for ack from endpoint */
MCA_BMI_IB_CONNECT_ACK,
/* Connected ... both sender & receiver have
* buffers associated with this connection */
MCA_BMI_IB_CONNECTED,
/* Connection is closed, there are no resources
* associated with this */
MCA_BMI_IB_CLOSED,
/* Maximum number of retries have been used.
* Report failure on send to upper layer */
MCA_BMI_IB_FAILED
} mca_bmi_ib_endpoint_state_t;
/**
* An abstraction that represents a connection to a endpoint process.
* An instance of mca_bmi_base_endpoint_t is associated w/ each process
* and BMI pair at startup. However, connections to the endpoint
* are established dynamically on an as-needed basis:
*/
struct mca_bmi_base_endpoint_t {
ompi_list_item_t super;
struct mca_bmi_ib_module_t* endpoint_bmi;
/**< BMI instance that created this connection */
struct mca_bmi_ib_proc_t* endpoint_proc;
/**< proc structure corresponding to endpoint */
mca_bmi_ib_endpoint_state_t endpoint_state;
/**< current state of the connection */
size_t endpoint_retries;
/**< number of connection retries attempted */
double endpoint_tstamp;
/**< timestamp of when the first connection was attempted */
ompi_mutex_t endpoint_send_lock;
/**< lock for concurrent access to endpoint state */
ompi_mutex_t endpoint_recv_lock;
/**< lock for concurrent access to endpoint state */
ompi_list_t pending_send_frags;
/**< list of pending send frags for this endpoint */
VAPI_qp_num_t rem_qp_num_high;
/* High priority remote side QP number */
VAPI_qp_num_t rem_qp_num_low;
/* Low prioirty remote size QP number */
IB_lid_t rem_lid;
/* Local identifier of the remote process */
VAPI_qp_hndl_t lcl_qp_hndl_high;
/* High priority local QP handle */
VAPI_qp_hndl_t lcl_qp_hndl_low;
/* Low priority local QP handle */
VAPI_qp_prop_t lcl_qp_prop_high;
/* High priority local QP properties */
VAPI_qp_prop_t lcl_qp_prop_low;
/* Low priority local QP properties */
};
typedef struct mca_bmi_base_endpoint_t mca_bmi_base_endpoint_t;
typedef mca_bmi_base_endpoint_t mca_bmi_ib_endpoint_t;
int mca_bmi_ib_endpoint_send(mca_bmi_base_endpoint_t* endpoint, struct mca_bmi_ib_frag_t* frag);
int mca_bmi_ib_endpoint_connect(mca_bmi_base_endpoint_t*);
void mca_bmi_ib_post_recv(void);
void mca_bmi_ib_progress_send_frags(mca_bmi_ib_endpoint_t*);
static inline int mca_bmi_ib_endpoint_post_rr_sub(int cnt,
mca_bmi_ib_endpoint_t* endpoint,
ompi_free_list_t* frag_list,
uint32_t* rr_posted,
VAPI_hca_hndl_t nic,
VAPI_qp_hndl_t qp_hndl
)
{
int rc, i;
ompi_list_item_t* item;
mca_bmi_ib_frag_t* frag;
mca_bmi_ib_module_t *ib_bmi = endpoint->endpoint_bmi;
VAPI_rr_desc_t* rr_desc_post = ib_bmi->rr_desc_post;
/* prepare frags and post receive requests */
for(i = 0; i < cnt; i++) {
OMPI_FREE_LIST_WAIT(frag_list, item, rc);
frag = (mca_bmi_ib_frag_t*) item;
frag->endpoint = endpoint;
frag->sg_entry.len = frag->size + ((unsigned char*) frag->segment.seg_addr.pval- (unsigned char*) frag->hdr); /* sizeof(mca_bmi_ib_header_t); */
rr_desc_post[i] = frag->rr_desc;
}
frag->ret = EVAPI_post_rr_list(nic,
qp_hndl,
cnt,
rr_desc_post);
if(VAPI_OK != frag->ret) {
MCA_BMI_IB_VAPI_ERROR(frag->ret, "EVAPI_post_rr_list");
return OMPI_ERROR;
}
OMPI_THREAD_ADD32(rr_posted, cnt);
return OMPI_SUCCESS;
}
static inline int mca_bmi_ib_endpoint_post_rr( mca_bmi_ib_endpoint_t * endpoint, int additional){
mca_bmi_ib_module_t * ib_bmi = endpoint->endpoint_bmi;
int rc;
OMPI_THREAD_LOCK(&ib_bmi->ib_lock);
if(ib_bmi->rr_posted_high <= mca_bmi_ib_component.ib_rr_buf_min+additional && ib_bmi->rr_posted_high < mca_bmi_ib_component.ib_rr_buf_max){
rc = mca_bmi_ib_endpoint_post_rr_sub(mca_bmi_ib_component.ib_rr_buf_max - ib_bmi->rr_posted_high,
endpoint,
&ib_bmi->recv_free_eager,
&ib_bmi->rr_posted_high,
ib_bmi->nic,
endpoint->lcl_qp_hndl_high
);
if(rc != OMPI_SUCCESS){
OMPI_THREAD_UNLOCK(&ib_bmi->ib_lock);
return rc;
}
}
if(ib_bmi->rr_posted_low <= mca_bmi_ib_component.ib_rr_buf_min+additional && ib_bmi->rr_posted_low < mca_bmi_ib_component.ib_rr_buf_max){
rc = mca_bmi_ib_endpoint_post_rr_sub(mca_bmi_ib_component.ib_rr_buf_max - ib_bmi->rr_posted_low,
endpoint,
&ib_bmi->recv_free_max,
&ib_bmi->rr_posted_low,
ib_bmi->nic,
endpoint->lcl_qp_hndl_low
);
if(rc != OMPI_SUCCESS) {
OMPI_THREAD_UNLOCK(&ib_bmi->ib_lock);
return rc;
}
}
OMPI_THREAD_UNLOCK(&ib_bmi->ib_lock);
return OMPI_SUCCESS;
}
#define DUMP_ENDPOINT(endpoint_ptr) { \
ompi_output(0, "[%s:%d] ", __FILE__, __LINE__); \
ompi_output(0, "Dumping endpoint %d state", \
endpoint->endpoint_proc->proc_guid.vpid); \
ompi_output(0, "Local QP hndl : %d", \
endpoint_ptr->endpoint_conn->lres->qp_hndl); \
ompi_output(0, "Local QP num : %d", \
endpoint_ptr->endpoint_conn->lres->qp_prop.qp_num); \
ompi_output(0, "Remote QP num : %d", \
endpoint_ptr->endpoint_conn->rres->qp_num); \
ompi_output(0, "Remote LID : %d", \
endpoint_ptr->endpoint_conn->rres->lid); \
}
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

Просмотреть файл

@ -1,152 +0,0 @@
#include "bmi_ib_frag.h"
#include "mca/common/vapi/vapi_mem_reg.h"
#include "mca/mpool/vapi/mpool_vapi.h"
static void mca_bmi_ib_frag_common_constructor( mca_bmi_ib_frag_t* frag)
{
mca_mpool_vapi_registration_t* mem_hndl = (mca_mpool_vapi_registration_t*) frag->base.super.user_data;
frag->hdr = (mca_bmi_ib_header_t*) (frag+1); /* initialize the bmi header to point to start at end of frag */
#if 0
mod = (unsigned long) frag->hdr % MCA_BMI_IB_FRAG_ALIGN;
if(mod != 0) {
frag->hdr = (mca_bmi_ib_header_t*) ((unsigned char*) frag->hdr + (MCA_BMI_IB_FRAG_ALIGN - mod));
}
#endif
frag->segment.seg_addr.pval = ((unsigned char* )frag->hdr) + sizeof(mca_bmi_ib_header_t); /* init the segment address to start after the bmi header */
#if 0
mod = (frag->segment.seg_addr.lval) % MCA_BMI_IB_FRAG_ALIGN;
if(mod != 0) {
frag->segment.seg_addr.lval += (MCA_BMI_IB_FRAG_ALIGN - mod);
}
#endif
frag->mem_hndl = mem_hndl->hndl;
frag->segment.seg_len = frag->size;
frag->segment.seg_key.key32[0] = (uint32_t) mem_hndl->l_key;
frag->sg_entry.lkey = mem_hndl->l_key;
frag->sg_entry.addr = (VAPI_virt_addr_t) (MT_virt_addr_t) frag->hdr;
frag->base.des_flags = 0;
}
static void mca_bmi_ib_send_frag_common_constructor(mca_bmi_ib_frag_t* frag)
{
mca_bmi_ib_frag_common_constructor(frag);
frag->base.des_src = &frag->segment;
frag->base.des_src_cnt = 1;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->sr_desc.comp_type = VAPI_SIGNALED;
frag->sr_desc.opcode = VAPI_SEND;
frag->sr_desc.remote_qkey = 0;
frag->sr_desc.sg_lst_len = 1;
frag->sr_desc.sg_lst_p = &frag->sg_entry;
frag->sr_desc.id = (VAPI_virt_addr_t) (MT_virt_addr_t) frag;
}
static void mca_bmi_ib_recv_frag_common_constructor(mca_bmi_ib_frag_t* frag)
{
mca_bmi_ib_frag_common_constructor(frag);
frag->base.des_dst = &frag->segment;
frag->base.des_dst_cnt = 1;
frag->base.des_src = NULL;
frag->base.des_src_cnt = 0;
frag->rr_desc.comp_type = VAPI_SIGNALED;
frag->rr_desc.opcode = VAPI_RECEIVE;
frag->rr_desc.sg_lst_len = 1;
frag->rr_desc.sg_lst_p = &frag->sg_entry;
frag->rr_desc.id = (VAPI_virt_addr_t) (MT_virt_addr_t) frag;
}
static void mca_bmi_ib_send_frag_eager_constructor(mca_bmi_ib_frag_t* frag)
{
frag->size = mca_bmi_ib_component.eager_limit;
mca_bmi_ib_send_frag_common_constructor(frag);
}
static void mca_bmi_ib_send_frag_max_constructor(mca_bmi_ib_frag_t* frag)
{
frag->size = mca_bmi_ib_component.max_send_size;
mca_bmi_ib_send_frag_common_constructor(frag);
}
static void mca_bmi_ib_recv_frag_max_constructor(mca_bmi_ib_frag_t* frag)
{
frag->size = mca_bmi_ib_component.max_send_size;
mca_bmi_ib_recv_frag_common_constructor(frag);
}
static void mca_bmi_ib_recv_frag_eager_constructor(mca_bmi_ib_frag_t* frag)
{
frag->size = mca_bmi_ib_component.eager_limit;
mca_bmi_ib_recv_frag_common_constructor(frag);
}
static void mca_bmi_ib_send_frag_frag_constructor(mca_bmi_ib_frag_t* frag)
{
frag->size = 0;
mca_bmi_ib_send_frag_common_constructor(frag);
}
OBJ_CLASS_INSTANCE(
mca_bmi_ib_frag_t,
mca_bmi_base_descriptor_t,
NULL,
NULL);
OBJ_CLASS_INSTANCE(
mca_bmi_ib_send_frag_eager_t,
mca_bmi_base_descriptor_t,
mca_bmi_ib_send_frag_eager_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_bmi_ib_send_frag_max_t,
mca_bmi_base_descriptor_t,
mca_bmi_ib_send_frag_max_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_bmi_ib_send_frag_frag_t,
mca_bmi_base_descriptor_t,
mca_bmi_ib_send_frag_frag_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_bmi_ib_recv_frag_eager_t,
mca_bmi_base_descriptor_t,
mca_bmi_ib_recv_frag_eager_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_bmi_ib_recv_frag_max_t,
mca_bmi_base_descriptor_t,
mca_bmi_ib_recv_frag_max_constructor,
NULL);

Просмотреть файл

@ -1,149 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MCA_BMI_IB_FRAG_H
#define MCA_BMI_IB_FRAG_H
#define MCA_BMI_IB_FRAG_ALIGN (8)
#include "ompi_config.h"
#include "bmi_ib.h"
#include <vapi.h>
#include <mtl_common.h>
#include <vapi_common.h>
#include "mca/mpool/vapi/mpool_vapi.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_bmi_ib_frag_t);
typedef mca_bmi_base_header_t mca_bmi_ib_header_t;
typedef enum {
MCA_BMI_IB_FRAG_SEND,
MCA_BMI_IB_FRAG_PUT,
MCA_BMI_IB_FRAG_GET,
MCA_BMI_IB_FRAG_ACK
} mca_bmi_ib_frag_type_t;
/**
* IB send fragment derived type.
*/
struct mca_bmi_ib_frag_t {
mca_bmi_base_descriptor_t base;
mca_bmi_base_segment_t segment;
struct mca_bmi_base_endpoint_t *endpoint;
mca_bmi_ib_frag_type_t type;
size_t size;
int rc;
union{
VAPI_rr_desc_t rr_desc;
VAPI_sr_desc_t sr_desc;
};
VAPI_sg_lst_entry_t sg_entry;
VAPI_mr_hndl_t mem_hndl;
VAPI_ret_t ret;
mca_bmi_ib_header_t *hdr;
mca_mpool_vapi_registration_t * vapi_reg;
};
typedef struct mca_bmi_ib_frag_t mca_bmi_ib_frag_t;
OBJ_CLASS_DECLARATION(mca_bmi_ib_frag_t);
typedef struct mca_bmi_ib_frag_t mca_bmi_ib_send_frag_eager_t;
OBJ_CLASS_DECLARATION(mca_bmi_ib_send_frag_eager_t);
typedef struct mca_bmi_ib_frag_t mca_bmi_ib_send_frag_max_t;
OBJ_CLASS_DECLARATION(mca_bmi_ib_send_frag_max_t);
typedef struct mca_bmi_ib_frag_t mca_bmi_ib_send_frag_frag_t;
OBJ_CLASS_DECLARATION(mca_bmi_ib_send_frag_frag_t);
typedef struct mca_bmi_ib_frag_t mca_bmi_ib_recv_frag_eager_t;
OBJ_CLASS_DECLARATION(mca_bmi_ib_recv_frag_eager_t);
typedef struct mca_bmi_ib_frag_t mca_bmi_ib_recv_frag_max_t;
OBJ_CLASS_DECLARATION(mca_bmi_ib_recv_frag_max_t);
/*
* Allocate an IB send descriptor
*
*/
#define MCA_BMI_IB_FRAG_ALLOC_EAGER(bmi, frag, rc) \
{ \
\
ompi_list_item_t *item; \
OMPI_FREE_LIST_WAIT(&((mca_bmi_ib_module_t*)bmi)->send_free_eager, item, rc); \
frag = (mca_bmi_ib_frag_t*) item; \
}
#define MCA_BMI_IB_FRAG_RETURN_EAGER(bmi, frag) \
{ \
OMPI_FREE_LIST_RETURN(&((mca_bmi_ib_module_t*)bmi)->send_free_eager, (ompi_list_item_t*)(frag)); \
}
#define MCA_BMI_IB_FRAG_ALLOC_MAX(bmi, frag, rc) \
{ \
\
ompi_list_item_t *item; \
OMPI_FREE_LIST_WAIT(&((mca_bmi_ib_module_t*)bmi)->send_free_max, item, rc); \
frag = (mca_bmi_ib_frag_t*) item; \
}
#define MCA_BMI_IB_FRAG_RETURN_MAX(bmi, frag) \
{ \
OMPI_FREE_LIST_RETURN(&((mca_bmi_ib_module_t*)bmi)->send_free_max, (ompi_list_item_t*)(frag)); \
}
#define MCA_BMI_IB_FRAG_ALLOC_FRAG(bmi, frag, rc) \
{ \
\
ompi_list_item_t *item; \
OMPI_FREE_LIST_WAIT(&((mca_bmi_ib_module_t*)bmi)->send_free_frag, item, rc); \
frag = (mca_bmi_ib_frag_t*) item; \
}
#define MCA_BMI_IB_FRAG_RETURN_FRAG(bmi, frag) \
{ \
OMPI_FREE_LIST_RETURN(&((mca_bmi_ib_module_t*)bmi)->send_free_frag, (ompi_list_item_t*)(frag)); \
}
struct mca_bmi_ib_module_t;
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

Просмотреть файл

@ -1,161 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "class/ompi_hash_table.h"
#include "mca/base/mca_base_module_exchange.h"
#include "bmi_ib.h"
#include "bmi_ib_proc.h"
static void mca_bmi_ib_proc_construct(mca_bmi_ib_proc_t* proc);
static void mca_bmi_ib_proc_destruct(mca_bmi_ib_proc_t* proc);
OBJ_CLASS_INSTANCE(mca_bmi_ib_proc_t,
ompi_list_item_t, mca_bmi_ib_proc_construct,
mca_bmi_ib_proc_destruct);
void mca_bmi_ib_proc_construct(mca_bmi_ib_proc_t* proc)
{
proc->proc_ompi = 0;
proc->proc_addr_count = 0;
proc->proc_endpoints = 0;
proc->proc_endpoint_count = 0;
OBJ_CONSTRUCT(&proc->proc_lock, ompi_mutex_t);
/* add to list of all proc instance */
OMPI_THREAD_LOCK(&mca_bmi_ib_component.ib_lock);
ompi_list_append(&mca_bmi_ib_component.ib_procs, &proc->super);
OMPI_THREAD_UNLOCK(&mca_bmi_ib_component.ib_lock);
}
/*
* Cleanup ib proc instance
*/
void mca_bmi_ib_proc_destruct(mca_bmi_ib_proc_t* proc)
{
/* remove from list of all proc instances */
OMPI_THREAD_LOCK(&mca_bmi_ib_component.ib_lock);
ompi_list_remove_item(&mca_bmi_ib_component.ib_procs, &proc->super);
OMPI_THREAD_UNLOCK(&mca_bmi_ib_component.ib_lock);
/* release resources */
if(NULL != proc->proc_endpoints) {
free(proc->proc_endpoints);
}
}
/*
* Look for an existing IB process instances based on the associated
* ompi_proc_t instance.
*/
static mca_bmi_ib_proc_t* mca_bmi_ib_proc_lookup_ompi(ompi_proc_t* ompi_proc)
{
mca_bmi_ib_proc_t* ib_proc;
OMPI_THREAD_LOCK(&mca_bmi_ib_component.ib_lock);
for(ib_proc = (mca_bmi_ib_proc_t*)
ompi_list_get_first(&mca_bmi_ib_component.ib_procs);
ib_proc != (mca_bmi_ib_proc_t*)
ompi_list_get_end(&mca_bmi_ib_component.ib_procs);
ib_proc = (mca_bmi_ib_proc_t*)ompi_list_get_next(ib_proc)) {
if(ib_proc->proc_ompi == ompi_proc) {
OMPI_THREAD_UNLOCK(&mca_bmi_ib_component.ib_lock);
return ib_proc;
}
}
OMPI_THREAD_UNLOCK(&mca_bmi_ib_component.ib_lock);
return NULL;
}
/*
* Create a IB process structure. There is a one-to-one correspondence
* between a ompi_proc_t and a mca_bmi_ib_proc_t instance. We cache
* additional data (specifically the list of mca_bmi_ib_endpoint_t instances,
* and published addresses) associated w/ a given destination on this
* datastructure.
*/
mca_bmi_ib_proc_t* mca_bmi_ib_proc_create(ompi_proc_t* ompi_proc)
{
mca_bmi_ib_proc_t* module_proc = NULL;
/* Check if we have already created a IB proc
* structure for this ompi process */
module_proc = mca_bmi_ib_proc_lookup_ompi(ompi_proc);
if(module_proc != NULL) {
/* Gotcha! */
return module_proc;
}
/* Oops! First time, gotta create a new IB proc
* out of the ompi_proc ... */
module_proc = OBJ_NEW(mca_bmi_ib_proc_t);
/* Initialize number of peer */
module_proc->proc_endpoint_count = 0;
module_proc->proc_ompi = ompi_proc;
/* build a unique identifier (of arbitrary
* size) to represent the proc */
module_proc->proc_guid = ompi_proc->proc_name;
/* IB module doesn't have addresses exported at
* initialization, so the addr_count is set to one. */
module_proc->proc_addr_count = 1;
/* XXX: Right now, there can be only 1 peer associated
* with a proc. Needs a little bit change in
* mca_bmi_ib_proc_t to allow on demand increasing of
* number of endpoints for this proc */
module_proc->proc_endpoints = (mca_bmi_base_endpoint_t**)
malloc(module_proc->proc_addr_count * sizeof(mca_bmi_base_endpoint_t*));
if(NULL == module_proc->proc_endpoints) {
OBJ_RELEASE(module_proc);
return NULL;
}
return module_proc;
}
/*
* Note that this routine must be called with the lock on the process
* already held. Insert a bmi instance into the proc array and assign
* it an address.
*/
int mca_bmi_ib_proc_insert(mca_bmi_ib_proc_t* module_proc,
mca_bmi_base_endpoint_t* module_endpoint)
{
/* insert into endpoint array */
module_endpoint->endpoint_proc = module_proc;
module_proc->proc_endpoints[module_proc->proc_endpoint_count++] = module_endpoint;
return OMPI_SUCCESS;
}

Просмотреть файл

@ -1,67 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MCA_BMI_IB_PROC_H
#define MCA_BMI_IB_PROC_H
#include "mca/ns/ns.h"
#include "class/ompi_object.h"
#include "proc/proc.h"
#include "bmi_ib.h"
#include "bmi_ib_endpoint.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
OBJ_CLASS_DECLARATION(mca_bmi_ib_proc_t);
/**
* Represents the state of a remote process and the set of addresses
* that it exports. Also cache an instance of mca_bmi_base_endpoint_t for
* each
* BMI instance that attempts to open a connection to the process.
*/
struct mca_bmi_ib_proc_t {
ompi_list_item_t super;
/**< allow proc to be placed on a list */
ompi_proc_t *proc_ompi;
/**< pointer to corresponding ompi_proc_t */
orte_process_name_t proc_guid;
/**< globally unique identifier for the process */
size_t proc_addr_count;
/**< number of addresses published by endpoint */
struct mca_bmi_base_endpoint_t **proc_endpoints;
/**< array of endpoints that have been created to access this proc */
size_t proc_endpoint_count;
/**< number of endpoints */
ompi_mutex_t proc_lock;
/**< lock to protect against concurrent access to proc state */
};
typedef struct mca_bmi_ib_proc_t mca_bmi_ib_proc_t;
mca_bmi_ib_proc_t* mca_bmi_ib_proc_create(ompi_proc_t* ompi_proc);
int mca_bmi_ib_proc_insert(mca_bmi_ib_proc_t*, mca_bmi_base_endpoint_t*);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

Просмотреть файл

@ -1,22 +0,0 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# 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.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Specific to this module
PARAM_INIT_FILE=bmi_ib.c
PARAM_CONFIG_HEADER_FILE="ib_config.h"
PARAM_CONFIG_FILES="Makefile"

Просмотреть файл

@ -1,152 +0,0 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# 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.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
#
# Main function. This will be invoked in the middle of the templated
# configure script.
#
AC_DEFUN([MCA_CONFIGURE_STUB],[
# Additional --with flags that can be specified
AC_ARG_WITH(bmi-ib,
AC_HELP_STRING([--with-bmi-ib=IBDIR],
[Specify the installation directory of IB (should enable the correct automatic determination of using the 32 or 64 bit library, if both are present under IBDIR/lib and IBDIR/lib64)]))
AC_ARG_WITH(bmi-ib-libdir,
AC_HELP_STRING([--with-bmi-ib-libdir=IBLIBDIR],
[directory where the IB library can be found, if it is not in $IBDIR/lib or $IBDIR/lib64]))
# Quick sanity check
if test "$with_bmi_ib" = "no"; then
AC_MSG_WARN([*** --without-bmi-ib specified -- aborting])
AC_MSG_ERROR([Will not continue])
fi
# Find the right IBDIR
if test "$with_bmi_ib" != "" -a "$with_bmi_ib" != "yes" ; then
IBDIR="$with_bmi_ib"
IBLIBDIR="$with_bmi_ib"
fi
if test "$with_bmi_ib_libdir" != "" -a "$with_bmi_ib_libdir" != "yes" -a \
"$with_bmi_ib_libdir" != "no"; then
IBLIBDIR="$with_bmi_ib_libdir"
fi
# Add to CPPFLAGS if necessary
EXTRA_CPPFLAGS=
if test "$IBDIR" != ""; then
if test -d "$IBDIR/include"; then
EXTRA_CPPFLAGS="-I$IBDIR/include"
else
AC_MSG_WARN([*** Warning: cannot find $IBDIR/include])
AC_MSG_WARN([*** Will still try to configure ib bmi anyway...])
fi
if test "$IBDIR" != "" -a -d "$IBDIR/wrap"; then
EXTRA_CPPFLAGS="-I$IBDIR/wrap $EXTRA_CPPFLAGS"
else
AC_MSG_WARN([*** Warning: cannot find $IBDIR/wrap])
AC_MSG_WARN([*** Will still try to configure ib bmi anyway...])
fi
fi
# See if we can find vapi.h
CPPFLAGS="$CPPFLAGS $EXTRA_CPPFLAGS"
AC_CHECK_HEADERS(vapi.h,,
AC_MSG_ERROR([*** Cannot find working vapi.h]))
# Note that it is possible to find the library even if -L is not
# specified, if the LD_LIBRARY_PATH includes the directory where
# the shared ib library is kept. Hence, we unset LD_LIBRARY_PATH
# before running this test.
LD_LIBRARY_PATH_save="$LD_LIBRARY_PATH"
unset LD_LIBRARY_PATH
# Helpfer function to try to find libvapi (called from below). In
# some versions of Mellanox (v3.1), we need to expliitly link in
# the thread libraries. #$%#@$%@%#$!!!
# Many vapi.h's have horrid semantics and don't obey ISOC99
# standards. So we have to turn off flags like -pedantic. Sigh.
CFLAGS="`echo $CFLAGS | sed 's/-pedantic//g'`"
mca_bmi_ib_try_find_libvapi() {
func1=[$]1
func2=[$]2
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
vapi_badness=
AC_CHECK_LIB([vapi], [$func1], [], [vapi_badness=true],
[-lmtl_common -lmpga -lmosal])
if test "$vapi_badness" != ""; then
AC_CHECK_LIB([pthread], [pthread_create],
[pthread=yes LIBS="$LIBS -lpthread"],
[pthread=no])
if test "$pthread" = "yes"; then
AC_CHECK_LIB([vapi], [$func2], [], [],
[-lmtl_common -lmpga -lmosal])
fi
fi
}
# The libraries may be in $IBDIR/lib or $IBDIR/lib64. Try them
# both.
LIBS_save="$LIBS"
LDFLAGS_save="$LDFLAGS"
LIBS="$LIBS -lmosal -lmpga -lmtl_common"
LIBS_orig="$LIBS"
EXTRA_LDFLAGS=
if test -d "$IBLIBDIR/lib"; then
EXTRA_LDFLAGS="-L$IBLIBDIR/lib"
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
mca_bmi_ib_try_find_libvapi VAPI_open_hca VAPI_query_hca_cap
if test "$LIBS" != "$LIBS_orig"; then
echo "--> found libvapi in $IBLIBDIR/lib"
fi
fi
if test "$LIBS" = "$LIBS_orig" -a -d "$IBLIBDIR/lib64"; then
EXTRA_LDFLAGS="-L$IBLIBDIR/lib64"
LDFLAGS="$LDFLAGS_save $EXTRA_LDFLAGS"
mca_bmi_ib_try_find_libvapi EVAPI_list_hcas EVAPI_open_hca
if test "$LIBS" != "$LIBS_orig"; then
echo "--> found libvapi in $IBLIBDIR/lib64"
fi
fi
if test "$LIBS" = "$LIBS_orig"; then
AC_MSG_ERROR([*** Cannot find working libvapi.])
fi
LD_LIBRARY_PATH="$LD_LIBRARY_PATH_save"
LIBS="$LIBS -lmtl_common -lmpga"
#
# Save extra compiler/linker flags so that they can be added in
# the wrapper compilers, if necessary
#
WRAPPER_EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
WRAPPER_EXTRA_LIBS="-lvapi -lmtl_common -lmpga -lmosal"
])dnl

Просмотреть файл

@ -19,28 +19,28 @@
include $(top_ompi_srcdir)/config/Makefile.options
sources = \
btl_ib.c \
btl_ib.h \
btl_ib_component.c \
btl_ib_endpoint.c \
btl_ib_endpoint.h \
btl_ib_frag.c \
btl_ib_frag.h \
btl_ib_proc.c \
btl_ib_proc.h \
btl_ib_error.h
btl_mvapi.c \
btl_mvapi.h \
btl_mvapi_component.c \
btl_mvapi_endpoint.c \
btl_mvapi_endpoint.h \
btl_mvapi_frag.c \
btl_mvapi_frag.h \
btl_mvapi_proc.c \
btl_mvapi_proc.h \
btl_mvapi_error.h
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if OMPI_BUILD_btl_ib_DSO
if OMPI_BUILD_btl_mvapi_DSO
lib =
lib_sources =
component = mca_btl_ib.la
component = mca_btl_mvapi.la
component_sources = $(sources)
else
lib = libmca_btl_ib.la
lib = libmca_btl_mvapi.la
lib_sources = $(sources)
component =
component_sources =
@ -48,9 +48,9 @@ endif
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component)
mca_btl_ib_la_SOURCES = $(component_sources)
mca_btl_ib_la_LDFLAGS = -module -avoid-version
mca_btl_mvapi_la_SOURCES = $(component_sources)
mca_btl_mvapi_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(lib)
libmca_btl_ib_la_SOURCES = $(lib_sources)
libmca_btl_ib_la_LDFLAGS = -module -avoid-version
libmca_btl_mvapi_la_SOURCES = $(lib_sources)
libmca_btl_mvapi_la_LDFLAGS = -module -avoid-version

Просмотреть файл

@ -21,19 +21,19 @@
#include "mca/pml/pml.h"
#include "mca/btl/btl.h"
#include "btl_ib.h"
#include "btl_ib_frag.h"
#include "btl_ib_proc.h"
#include "btl_ib_endpoint.h"
#include "btl_mvapi.h"
#include "btl_mvapi_frag.h"
#include "btl_mvapi_proc.h"
#include "btl_mvapi_endpoint.h"
#include "datatype/convertor.h"
#include "mca/common/vapi/vapi_mem_reg.h"
#include "mca/mpool/base/base.h"
#include "mca/mpool/mpool.h"
#include "mca/mpool/vapi/mpool_vapi.h"
mca_btl_ib_module_t mca_btl_ib_module = {
mca_btl_mvapi_module_t mca_btl_mvapi_module = {
{
&mca_btl_ib_component.super,
&mca_btl_mvapi_component.super,
0, /* max size of first fragment */
0, /* min send fragment size */
0, /* max send fragment size */
@ -43,40 +43,40 @@ mca_btl_ib_module_t mca_btl_ib_module = {
0, /* latency */
0, /* bandwidth */
0, /* TODO this should be PUT btl flags */
mca_btl_ib_add_procs,
mca_btl_ib_del_procs,
mca_btl_ib_register,
mca_btl_ib_finalize,
mca_btl_mvapi_add_procs,
mca_btl_mvapi_del_procs,
mca_btl_mvapi_register,
mca_btl_mvapi_finalize,
/* we need alloc free, pack */
mca_btl_ib_alloc,
mca_btl_ib_free,
mca_btl_ib_prepare_src,
mca_btl_ib_prepare_dst,
mca_btl_ib_send,
mca_btl_ib_put,
mca_btl_mvapi_alloc,
mca_btl_mvapi_free,
mca_btl_mvapi_prepare_src,
mca_btl_mvapi_prepare_dst,
mca_btl_mvapi_send,
mca_btl_mvapi_put,
NULL /* get */
}
};
int mca_btl_ib_add_procs(
int mca_btl_mvapi_add_procs(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **ompi_procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable)
{
mca_btl_ib_module_t* ib_btl = (mca_btl_ib_module_t*)btl;
mca_btl_mvapi_module_t* mvapi_btl = (mca_btl_mvapi_module_t*)btl;
int i, rc;
for(i = 0; i < (int) nprocs; i++) {
struct ompi_proc_t* ompi_proc = ompi_procs[i];
mca_btl_ib_proc_t* ib_proc;
mca_btl_mvapi_proc_t* ib_proc;
mca_btl_base_endpoint_t* ib_peer;
if(NULL == (ib_proc = mca_btl_ib_proc_create(ompi_proc))) {
if(NULL == (ib_proc = mca_btl_mvapi_proc_create(ompi_proc))) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
@ -92,14 +92,14 @@ int mca_btl_ib_add_procs(
* instances that are trying to reach this destination.
* Cache the peer instance on the btl_proc.
*/
ib_peer = OBJ_NEW(mca_btl_ib_endpoint_t);
ib_peer = OBJ_NEW(mca_btl_mvapi_endpoint_t);
if(NULL == ib_peer) {
OMPI_THREAD_UNLOCK(&module_proc->proc_lock);
return OMPI_ERR_OUT_OF_RESOURCE;
}
ib_peer->endpoint_btl = ib_btl;
rc = mca_btl_ib_proc_insert(ib_proc, ib_peer);
ib_peer->endpoint_btl = mvapi_btl;
rc = mca_btl_mvapi_proc_insert(ib_proc, ib_peer);
if(rc != OMPI_SUCCESS) {
OBJ_RELEASE(ib_peer);
OMPI_THREAD_UNLOCK(&module_proc->proc_lock);
@ -114,7 +114,7 @@ int mca_btl_ib_add_procs(
return OMPI_SUCCESS;
}
int mca_btl_ib_del_procs(struct mca_btl_base_module_t* btl,
int mca_btl_mvapi_del_procs(struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t ** peers)
@ -124,19 +124,19 @@ int mca_btl_ib_del_procs(struct mca_btl_base_module_t* btl,
return OMPI_SUCCESS;
}
int mca_btl_ib_register(
int mca_btl_mvapi_register(
struct mca_btl_base_module_t* btl,
mca_btl_base_tag_t tag,
mca_btl_base_module_recv_cb_fn_t cbfunc,
void* cbdata)
{
/* TODO add register stuff here... */
mca_btl_ib_module_t* ib_btl = (mca_btl_ib_module_t*) btl;
mca_btl_mvapi_module_t* mvapi_btl = (mca_btl_mvapi_module_t*) btl;
OMPI_THREAD_LOCK(&ib->btl.ib_lock);
ib_btl->ib_reg[tag].cbfunc = cbfunc;
ib_btl->ib_reg[tag].cbdata = cbdata;
mvapi_btl->ib_reg[tag].cbfunc = cbfunc;
mvapi_btl->ib_reg[tag].cbdata = cbdata;
OMPI_THREAD_UNLOCK(&ib->btl.ib_lock);
return OMPI_SUCCESS;
}
@ -145,31 +145,31 @@ int mca_btl_ib_register(
/**
* Allocate a segment.
*
* @param btl (IN) BMI module
* @param btl (IN) BTL module
* @param size (IN) Request segment size.
*/
mca_btl_base_descriptor_t* mca_btl_ib_alloc(
mca_btl_base_descriptor_t* mca_btl_mvapi_alloc(
struct mca_btl_base_module_t* btl,
size_t size)
{
mca_btl_ib_frag_t* frag;
mca_btl_ib_module_t* ib_btl;
mca_btl_mvapi_frag_t* frag;
mca_btl_mvapi_module_t* mvapi_btl;
int rc;
ib_btl = (mca_btl_ib_module_t*) btl;
mvapi_btl = (mca_btl_mvapi_module_t*) btl;
if(size <= mca_btl_ib_component.eager_limit){
MCA_BMI_IB_FRAG_ALLOC_EAGER(btl, frag, rc);
if(size <= mca_btl_mvapi_component.eager_limit){
MCA_BTL_IB_FRAG_ALLOC_EAGER(btl, frag, rc);
frag->segment.seg_len =
size <= mca_btl_ib_component.eager_limit ?
size: mca_btl_ib_component.eager_limit ;
size <= mca_btl_mvapi_component.eager_limit ?
size: mca_btl_mvapi_component.eager_limit ;
} else {
MCA_BMI_IB_FRAG_ALLOC_MAX(btl, frag, rc);
MCA_BTL_IB_FRAG_ALLOC_MAX(btl, frag, rc);
frag->segment.seg_len =
size <= mca_btl_ib_component.max_send_size ?
size: mca_btl_ib_component.max_send_size ;
size <= mca_btl_mvapi_component.max_send_size ?
size: mca_btl_mvapi_component.max_send_size ;
}
frag->segment.seg_len = size <= ib_btl->super.btl_eager_limit ? size : ib_btl->super.btl_eager_limit;
frag->segment.seg_len = size <= mvapi_btl->super.btl_eager_limit ? size : mvapi_btl->super.btl_eager_limit;
frag->base.des_flags = 0;
return (mca_btl_base_descriptor_t*)frag;
@ -179,23 +179,23 @@ mca_btl_base_descriptor_t* mca_btl_ib_alloc(
*
*
*/
int mca_btl_ib_free(
int mca_btl_mvapi_free(
struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* des)
{
mca_btl_ib_frag_t* frag = (mca_btl_ib_frag_t*)des;
mca_btl_mvapi_frag_t* frag = (mca_btl_mvapi_frag_t*)des;
if(frag->size == 0) {
MCA_BMI_IB_FRAG_RETURN_FRAG(btl, frag);
MCA_BTL_IB_FRAG_RETURN_FRAG(btl, frag);
OBJ_RELEASE(frag->vapi_reg);
}
else if(frag->size == mca_btl_ib_component.max_send_size){
MCA_BMI_IB_FRAG_RETURN_MAX(btl, frag);
} else if(frag->size == mca_btl_ib_component.eager_limit){
MCA_BMI_IB_FRAG_RETURN_EAGER(btl, frag);
else if(frag->size == mca_btl_mvapi_component.max_send_size){
MCA_BTL_IB_FRAG_RETURN_MAX(btl, frag);
} else if(frag->size == mca_btl_mvapi_component.eager_limit){
MCA_BTL_IB_FRAG_RETURN_EAGER(btl, frag);
}
return OMPI_SUCCESS;
@ -206,10 +206,10 @@ int mca_btl_ib_free(
* Pack data and return a descriptor that can be
* used for send/put.
*
* @param btl (IN) BMI module
* @param peer (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
mca_btl_base_descriptor_t* mca_btl_mvapi_prepare_src(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* endpoint,
mca_mpool_base_registration_t* registration,
@ -218,8 +218,8 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
size_t* size
)
{
mca_btl_ib_module_t* ib_btl;
mca_btl_ib_frag_t* frag;
mca_btl_mvapi_module_t* mvapi_btl;
mca_btl_mvapi_frag_t* frag;
mca_mpool_vapi_registration_t * vapi_reg;
struct iovec iov;
int32_t iov_count = 1;
@ -228,7 +228,7 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
int rc;
ib_btl = (mca_btl_ib_module_t*) btl;
mvapi_btl = (mca_btl_mvapi_module_t*) btl;
vapi_reg = (mca_mpool_vapi_registration_t*) registration;
/** if the data fits in the eager limit and we aren't told to pinn then we
@ -238,7 +238,7 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
if(NULL != vapi_reg && 0 == ompi_convertor_need_buffers(convertor)){
bool is_leave_pinned = vapi_reg->is_leave_pinned;
MCA_BMI_IB_FRAG_ALLOC_FRAG(btl, frag, rc);
MCA_BTL_IB_FRAG_ALLOC_FRAG(btl, frag, rc);
if(NULL == frag){
return NULL;
}
@ -254,37 +254,37 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
frag->segment.seg_addr.pval = iov.iov_base;
size_t reg_len;
reg_len = (unsigned char*)vapi_reg->bound - (unsigned char*)iov.iov_base + 1;
reg_len = (unsigned char*)vapi_reg->base_reg.bound - (unsigned char*)iov.iov_base + 1;
if(frag->segment.seg_len > reg_len) {
size_t new_len = vapi_reg->bound - vapi_reg->base + 1
size_t new_len = vapi_reg->base_reg.bound - vapi_reg->base_reg.base + 1
+ frag->segment.seg_len - reg_len;
void * base_addr = vapi_reg->base;
void * base_addr = vapi_reg->base_reg.base;
rc = mca_mpool_base_remove((void*) vapi_reg->base);
rc = mca_mpool_base_remove((void*) vapi_reg->base_reg.base);
if(OMPI_SUCCESS != rc) {
ompi_output(0, "%s:%d:%s error removing memory region from memory pool tree", __FILE__, __LINE__, __func__);
return NULL;
}
if(is_leave_pinned) {
if(NULL == ompi_list_remove_item(&ib_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg)){
if(NULL == ompi_list_remove_item(&mvapi_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg)){
ompi_output(0,"%s:%d:%s error removing item from reg_mru_list", __FILE__, __LINE__, __func__);
return NULL;
}
}
OBJ_RELEASE(vapi_reg);
ib_btl->ib_pool->mpool_register(ib_btl->ib_pool,
mvapi_btl->ib_pool->mpool_register(mvapi_btl->ib_pool,
base_addr,
new_len,
(mca_mpool_base_registration_t**) &vapi_reg);
rc = mca_mpool_base_insert(vapi_reg->base,
vapi_reg->bound - vapi_reg->base + 1,
ib_btl->ib_pool,
(void*) (&ib_btl->super),
rc = mca_mpool_base_insert(vapi_reg->base_reg.base,
vapi_reg->base_reg.bound - vapi_reg->base_reg.base + 1,
mvapi_btl->ib_pool,
(void*) (&mvapi_btl->super),
(mca_mpool_base_registration_t*) vapi_reg);
@ -296,15 +296,15 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
OBJ_RETAIN(vapi_reg);
if(is_leave_pinned) {
vapi_reg->is_leave_pinned = is_leave_pinned;
ompi_list_append(&ib_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg);
ompi_list_append(&mvapi_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg);
}
}
else if(is_leave_pinned) {
if(NULL == ompi_list_remove_item(&ib_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg)) {
if(NULL == ompi_list_remove_item(&mvapi_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg)) {
ompi_output(0,"%s:%d:%s error removing item from reg_mru_list", __FILE__, __LINE__, __func__);
return NULL;
}
ompi_list_append(&ib_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg);
ompi_list_append(&mvapi_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg);
}
frag->mem_hndl = vapi_reg->hndl;
@ -324,11 +324,11 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
return &frag->base;
} else if((mca_btl_ib_component.leave_pinned || max_data > btl->btl_max_send_size) &&
} else if((mca_btl_mvapi_component.leave_pinned || max_data > btl->btl_max_send_size) &&
ompi_convertor_need_buffers(convertor) == 0 &&
reserve == 0)
{
MCA_BMI_IB_FRAG_ALLOC_FRAG(btl, frag, rc);
MCA_BTL_IB_FRAG_ALLOC_FRAG(btl, frag, rc);
if(NULL == frag){
return NULL;
}
@ -344,12 +344,12 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
frag->base.des_flags = 0;
if(mca_btl_ib_component.leave_pinned) {
if(mca_btl_ib_component.reg_mru_len <= ib_btl->reg_mru_list.ompi_list_length ) {
if(mca_btl_mvapi_component.leave_pinned) {
if(mca_btl_mvapi_component.reg_mru_len <= mvapi_btl->reg_mru_list.ompi_list_length ) {
mca_mpool_vapi_registration_t* old_reg =
(mca_mpool_vapi_registration_t*)
ompi_list_remove_last(&ib_btl->reg_mru_list);
ompi_list_remove_last(&mvapi_btl->reg_mru_list);
if( NULL == old_reg) {
ompi_output(0,"%s:%d:%s error removing item from reg_mru_list", __FILE__, __LINE__, __func__);
@ -357,7 +357,7 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
}
rc = mca_mpool_base_remove((void*) old_reg->base);
rc = mca_mpool_base_remove((void*) old_reg->base_reg.base);
if(OMPI_SUCCESS != rc) {
ompi_output(0,"%s:%d:%s error removing memory region from memory pool tree", __FILE__, __LINE__, __func__);
@ -367,15 +367,15 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
OBJ_RELEASE(old_reg);
}
ib_btl->ib_pool->mpool_register(ib_btl->ib_pool,
mvapi_btl->ib_pool->mpool_register(mvapi_btl->ib_pool,
iov.iov_base,
max_data,
(mca_mpool_base_registration_t**) &vapi_reg);
rc = mca_mpool_base_insert(vapi_reg->base,
vapi_reg->bound - vapi_reg->base + 1,
ib_btl->ib_pool,
(void*) (&ib_btl->super),
rc = mca_mpool_base_insert(vapi_reg->base_reg.base,
vapi_reg->base_reg.bound - vapi_reg->base_reg.base + 1,
mvapi_btl->ib_pool,
(void*) (&mvapi_btl->super),
(mca_mpool_base_registration_t*) vapi_reg);
if(rc != OMPI_SUCCESS)
return NULL;
@ -383,10 +383,10 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
vapi_reg->is_leave_pinned = true;
ompi_list_append(&ib_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg);
ompi_list_append(&mvapi_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg);
} else {
ib_btl->ib_pool->mpool_register(ib_btl->ib_pool,
mvapi_btl->ib_pool->mpool_register(mvapi_btl->ib_pool,
iov.iov_base,
max_data,
(mca_mpool_base_registration_t**) &vapi_reg);
@ -410,7 +410,7 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
} else if (max_data+reserve <= btl->btl_eager_limit) {
MCA_BMI_IB_FRAG_ALLOC_EAGER(btl, frag, rc);
MCA_BTL_IB_FRAG_ALLOC_EAGER(btl, frag, rc);
if(NULL == frag) {
return NULL;
}
@ -421,7 +421,7 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data, &free_after);
*size = max_data;
if( rc < 0 ) {
MCA_BMI_IB_FRAG_RETURN_EAGER(btl, frag);
MCA_BTL_IB_FRAG_RETURN_EAGER(btl, frag);
return NULL;
}
@ -439,9 +439,9 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
/** if the data fits in the max limit and we aren't told to pinn then we
simply pack, if the data is non contiguous then we pack **/
else if(max_data + reserve <= ib_btl->super.btl_max_send_size) {
else if(max_data + reserve <= mvapi_btl->super.btl_max_send_size) {
MCA_BMI_IB_FRAG_ALLOC_MAX(btl, frag, rc);
MCA_BTL_IB_FRAG_ALLOC_MAX(btl, frag, rc);
if(NULL == frag) {
return NULL;
}
@ -455,7 +455,7 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
*size = max_data;
if( rc < 0 ) {
MCA_BMI_IB_FRAG_RETURN_MAX(btl, frag);
MCA_BTL_IB_FRAG_RETURN_MAX(btl, frag);
return NULL;
}
@ -475,10 +475,10 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
/**
* Pack data
*
* @param btl (IN) BMI module
* @param peer (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
mca_btl_base_descriptor_t* mca_btl_ib_prepare_dst(
mca_btl_base_descriptor_t* mca_btl_mvapi_prepare_dst(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* endpoint,
mca_mpool_base_registration_t* registration,
@ -486,16 +486,16 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_dst(
size_t reserve,
size_t* size)
{
mca_btl_ib_module_t* ib_btl;
mca_btl_ib_frag_t* frag;
mca_btl_mvapi_module_t* mvapi_btl;
mca_btl_mvapi_frag_t* frag;
mca_mpool_vapi_registration_t * vapi_reg;
int rc;
size_t reg_len;
ib_btl = (mca_btl_ib_module_t*) btl;
mvapi_btl = (mca_btl_mvapi_module_t*) btl;
vapi_reg = (mca_mpool_vapi_registration_t*) registration;
MCA_BMI_IB_FRAG_ALLOC_FRAG(btl, frag, rc);
MCA_BTL_IB_FRAG_ALLOC_FRAG(btl, frag, rc);
if(NULL == frag){
return NULL;
@ -507,38 +507,38 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_dst(
frag->base.des_flags = 0;
if(NULL!= vapi_reg){
reg_len = (unsigned char*)vapi_reg->bound - (unsigned char*)frag->segment.seg_addr.pval + 1;
reg_len = (unsigned char*)vapi_reg->base_reg.bound - (unsigned char*)frag->segment.seg_addr.pval + 1;
bool is_leave_pinned = vapi_reg->is_leave_pinned;
if(frag->segment.seg_len > reg_len ) {
size_t new_len = vapi_reg->bound - vapi_reg->base + 1
size_t new_len = vapi_reg->base_reg.bound - vapi_reg->base_reg.base + 1
+ frag->segment.seg_len - reg_len;
void * base_addr = vapi_reg->base;
void * base_addr = vapi_reg->base_reg.base;
rc = mca_mpool_base_remove((void*) vapi_reg->base);
rc = mca_mpool_base_remove((void*) vapi_reg->base_reg.base);
if(OMPI_SUCCESS != rc) {
ompi_output(0,"%s:%d:%s error removing memory region from memory pool tree", __FILE__, __LINE__, __func__);
return NULL;
}
if(is_leave_pinned) {
if(NULL == ompi_list_remove_item(&ib_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg)) {
if(NULL == ompi_list_remove_item(&mvapi_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg)) {
ompi_output(0,"%s:%d:%s error removing item from reg_mru_list", __FILE__, __LINE__, __func__);
return NULL;
}
}
OBJ_RELEASE(vapi_reg);
ib_btl->ib_pool->mpool_register(ib_btl->ib_pool,
mvapi_btl->ib_pool->mpool_register(mvapi_btl->ib_pool,
base_addr,
new_len,
(mca_mpool_base_registration_t**) &vapi_reg);
rc = mca_mpool_base_insert(vapi_reg->base,
vapi_reg->bound - vapi_reg->base + 1,
ib_btl->ib_pool,
(void*) (&ib_btl->super),
rc = mca_mpool_base_insert(vapi_reg->base_reg.base,
vapi_reg->base_reg.bound - vapi_reg->base_reg.base + 1,
mvapi_btl->ib_pool,
(void*) (&mvapi_btl->super),
(mca_mpool_base_registration_t*) vapi_reg);
if(OMPI_SUCCESS != rc) {
@ -549,34 +549,34 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_dst(
if(is_leave_pinned) {
vapi_reg->is_leave_pinned = is_leave_pinned;
ompi_list_append(&ib_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg);
ompi_list_append(&mvapi_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg);
}
}
else if(is_leave_pinned){
if(NULL == ompi_list_remove_item(&ib_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg)) {
if(NULL == ompi_list_remove_item(&mvapi_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg)) {
ompi_output(0,"%s:%d:%s error removing item from reg_mru_list", __FILE__, __LINE__, __func__);
return NULL;
}
ompi_list_append(&ib_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg);
ompi_list_append(&mvapi_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg);
}
} else {
if(mca_btl_ib_component.leave_pinned) {
if(mca_btl_mvapi_component.leave_pinned) {
if( mca_btl_ib_component.reg_mru_len <= ib_btl->reg_mru_list.ompi_list_length ) {
if( mca_btl_mvapi_component.reg_mru_len <= mvapi_btl->reg_mru_list.ompi_list_length ) {
mca_mpool_vapi_registration_t* old_reg =
(mca_mpool_vapi_registration_t*)
ompi_list_remove_last(&ib_btl->reg_mru_list);
ompi_list_remove_last(&mvapi_btl->reg_mru_list);
if( NULL == old_reg) {
ompi_output(0,"%s:%d:%s error removing item from reg_mru_list", __FILE__, __LINE__, __func__);
return NULL;
}
rc = mca_mpool_base_remove((void*) old_reg->base);
rc = mca_mpool_base_remove((void*) old_reg->base_reg.base);
if(OMPI_SUCCESS !=rc ) {
ompi_output(0,"%s:%d:%s error removing memory region from memory pool tree", __FILE__, __LINE__, __func__);
return NULL;
@ -585,17 +585,17 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_dst(
OBJ_RELEASE(old_reg);
}
ib_btl->ib_pool->mpool_register(ib_btl->ib_pool,
mvapi_btl->ib_pool->mpool_register(mvapi_btl->ib_pool,
frag->segment.seg_addr.pval,
*size,
(mca_mpool_base_registration_t**) &vapi_reg);
vapi_reg->is_leave_pinned = true;
rc = mca_mpool_base_insert(vapi_reg->base,
vapi_reg->bound - vapi_reg->base + 1,
ib_btl->ib_pool,
(void*) (&ib_btl->super),
rc = mca_mpool_base_insert(vapi_reg->base_reg.base,
vapi_reg->base_reg.bound - vapi_reg->base_reg.base + 1,
mvapi_btl->ib_pool,
(void*) (&mvapi_btl->super),
(mca_mpool_base_registration_t*) vapi_reg);
if(OMPI_SUCCESS != rc){
ompi_output(0,"%s:%d:%s error inserting memory region into memory pool", __FILE__, __LINE__, __func__);
@ -603,10 +603,10 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_dst(
}
OBJ_RETAIN(vapi_reg);
ompi_list_append(&ib_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg);
ompi_list_append(&mvapi_btl->reg_mru_list, (ompi_list_item_t*) vapi_reg);
} else {
ib_btl->ib_pool->mpool_register(ib_btl->ib_pool,
mvapi_btl->ib_pool->mpool_register(mvapi_btl->ib_pool,
frag->segment.seg_addr.pval,
*size,
(mca_mpool_base_registration_t**) &vapi_reg);
@ -635,42 +635,42 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_dst(
}
int mca_btl_ib_finalize(struct mca_btl_base_module_t* btl)
int mca_btl_mvapi_finalize(struct mca_btl_base_module_t* btl)
{
mca_btl_ib_module_t* ib_btl;
ib_btl = (mca_btl_ib_module_t*) btl;
mca_btl_mvapi_module_t* mvapi_btl;
mvapi_btl = (mca_btl_mvapi_module_t*) btl;
if(ib_btl->send_free_eager.fl_num_allocated !=
ib_btl->send_free_eager.super.ompi_list_length){
if(mvapi_btl->send_free_eager.fl_num_allocated !=
mvapi_btl->send_free_eager.super.ompi_list_length){
ompi_output(0, "btl ib send_free_eager frags: %d allocated %d returned \n",
ib_btl->send_free_eager.fl_num_allocated,
ib_btl->send_free_eager.super.ompi_list_length);
mvapi_btl->send_free_eager.fl_num_allocated,
mvapi_btl->send_free_eager.super.ompi_list_length);
}
if(ib_btl->send_free_max.fl_num_allocated !=
ib_btl->send_free_max.super.ompi_list_length){
if(mvapi_btl->send_free_max.fl_num_allocated !=
mvapi_btl->send_free_max.super.ompi_list_length){
ompi_output(0, "btl ib send_free_max frags: %d allocated %d returned \n",
ib_btl->send_free_max.fl_num_allocated,
ib_btl->send_free_max.super.ompi_list_length);
mvapi_btl->send_free_max.fl_num_allocated,
mvapi_btl->send_free_max.super.ompi_list_length);
}
if(ib_btl->send_free_frag.fl_num_allocated !=
ib_btl->send_free_frag.super.ompi_list_length){
if(mvapi_btl->send_free_frag.fl_num_allocated !=
mvapi_btl->send_free_frag.super.ompi_list_length){
ompi_output(0, "btl ib send_free_frag frags: %d allocated %d returned \n",
ib_btl->send_free_frag.fl_num_allocated,
ib_btl->send_free_frag.super.ompi_list_length);
mvapi_btl->send_free_frag.fl_num_allocated,
mvapi_btl->send_free_frag.super.ompi_list_length);
}
if(ib_btl->recv_free_eager.fl_num_allocated !=
ib_btl->recv_free_eager.super.ompi_list_length){
if(mvapi_btl->recv_free_eager.fl_num_allocated !=
mvapi_btl->recv_free_eager.super.ompi_list_length){
ompi_output(0, "btl ib recv_free_eager frags: %d allocated %d returned \n",
ib_btl->recv_free_eager.fl_num_allocated,
ib_btl->recv_free_eager.super.ompi_list_length);
mvapi_btl->recv_free_eager.fl_num_allocated,
mvapi_btl->recv_free_eager.super.ompi_list_length);
}
if(ib_btl->recv_free_max.fl_num_allocated !=
ib_btl->recv_free_max.super.ompi_list_length){
if(mvapi_btl->recv_free_max.fl_num_allocated !=
mvapi_btl->recv_free_max.super.ompi_list_length){
ompi_output(0, "btl ib recv_free_max frags: %d allocated %d returned \n",
ib_btl->recv_free_max.fl_num_allocated,
ib_btl->recv_free_max.super.ompi_list_length);
mvapi_btl->recv_free_max.fl_num_allocated,
mvapi_btl->recv_free_max.super.ompi_list_length);
}
return OMPI_SUCCESS;
@ -683,7 +683,7 @@ int mca_btl_ib_finalize(struct mca_btl_base_module_t* btl)
* on to the peer.
*/
int mca_btl_ib_send(
int mca_btl_mvapi_send(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* endpoint,
struct mca_btl_base_descriptor_t* descriptor,
@ -691,12 +691,12 @@ int mca_btl_ib_send(
{
mca_btl_ib_frag_t* frag = (mca_btl_ib_frag_t*)descriptor;
mca_btl_mvapi_frag_t* frag = (mca_btl_mvapi_frag_t*)descriptor;
frag->endpoint = endpoint;
frag->hdr->tag = tag;
frag->type = MCA_BMI_IB_FRAG_SEND;
frag->rc = mca_btl_ib_endpoint_send(endpoint, frag);
frag->type = MCA_BTL_IB_FRAG_SEND;
frag->rc = mca_btl_mvapi_endpoint_send(endpoint, frag);
return frag->rc;
}
@ -705,12 +705,12 @@ int mca_btl_ib_send(
* RDMA local buffer to remote buffer address.
*/
int mca_btl_ib_put( mca_btl_base_module_t* btl,
int mca_btl_mvapi_put( mca_btl_base_module_t* btl,
mca_btl_base_endpoint_t* endpoint,
mca_btl_base_descriptor_t* descriptor)
{
mca_btl_ib_module_t* ib_btl = (mca_btl_ib_module_t*) btl;
mca_btl_ib_frag_t* frag = (mca_btl_ib_frag_t*) descriptor;
mca_btl_mvapi_module_t* mvapi_btl = (mca_btl_mvapi_module_t*) btl;
mca_btl_mvapi_frag_t* frag = (mca_btl_mvapi_frag_t*) descriptor;
frag->endpoint = endpoint;
frag->sr_desc.opcode = VAPI_RDMA_WRITE;
@ -720,13 +720,13 @@ int mca_btl_ib_put( mca_btl_base_module_t* btl,
frag->sg_entry.addr = (VAPI_virt_addr_t) (MT_virt_addr_t) frag->base.des_src->seg_addr.pval;
frag->sg_entry.len = frag->base.des_src->seg_len;
frag->ret = VAPI_post_sr(ib_btl->nic,
frag->ret = VAPI_post_sr(mvapi_btl->nic,
endpoint->lcl_qp_hndl_low,
&frag->sr_desc);
if(VAPI_OK != frag->ret){
return OMPI_ERROR;
}
mca_btl_ib_endpoint_post_rr(endpoint, 1);
mca_btl_mvapi_endpoint_post_rr(endpoint, 1);
return OMPI_SUCCESS;
@ -782,35 +782,35 @@ static void async_event_handler(VAPI_hca_hndl_t hca_hndl,
int mca_btl_ib_module_init(mca_btl_ib_module_t *ib_btl)
int mca_btl_mvapi_module_init(mca_btl_mvapi_module_t *mvapi_btl)
{
/* Allocate Protection Domain */
VAPI_ret_t ret;
uint32_t cqe_cnt = 0;
ret = VAPI_alloc_pd(ib_btl->nic, &ib_btl->ptag);
ret = VAPI_alloc_pd(mvapi_btl->nic, &mvapi_btl->ptag);
if(ret != VAPI_OK) {
MCA_BMI_IB_VAPI_ERROR(ret, "VAPI_alloc_pd");
MCA_BTL_IB_VAPI_ERROR(ret, "VAPI_alloc_pd");
return OMPI_ERROR;
}
ret = VAPI_create_cq(ib_btl->nic, ib_btl->ib_cq_size,
&ib_btl->cq_hndl_low, &cqe_cnt);
ret = VAPI_create_cq(mvapi_btl->nic, mvapi_btl->ib_cq_size,
&mvapi_btl->cq_hndl_low, &cqe_cnt);
if( VAPI_OK != ret) {
MCA_BMI_IB_VAPI_ERROR(ret, "VAPI_create_cq");
MCA_BTL_IB_VAPI_ERROR(ret, "VAPI_create_cq");
return OMPI_ERROR;
}
ret = VAPI_create_cq(ib_btl->nic, ib_btl->ib_cq_size,
&ib_btl->cq_hndl_high, &cqe_cnt);
ret = VAPI_create_cq(mvapi_btl->nic, mvapi_btl->ib_cq_size,
&mvapi_btl->cq_hndl_high, &cqe_cnt);
if( VAPI_OK != ret) {
MCA_BMI_IB_VAPI_ERROR(ret, "VAPI_create_cq");
MCA_BTL_IB_VAPI_ERROR(ret, "VAPI_create_cq");
return OMPI_ERROR;
}
@ -820,11 +820,11 @@ int mca_btl_ib_module_init(mca_btl_ib_module_t *ib_btl)
return OMPI_ERROR;
}
ret = EVAPI_set_async_event_handler(ib_btl->nic,
async_event_handler, 0, &ib_btl->async_handler);
ret = EVAPI_set_async_event_handler(mvapi_btl->nic,
async_event_handler, 0, &mvapi_btl->async_handler);
if(VAPI_OK != ret) {
MCA_BMI_IB_VAPI_ERROR(ret, "EVAPI_set_async_event_handler");
MCA_BTL_IB_VAPI_ERROR(ret, "EVAPI_set_async_event_handler");
return OMPI_ERROR;
}

Просмотреть файл

@ -32,7 +32,7 @@
#include "mca/btl/btl.h"
#include "util/output.h"
#include "mca/mpool/mpool.h"
#include "btl_ib_error.h"
#include "btl_mvapi_error.h"
#include "mca/btl/btl.h"
#include "mca/btl/base/base.h"
@ -41,19 +41,19 @@
extern "C" {
#endif
#define MCA_BMI_IB_LEAVE_PINNED 1
#define MCA_BTL_IB_LEAVE_PINNED 1
/**
* Infiniband (IB) BMI component.
* Infiniband (IB) BTL component.
*/
struct mca_btl_ib_component_t {
mca_btl_base_component_1_0_0_t super; /**< base BMI component */
struct mca_btl_mvapi_component_t {
mca_btl_base_component_1_0_0_t super; /**< base BTL component */
uint32_t ib_num_btls;
/**< number of hcas available to the IB component */
struct mca_btl_ib_module_t *ib_btls;
struct mca_btl_mvapi_module_t *mvapi_btls;
/**< array of available PTLs */
int ib_free_list_num;
@ -96,21 +96,21 @@ struct mca_btl_ib_component_t {
uint32_t reg_mru_len;
}; typedef struct mca_btl_ib_component_t mca_btl_ib_component_t;
}; typedef struct mca_btl_mvapi_component_t mca_btl_mvapi_component_t;
extern mca_btl_ib_component_t mca_btl_ib_component;
extern mca_btl_mvapi_component_t mca_btl_mvapi_component;
typedef mca_btl_base_recv_reg_t mca_btl_ib_recv_reg_t;
typedef mca_btl_base_recv_reg_t mca_btl_mvapi_recv_reg_t;
/**
* IB PTL Interface
*/
struct mca_btl_ib_module_t {
struct mca_btl_mvapi_module_t {
mca_btl_base_module_t super; /**< base PTL interface */
bool btl_inited;
mca_btl_ib_recv_reg_t ib_reg[256];
mca_btl_mvapi_recv_reg_t ib_reg[256];
VAPI_hca_id_t hca_id; /**< ID of HCA */
IB_port_t port_id; /**< ID of the PORT */
VAPI_hca_port_t port; /**< IB port of this PTL */
@ -166,36 +166,36 @@ struct mca_btl_ib_module_t {
uint32_t ib_src_path_bits;
}; typedef struct mca_btl_ib_module_t mca_btl_ib_module_t;
}; typedef struct mca_btl_mvapi_module_t mca_btl_mvapi_module_t;
struct mca_btl_ib_frag_t;
extern mca_btl_ib_module_t mca_btl_ib_module;
struct mca_btl_mvapi_frag_t;
extern mca_btl_mvapi_module_t mca_btl_mvapi_module;
/**
* Register IB component parameters with the MCA framework
*/
extern int mca_btl_ib_component_open(void);
extern int mca_btl_mvapi_component_open(void);
/**
* Any final cleanup before being unloaded.
*/
extern int mca_btl_ib_component_close(void);
extern int mca_btl_mvapi_component_close(void);
/**
* IB component initialization.
*
* @param num_btl_modules (OUT) Number of BMIs returned in BMI array.
* @param allow_multi_user_threads (OUT) Flag indicating wether BMI supports user threads (TRUE)
* @param have_hidden_threads (OUT) Flag indicating wether BMI uses threads (TRUE)
* @param num_btl_modules (OUT) Number of BTLs returned in BTL array.
* @param allow_multi_user_threads (OUT) Flag indicating wether BTL supports user threads (TRUE)
* @param have_hidden_threads (OUT) Flag indicating wether BTL uses threads (TRUE)
*
* (1) read interface list from kernel and compare against component parameters
* then create a BMI instance for selected interfaces
* then create a BTL instance for selected interfaces
* (2) setup IB listen socket for incoming connection attempts
* (3) publish BMI addressing info
* (3) publish BTL addressing info
*
*/
extern mca_btl_base_module_t** mca_btl_ib_component_init(
extern mca_btl_base_module_t** mca_btl_mvapi_component_init(
int *num_btl_modules,
bool allow_multi_user_threads,
bool have_hidden_threads
@ -205,7 +205,7 @@ extern mca_btl_base_module_t** mca_btl_ib_component_init(
/**
* IB component progress.
*/
extern int mca_btl_ib_component_progress(
extern int mca_btl_mvapi_component_progress(
void
);
@ -214,15 +214,15 @@ extern int mca_btl_ib_component_progress(
* Register a callback function that is called on receipt
* of a fragment.
*
* @param btl (IN) BMI module
* @param btl (IN) BTL module
* @return Status indicating if cleanup was successful
*
* When the process list changes, the PML notifies the BMI of the
* When the process list changes, the PML notifies the BTL of the
* change, to provide the opportunity to cleanup or release any
* resources associated with the peer.
*/
int mca_btl_ib_register(
int mca_btl_mvapi_register(
struct mca_btl_base_module_t* btl,
mca_btl_base_tag_t tag,
mca_btl_base_module_recv_cb_fn_t cbfunc,
@ -231,30 +231,30 @@ int mca_btl_ib_register(
/**
* Cleanup any resources held by the BMI.
* Cleanup any resources held by the BTL.
*
* @param btl BMI instance.
* @param btl BTL instance.
* @return OMPI_SUCCESS or error status on failure.
*/
extern int mca_btl_ib_finalize(
extern int mca_btl_mvapi_finalize(
struct mca_btl_base_module_t* btl
);
/**
* PML->BMI notification of change in the process list.
* PML->BTL notification of change in the process list.
*
* @param btl (IN)
* @param nprocs (IN) Number of processes
* @param procs (IN) Set of processes
* @param peers (OUT) Set of (optional) peer addressing info.
* @param peers (IN/OUT) Set of processes that are reachable via this BMI.
* @param peers (IN/OUT) Set of processes that are reachable via this BTL.
* @return OMPI_SUCCESS or error status on failure.
*
*/
extern int mca_btl_ib_add_procs(
extern int mca_btl_mvapi_add_procs(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
@ -263,16 +263,16 @@ extern int mca_btl_ib_add_procs(
);
/**
* PML->BMI notification of change in the process list.
* PML->BTL notification of change in the process list.
*
* @param btl (IN) BMI instance
* @param btl (IN) BTL instance
* @param nproc (IN) Number of processes.
* @param procs (IN) Set of processes.
* @param peers (IN) Set of peer data structures.
* @return Status indicating if cleanup was successful
*
*/
extern int mca_btl_ib_del_procs(
extern int mca_btl_mvapi_del_procs(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
@ -281,16 +281,16 @@ extern int mca_btl_ib_del_procs(
/**
* PML->BMI Initiate a send of the specified size.
* PML->BTL Initiate a send of the specified size.
*
* @param btl (IN) BMI instance
* @param btl_base_peer (IN) BMI peer addressing
* @param btl (IN) BTL instance
* @param btl_base_peer (IN) BTL peer addressing
* @param send_request (IN/OUT) Send request (allocated by PML via mca_btl_base_request_alloc_fn_t)
* @param size (IN) Number of bytes PML is requesting BMI to deliver
* @param size (IN) Number of bytes PML is requesting BTL to deliver
* @param flags (IN) Flags that should be passed to the peer via the message header.
* @param request (OUT) OMPI_SUCCESS if the BMI was able to queue one or more fragments
* @param request (OUT) OMPI_SUCCESS if the BTL was able to queue one or more fragments
*/
extern int mca_btl_ib_send(
extern int mca_btl_mvapi_send(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* btl_peer,
struct mca_btl_base_descriptor_t* descriptor,
@ -298,16 +298,16 @@ extern int mca_btl_ib_send(
);
/**
* PML->BMI Initiate a put of the specified size.
* PML->BTL Initiate a put of the specified size.
*
* @param btl (IN) BMI instance
* @param btl_base_peer (IN) BMI peer addressing
* @param btl (IN) BTL instance
* @param btl_base_peer (IN) BTL peer addressing
* @param send_request (IN/OUT) Send request (allocated by PML via mca_btl_base_request_alloc_fn_t)
* @param size (IN) Number of bytes PML is requesting BMI to deliver
* @param size (IN) Number of bytes PML is requesting BTL to deliver
* @param flags (IN) Flags that should be passed to the peer via the message header.
* @param request (OUT) OMPI_SUCCESS if the BMI was able to queue one or more fragments
* @param request (OUT) OMPI_SUCCESS if the BTL was able to queue one or more fragments
*/
extern int mca_btl_ib_put(
extern int mca_btl_mvapi_put(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* btl_peer,
struct mca_btl_base_descriptor_t* decriptor
@ -316,21 +316,21 @@ extern int mca_btl_ib_put(
/**
* Allocate a descriptor.
*
* @param btl (IN) BMI module
* @param btl (IN) BTL module
* @param size (IN) Requested descriptor size.
*/
extern mca_btl_base_descriptor_t* mca_btl_ib_alloc(
extern mca_btl_base_descriptor_t* mca_btl_mvapi_alloc(
struct mca_btl_base_module_t* btl,
size_t size);
/**
* Return a segment allocated by this BMI.
* Return a segment allocated by this BTL.
*
* @param btl (IN) BMI module
* @param btl (IN) BTL module
* @param descriptor (IN) Allocated descriptor.
*/
extern int mca_btl_ib_free(
extern int mca_btl_mvapi_free(
struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* des);
@ -339,10 +339,10 @@ extern int mca_btl_ib_free(
* Pack data and return a descriptor that can be
* used for send/put.
*
* @param btl (IN) BMI module
* @param peer (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
mca_btl_base_descriptor_t* mca_btl_mvapi_prepare_src(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* peer,
mca_mpool_base_registration_t* registration,
@ -354,10 +354,10 @@ mca_btl_base_descriptor_t* mca_btl_ib_prepare_src(
/**
* Allocate a descriptor initialized for RDMA write.
*
* @param btl (IN) BMI module
* @param peer (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
extern mca_btl_base_descriptor_t* mca_btl_ib_prepare_dst(
extern mca_btl_base_descriptor_t* mca_btl_mvapi_prepare_dst(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* peer,
mca_mpool_base_registration_t* registration,
@ -367,17 +367,17 @@ extern mca_btl_base_descriptor_t* mca_btl_ib_prepare_dst(
/**
* Return a send fragment to the modules free list.
*
* @param btl (IN) BMI instance
* @param btl (IN) BTL instance
* @param frag (IN) IB send fragment
*
*/
extern void mca_btl_ib_send_frag_return(
extern void mca_btl_mvapi_send_frag_return(
struct mca_btl_base_module_t* btl,
struct mca_btl_ib_frag_t*
struct mca_btl_mvapi_frag_t*
);
int mca_btl_ib_module_init(mca_btl_ib_module_t* ib_btl);
int mca_btl_mvapi_module_init(mca_btl_mvapi_module_t* mvapi_btl);
#if defined(c_plusplus) || defined(__cplusplus)

Просмотреть файл

@ -29,16 +29,16 @@
#include "mca/errmgr/errmgr.h"
#include "mca/common/vapi/vapi_mem_reg.h"
#include "mca/mpool/base/base.h"
#include "btl_ib.h"
#include "btl_ib_frag.h"
#include "btl_ib_endpoint.h"
#include "btl_mvapi.h"
#include "btl_mvapi_frag.h"
#include "btl_mvapi_endpoint.h"
#include "mca/btl/base/base.h"
#include <vapi.h>
#include <vapi_common.h>
#include "datatype/convertor.h"
#include "mca/mpool/vapi/mpool_vapi.h"
mca_btl_ib_component_t mca_btl_ib_component = {
mca_btl_mvapi_component_t mca_btl_mvapi_component = {
{
/* First, the mca_base_component_t struct containing meta information
about the component itself */
@ -47,14 +47,14 @@ mca_btl_ib_component_t mca_btl_ib_component = {
/* Indicate that we are a pml v1.0.0 component (which also implies a
specific MCA version) */
MCA_BMI_BASE_VERSION_1_0_0,
MCA_BTL_BASE_VERSION_1_0_0,
"ib", /* MCA component name */
1, /* MCA component major version */
0, /* MCA component minor version */
0, /* MCA component release version */
mca_btl_ib_component_open, /* component open */
mca_btl_ib_component_close /* component close */
mca_btl_mvapi_component_open, /* component open */
mca_btl_mvapi_component_close /* component close */
},
/* Next the MCA v1.0.0 component meta data */
@ -65,8 +65,8 @@ mca_btl_ib_component_t mca_btl_ib_component = {
false
},
mca_btl_ib_component_init,
mca_btl_ib_component_progress,
mca_btl_mvapi_component_init,
mca_btl_mvapi_component_progress,
}
};
@ -75,7 +75,7 @@ mca_btl_ib_component_t mca_btl_ib_component = {
* utility routines for parameter registration
*/
static inline char* mca_btl_ib_param_register_string(
static inline char* mca_btl_mvapi_param_register_string(
const char* param_name,
const char* default_value)
{
@ -85,7 +85,7 @@ static inline char* mca_btl_ib_param_register_string(
return param_value;
}
static inline int mca_btl_ib_param_register_int(
static inline int mca_btl_mvapi_param_register_int(
const char* param_name,
int default_value)
{
@ -100,113 +100,113 @@ static inline int mca_btl_ib_param_register_int(
* component parameters.
*/
int mca_btl_ib_component_open(void)
int mca_btl_mvapi_component_open(void)
{
int param, value;
/* initialize state */
mca_btl_ib_component.ib_num_btls=0;
mca_btl_ib_component.ib_btls=NULL;
mca_btl_mvapi_component.ib_num_btls=0;
mca_btl_mvapi_component.mvapi_btls=NULL;
/* initialize objects */
OBJ_CONSTRUCT(&mca_btl_ib_component.ib_procs, ompi_list_t);
/* OBJ_CONSTRUCT (&mca_btl_ib_component.ib_recv_frags, ompi_free_list_t); */
OBJ_CONSTRUCT(&mca_btl_mvapi_component.ib_procs, ompi_list_t);
/* OBJ_CONSTRUCT (&mca_btl_mvapi_component.ib_recv_frags, ompi_free_list_t); */
/* register IB component parameters */
mca_btl_ib_component.ib_free_list_num =
mca_btl_ib_param_register_int ("free_list_num", 8);
mca_btl_ib_component.ib_free_list_max =
mca_btl_ib_param_register_int ("free_list_max", 1024);
mca_btl_ib_component.ib_free_list_inc =
mca_btl_ib_param_register_int ("free_list_inc", 32);
mca_btl_ib_component.ib_mem_registry_hints_log_size =
mca_btl_ib_param_register_int ("hints_log_size", 8);
mca_btl_ib_component.ib_mpool_name =
mca_btl_ib_param_register_string("mpool", "ib");
mca_btl_ib_component.ib_rr_buf_max =
mca_btl_ib_param_register_int("rr_buf_max", 16);
mca_btl_ib_component.ib_rr_buf_min =
mca_btl_ib_param_register_int("rr_buf_min", 8);
mca_btl_ib_component.reg_mru_len =
mca_btl_ib_param_register_int("reg_mru_len", 16);
mca_btl_mvapi_component.ib_free_list_num =
mca_btl_mvapi_param_register_int ("free_list_num", 8);
mca_btl_mvapi_component.ib_free_list_max =
mca_btl_mvapi_param_register_int ("free_list_max", 1024);
mca_btl_mvapi_component.ib_free_list_inc =
mca_btl_mvapi_param_register_int ("free_list_inc", 32);
mca_btl_mvapi_component.ib_mem_registry_hints_log_size =
mca_btl_mvapi_param_register_int ("hints_log_size", 8);
mca_btl_mvapi_component.ib_mpool_name =
mca_btl_mvapi_param_register_string("mpool", "ib");
mca_btl_mvapi_component.ib_rr_buf_max =
mca_btl_mvapi_param_register_int("rr_buf_max", 16);
mca_btl_mvapi_component.ib_rr_buf_min =
mca_btl_mvapi_param_register_int("rr_buf_min", 8);
mca_btl_mvapi_component.reg_mru_len =
mca_btl_mvapi_param_register_int("reg_mru_len", 16);
mca_btl_ib_module.super.btl_exclusivity =
mca_btl_ib_param_register_int ("exclusivity", 0);
mca_btl_ib_module.super.btl_eager_limit =
mca_btl_ib_param_register_int ("eager_limit", (64*1024))
- sizeof(mca_btl_ib_header_t);
mca_btl_mvapi_module.super.btl_exclusivity =
mca_btl_mvapi_param_register_int ("exclusivity", 0);
mca_btl_mvapi_module.super.btl_eager_limit =
mca_btl_mvapi_param_register_int ("eager_limit", (64*1024))
- sizeof(mca_btl_mvapi_header_t);
mca_btl_ib_module.super.btl_min_send_size =
mca_btl_ib_param_register_int ("min_send_size", (64*1024))
- sizeof(mca_btl_ib_header_t);
mca_btl_mvapi_module.super.btl_min_send_size =
mca_btl_mvapi_param_register_int ("min_send_size", (64*1024))
- sizeof(mca_btl_mvapi_header_t);
mca_btl_ib_module.super.btl_max_send_size =
mca_btl_ib_param_register_int ("max_send_size", (128*1024))
- sizeof(mca_btl_ib_header_t);
mca_btl_mvapi_module.super.btl_max_send_size =
mca_btl_mvapi_param_register_int ("max_send_size", (128*1024))
- sizeof(mca_btl_mvapi_header_t);
mca_btl_ib_module.ib_pin_min =
mca_btl_ib_param_register_int("ib_pin_min", 128*1024);
mca_btl_ib_module.ib_cq_size =
mca_btl_ib_param_register_int("ib_cq_size",
mca_btl_mvapi_module.ib_pin_min =
mca_btl_mvapi_param_register_int("ib_pin_min", 128*1024);
mca_btl_mvapi_module.ib_cq_size =
mca_btl_mvapi_param_register_int("ib_cq_size",
40000);
mca_btl_ib_module.ib_wq_size =
mca_btl_ib_param_register_int("ib_wq_size",
mca_btl_mvapi_module.ib_wq_size =
mca_btl_mvapi_param_register_int("ib_wq_size",
10000);
mca_btl_ib_module.ib_sg_list_size =
mca_btl_ib_param_register_int("ib_sg_list_size",
mca_btl_mvapi_module.ib_sg_list_size =
mca_btl_mvapi_param_register_int("ib_sg_list_size",
1);
mca_btl_ib_module.ib_pkey_ix =
mca_btl_ib_param_register_int("ib_pkey_ix",
mca_btl_mvapi_module.ib_pkey_ix =
mca_btl_mvapi_param_register_int("ib_pkey_ix",
0);
mca_btl_ib_module.ib_psn =
mca_btl_ib_param_register_int("ib_psn",
mca_btl_mvapi_module.ib_psn =
mca_btl_mvapi_param_register_int("ib_psn",
0);
mca_btl_ib_module.ib_qp_ous_rd_atom =
mca_btl_ib_param_register_int("ib_qp_ous_rd_atom",
mca_btl_mvapi_module.ib_qp_ous_rd_atom =
mca_btl_mvapi_param_register_int("ib_qp_ous_rd_atom",
1);
mca_btl_ib_module.ib_mtu =
mca_btl_ib_param_register_int("ib_mtu",
mca_btl_mvapi_module.ib_mtu =
mca_btl_mvapi_param_register_int("ib_mtu",
MTU1024);
mca_btl_ib_module.ib_min_rnr_timer =
mca_btl_ib_param_register_int("ib_min_rnr_timer",
mca_btl_mvapi_module.ib_min_rnr_timer =
mca_btl_mvapi_param_register_int("ib_min_rnr_timer",
5);
mca_btl_ib_module.ib_timeout =
mca_btl_ib_param_register_int("ib_timeout",
mca_btl_mvapi_module.ib_timeout =
mca_btl_mvapi_param_register_int("ib_timeout",
10);
mca_btl_ib_module.ib_retry_count =
mca_btl_ib_param_register_int("ib_retry_count",
mca_btl_mvapi_module.ib_retry_count =
mca_btl_mvapi_param_register_int("ib_retry_count",
7);
mca_btl_ib_module.ib_rnr_retry =
mca_btl_ib_param_register_int("ib_rnr_retry",
mca_btl_mvapi_module.ib_rnr_retry =
mca_btl_mvapi_param_register_int("ib_rnr_retry",
7);
mca_btl_ib_module.ib_max_rdma_dst_ops =
mca_btl_ib_param_register_int("ib_max_rdma_dst_ops",
mca_btl_mvapi_module.ib_max_rdma_dst_ops =
mca_btl_mvapi_param_register_int("ib_max_rdma_dst_ops",
16);
mca_btl_ib_module.ib_service_level =
mca_btl_ib_param_register_int("ib_service_level",
mca_btl_mvapi_module.ib_service_level =
mca_btl_mvapi_param_register_int("ib_service_level",
0);
mca_btl_ib_module.ib_static_rate =
mca_btl_ib_param_register_int("ib_static_rate",
mca_btl_mvapi_module.ib_static_rate =
mca_btl_mvapi_param_register_int("ib_static_rate",
0);
mca_btl_ib_module.ib_src_path_bits =
mca_btl_ib_param_register_int("ib_src_path_bits",
mca_btl_mvapi_module.ib_src_path_bits =
mca_btl_mvapi_param_register_int("ib_src_path_bits",
0);
mca_btl_ib_module.super.btl_min_rdma_size =
mca_btl_ib_param_register_int("min_rdma_size",
mca_btl_mvapi_module.super.btl_min_rdma_size =
mca_btl_mvapi_param_register_int("min_rdma_size",
1024*1024);
mca_btl_ib_module.super.btl_max_rdma_size =
mca_btl_ib_param_register_int("max_rdma_size",
mca_btl_mvapi_module.super.btl_max_rdma_size =
mca_btl_mvapi_param_register_int("max_rdma_size",
1024*1024);
mca_btl_ib_module.super.btl_flags =
mca_btl_ib_param_register_int("flags",
MCA_BMI_FLAGS_RDMA);
mca_btl_mvapi_module.super.btl_flags =
mca_btl_mvapi_param_register_int("flags",
MCA_BTL_FLAGS_RDMA);
param = mca_base_param_find("mpi", NULL, "leave_pinned");
mca_base_param_lookup_int(param, &value);
mca_btl_ib_component.leave_pinned = value;
mca_btl_mvapi_component.leave_pinned = value;
@ -214,8 +214,8 @@ int mca_btl_ib_component_open(void)
mca_btl_ib_component.max_send_size = mca_btl_ib_module.super.btl_max_send_size;
mca_btl_ib_component.eager_limit = mca_btl_ib_module.super.btl_eager_limit;
mca_btl_mvapi_component.max_send_size = mca_btl_mvapi_module.super.btl_max_send_size;
mca_btl_mvapi_component.eager_limit = mca_btl_mvapi_module.super.btl_eager_limit;
return OMPI_SUCCESS;
}
@ -224,7 +224,7 @@ int mca_btl_ib_component_open(void)
* component cleanup - sanity checking of queue lengths
*/
int mca_btl_ib_component_close(void)
int mca_btl_mvapi_component_close(void)
{
return OMPI_SUCCESS;
}
@ -232,12 +232,12 @@ int mca_btl_ib_component_close(void)
/*
* IB component initialization:
* (1) read interface list from kernel and compare against component parameters
* then create a BMI instance for selected interfaces
* then create a BTL instance for selected interfaces
* (2) setup IB listen socket for incoming connection attempts
* (3) register BMI parameters with the MCA
* (3) register BTL parameters with the MCA
*/
mca_btl_base_module_t** mca_btl_ib_component_init(int *num_btl_modules,
mca_btl_base_module_t** mca_btl_mvapi_component_init(int *num_btl_modules,
bool enable_progress_threads,
bool enable_mpi_threads)
{
@ -252,7 +252,7 @@ mca_btl_base_module_t** mca_btl_ib_component_init(int *num_btl_modules,
uint32_t i,j, length;
struct mca_mpool_base_resources_t hca_pd;
ompi_list_t btl_list;
mca_btl_ib_module_t * ib_btl;
mca_btl_mvapi_module_t * mvapi_btl;
mca_btl_base_selected_module_t* ib_selected;
ompi_list_item_t* item;
/* initialization */
@ -284,7 +284,7 @@ mca_btl_base_module_t** mca_btl_ib_component_init(int *num_btl_modules,
a distinct btl module for each hca port */
OBJ_CONSTRUCT(&btl_list, ompi_list_t);
OBJ_CONSTRUCT(&mca_btl_ib_component.ib_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&mca_btl_mvapi_component.ib_lock, ompi_mutex_t);
for(i = 0; i < num_hcas; i++){
@ -312,17 +312,17 @@ mca_btl_base_module_t** mca_btl_ib_component_init(int *num_btl_modules,
if( PORT_ACTIVE == hca_port.state ){
ib_btl = (mca_btl_ib_module_t*) malloc(sizeof(mca_btl_ib_module_t));
memcpy(ib_btl, &mca_btl_ib_module, sizeof(mca_btl_ib_module));
mvapi_btl = (mca_btl_mvapi_module_t*) malloc(sizeof(mca_btl_mvapi_module_t));
memcpy(mvapi_btl, &mca_btl_mvapi_module, sizeof(mca_btl_mvapi_module));
ib_selected = OBJ_NEW(mca_btl_base_selected_module_t);
ib_selected->btl_module = (mca_btl_base_module_t*) ib_btl;
memcpy(ib_btl->hca_id, hca_ids[i], sizeof(VAPI_hca_id_t));
ib_btl->nic = hca_hndl;
ib_btl->port_id = (IB_port_t) j;
ib_btl->port = hca_port;
ib_selected->btl_module = (mca_btl_base_module_t*) mvapi_btl;
memcpy(mvapi_btl->hca_id, hca_ids[i], sizeof(VAPI_hca_id_t));
mvapi_btl->nic = hca_hndl;
mvapi_btl->port_id = (IB_port_t) j;
mvapi_btl->port = hca_port;
ompi_list_append(&btl_list, (ompi_list_item_t*) ib_selected);
mca_btl_ib_component.ib_num_btls ++;
mca_btl_mvapi_component.ib_num_btls ++;
}
}
@ -331,15 +331,15 @@ mca_btl_base_module_t** mca_btl_ib_component_init(int *num_btl_modules,
/* Allocate space for btl modules */
mca_btl_ib_component.ib_btls = (mca_btl_ib_module_t*) malloc(sizeof(mca_btl_ib_module_t) *
mca_btl_ib_component.ib_num_btls);
mca_btl_mvapi_component.mvapi_btls = (mca_btl_mvapi_module_t*) malloc(sizeof(mca_btl_mvapi_module_t) *
mca_btl_mvapi_component.ib_num_btls);
if(NULL == mca_btl_ib_component.ib_btls) {
if(NULL == mca_btl_mvapi_component.mvapi_btls) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return NULL;
}
btls = (struct mca_btl_base_module_t**)
malloc(mca_btl_ib_component.ib_num_btls * sizeof(struct mca_btl_ib_module_t*));
malloc(mca_btl_mvapi_component.ib_num_btls * sizeof(struct mca_btl_mvapi_module_t*));
if(NULL == btls) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return NULL;
@ -347,135 +347,135 @@ mca_btl_base_module_t** mca_btl_ib_component_init(int *num_btl_modules,
for(i = 0; i < mca_btl_ib_component.ib_num_btls; i++){
for(i = 0; i < mca_btl_mvapi_component.ib_num_btls; i++){
item = ompi_list_remove_first(&btl_list);
ib_selected = (mca_btl_base_selected_module_t*)item;
ib_btl = (mca_btl_ib_module_t*) ib_selected->btl_module;
memcpy(&(mca_btl_ib_component.ib_btls[i]), ib_btl , sizeof(mca_btl_ib_module_t));
mvapi_btl = (mca_btl_mvapi_module_t*) ib_selected->btl_module;
memcpy(&(mca_btl_mvapi_component.mvapi_btls[i]), mvapi_btl , sizeof(mca_btl_mvapi_module_t));
free(ib_selected);
free(ib_btl);
free(mvapi_btl);
ib_btl = &mca_btl_ib_component.ib_btls[i];
mvapi_btl = &mca_btl_mvapi_component.mvapi_btls[i];
/* Initialize the modules function pointers */
/* Initialize module state */
OBJ_CONSTRUCT(&ib_btl->ib_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&ib_btl->send_free_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&ib_btl->send_free_max, ompi_free_list_t);
OBJ_CONSTRUCT(&ib_btl->send_free_frag, ompi_free_list_t);
OBJ_CONSTRUCT(&mvapi_btl->ib_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&mvapi_btl->send_free_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&mvapi_btl->send_free_max, ompi_free_list_t);
OBJ_CONSTRUCT(&mvapi_btl->send_free_frag, ompi_free_list_t);
OBJ_CONSTRUCT(&ib_btl->recv_free_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&ib_btl->recv_free_max, ompi_free_list_t);
OBJ_CONSTRUCT(&mvapi_btl->recv_free_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&mvapi_btl->recv_free_max, ompi_free_list_t);
OBJ_CONSTRUCT(&ib_btl->repost, ompi_list_t);
OBJ_CONSTRUCT(&ib_btl->reg_mru_list, ompi_list_t);
OBJ_CONSTRUCT(&mvapi_btl->repost, ompi_list_t);
OBJ_CONSTRUCT(&mvapi_btl->reg_mru_list, ompi_list_t);
if(mca_btl_ib_module_init(ib_btl) != OMPI_SUCCESS) {
if(mca_btl_mvapi_module_init(mvapi_btl) != OMPI_SUCCESS) {
free(hca_ids);
return NULL;
}
hca_pd.hca = ib_btl->nic;
hca_pd.pd_tag = ib_btl->ptag;
hca_pd.hca = mvapi_btl->nic;
hca_pd.pd_tag = mvapi_btl->ptag;
/* initialize the memory pool using the hca */
ib_btl->ib_pool =
mca_mpool_base_module_create(mca_btl_ib_component.ib_mpool_name,
&ib_btl->super,
mvapi_btl->ib_pool =
mca_mpool_base_module_create(mca_btl_mvapi_component.ib_mpool_name,
&mvapi_btl->super,
&hca_pd);
if(NULL == ib_btl->ib_pool) {
if(NULL == mvapi_btl->ib_pool) {
ompi_output(0, "%s: error creating vapi memory pool! aborting ib btl initialization", __func__);
return NULL;
}
/* Initialize pool of send fragments */
length = sizeof(mca_btl_ib_frag_t) +
sizeof(mca_btl_ib_header_t) +
ib_btl->super.btl_eager_limit+
2*MCA_BMI_IB_FRAG_ALIGN;
length = sizeof(mca_btl_mvapi_frag_t) +
sizeof(mca_btl_mvapi_header_t) +
mvapi_btl->super.btl_eager_limit+
2*MCA_BTL_IB_FRAG_ALIGN;
ompi_free_list_init(&ib_btl->send_free_eager,
ompi_free_list_init(&mvapi_btl->send_free_eager,
length,
OBJ_CLASS(mca_btl_ib_send_frag_eager_t),
mca_btl_ib_component.ib_free_list_num,
mca_btl_ib_component.ib_free_list_max,
mca_btl_ib_component.ib_free_list_inc,
ib_btl->ib_pool);
OBJ_CLASS(mca_btl_mvapi_send_frag_eager_t),
mca_btl_mvapi_component.ib_free_list_num,
mca_btl_mvapi_component.ib_free_list_max,
mca_btl_mvapi_component.ib_free_list_inc,
mvapi_btl->ib_pool);
ompi_free_list_init(&ib_btl->recv_free_eager,
ompi_free_list_init(&mvapi_btl->recv_free_eager,
length,
OBJ_CLASS(mca_btl_ib_recv_frag_eager_t),
mca_btl_ib_component.ib_free_list_num,
mca_btl_ib_component.ib_free_list_max,
mca_btl_ib_component.ib_free_list_inc,
ib_btl->ib_pool);
OBJ_CLASS(mca_btl_mvapi_recv_frag_eager_t),
mca_btl_mvapi_component.ib_free_list_num,
mca_btl_mvapi_component.ib_free_list_max,
mca_btl_mvapi_component.ib_free_list_inc,
mvapi_btl->ib_pool);
length = sizeof(mca_btl_ib_frag_t) +
sizeof(mca_btl_ib_header_t) +
ib_btl->super.btl_max_send_size+
2*MCA_BMI_IB_FRAG_ALIGN;
length = sizeof(mca_btl_mvapi_frag_t) +
sizeof(mca_btl_mvapi_header_t) +
mvapi_btl->super.btl_max_send_size+
2*MCA_BTL_IB_FRAG_ALIGN;
ompi_free_list_init(&ib_btl->send_free_max,
ompi_free_list_init(&mvapi_btl->send_free_max,
length,
OBJ_CLASS(mca_btl_ib_send_frag_max_t),
mca_btl_ib_component.ib_free_list_num,
mca_btl_ib_component.ib_free_list_max,
mca_btl_ib_component.ib_free_list_inc,
ib_btl->ib_pool);
OBJ_CLASS(mca_btl_mvapi_send_frag_max_t),
mca_btl_mvapi_component.ib_free_list_num,
mca_btl_mvapi_component.ib_free_list_max,
mca_btl_mvapi_component.ib_free_list_inc,
mvapi_btl->ib_pool);
/* Initialize pool of receive fragments */
ompi_free_list_init (&ib_btl->recv_free_max,
ompi_free_list_init (&mvapi_btl->recv_free_max,
length,
OBJ_CLASS (mca_btl_ib_recv_frag_max_t),
mca_btl_ib_component.ib_free_list_num,
mca_btl_ib_component.ib_free_list_max,
mca_btl_ib_component.ib_free_list_inc, ib_btl->ib_pool);
OBJ_CLASS (mca_btl_mvapi_recv_frag_max_t),
mca_btl_mvapi_component.ib_free_list_num,
mca_btl_mvapi_component.ib_free_list_max,
mca_btl_mvapi_component.ib_free_list_inc, mvapi_btl->ib_pool);
length = sizeof(mca_btl_ib_frag_t) +
sizeof(mca_btl_ib_header_t)+
2*MCA_BMI_IB_FRAG_ALIGN;
length = sizeof(mca_btl_mvapi_frag_t) +
sizeof(mca_btl_mvapi_header_t)+
2*MCA_BTL_IB_FRAG_ALIGN;
ompi_free_list_init(&ib_btl->send_free_frag,
ompi_free_list_init(&mvapi_btl->send_free_frag,
length,
OBJ_CLASS(mca_btl_ib_send_frag_frag_t),
mca_btl_ib_component.ib_free_list_num,
mca_btl_ib_component.ib_free_list_max,
mca_btl_ib_component.ib_free_list_inc,
ib_btl->ib_pool);
OBJ_CLASS(mca_btl_mvapi_send_frag_frag_t),
mca_btl_mvapi_component.ib_free_list_num,
mca_btl_mvapi_component.ib_free_list_max,
mca_btl_mvapi_component.ib_free_list_inc,
mvapi_btl->ib_pool);
/* Initialize the rr_desc_post array for posting of rr*/
ib_btl->rr_desc_post = (VAPI_rr_desc_t*) malloc((mca_btl_ib_component.ib_rr_buf_max * sizeof(VAPI_rr_desc_t)));
mvapi_btl->rr_desc_post = (VAPI_rr_desc_t*) malloc((mca_btl_mvapi_component.ib_rr_buf_max * sizeof(VAPI_rr_desc_t)));
/* This is now done by the memory pool passed to free_list_init.. Initialize the send descriptors */
/* if(mca_btl_ib_send_frag_register(ib_btl) != OMPI_SUCCESS) { */
/* if(mca_btl_mvapi_send_frag_register(mvapi_btl) != OMPI_SUCCESS) { */
/* free(hca_ids); */
/* return NULL; */
/* } */
btls[i] = &ib_btl->super;
btls[i] = &mvapi_btl->super;
}
/* Post OOB receive to support dynamic connection setup */
mca_btl_ib_post_recv();
mca_btl_mvapi_post_recv();
*num_btl_modules = mca_btl_ib_component.ib_num_btls;
*num_btl_modules = mca_btl_mvapi_component.ib_num_btls;
free(hca_ids);
return btls;
}
@ -485,19 +485,19 @@ mca_btl_base_module_t** mca_btl_ib_component_init(int *num_btl_modules,
*/
int mca_btl_ib_component_progress()
int mca_btl_mvapi_component_progress()
{
uint32_t i;
int count = 0;
mca_btl_ib_frag_t* frag;
mca_btl_mvapi_frag_t* frag;
/* Poll for completions */
for(i = 0; i < mca_btl_ib_component.ib_num_btls; i++) {
for(i = 0; i < mca_btl_mvapi_component.ib_num_btls; i++) {
VAPI_ret_t ret;
VAPI_wc_desc_t comp;
mca_btl_ib_module_t* ib_btl = &mca_btl_ib_component.ib_btls[i];
mca_btl_mvapi_module_t* mvapi_btl = &mca_btl_mvapi_component.mvapi_btls[i];
do{
ret = VAPI_poll_cq(ib_btl->nic, ib_btl->cq_hndl_high, &comp);
ret = VAPI_poll_cq(mvapi_btl->nic, mvapi_btl->cq_hndl_high, &comp);
if(VAPI_OK == ret) {
if(comp.status != VAPI_SUCCESS) {
ompi_output(0, "Got error : %s, Vendor code : %d Frag : %p",
@ -518,25 +518,25 @@ int mca_btl_ib_component_progress()
case VAPI_CQE_SQ_SEND_DATA :
/* Process a completed send */
frag = (mca_btl_ib_frag_t*) comp.id;
frag = (mca_btl_mvapi_frag_t*) comp.id;
frag->rc = OMPI_SUCCESS;
frag->base.des_cbfunc(&ib_btl->super, frag->endpoint, &frag->base, frag->rc);
frag->base.des_cbfunc(&mvapi_btl->super, frag->endpoint, &frag->base, frag->rc);
count++;
break;
case VAPI_CQE_RQ_SEND_DATA:
DEBUG_OUT(0, "%s:%d ib recv under redesign\n", __FILE__, __LINE__);
frag = (mca_btl_ib_frag_t*) comp.id;
frag = (mca_btl_mvapi_frag_t*) comp.id;
frag->rc=OMPI_SUCCESS;
frag->segment.seg_len = comp.byte_len-((unsigned char*) frag->segment.seg_addr.pval - (unsigned char*) frag->hdr);
/* advance the segment address past the header and subtract from the length..*/
ib_btl->ib_reg[frag->hdr->tag].cbfunc(&ib_btl->super, frag->hdr->tag, &frag->base, ib_btl->ib_reg[frag->hdr->tag].cbdata);
mvapi_btl->ib_reg[frag->hdr->tag].cbfunc(&mvapi_btl->super, frag->hdr->tag, &frag->base, mvapi_btl->ib_reg[frag->hdr->tag].cbdata);
OMPI_FREE_LIST_RETURN(&(ib_btl->recv_free_eager), (ompi_list_item_t*) frag);
OMPI_THREAD_ADD32(&ib_btl->rr_posted_high, -1);
OMPI_FREE_LIST_RETURN(&(mvapi_btl->recv_free_eager), (ompi_list_item_t*) frag);
OMPI_THREAD_ADD32(&mvapi_btl->rr_posted_high, -1);
mca_btl_ib_endpoint_post_rr(((mca_btl_ib_frag_t*)comp.id)->endpoint, 0);
mca_btl_mvapi_endpoint_post_rr(((mca_btl_mvapi_frag_t*)comp.id)->endpoint, 0);
count++;
break;
@ -549,7 +549,7 @@ int mca_btl_ib_component_progress()
}
while(VAPI_OK == ret);
ret = VAPI_poll_cq(ib_btl->nic, ib_btl->cq_hndl_low, &comp);
ret = VAPI_poll_cq(mvapi_btl->nic, mvapi_btl->cq_hndl_low, &comp);
if(VAPI_OK == ret) {
if(comp.status != VAPI_SUCCESS) {
ompi_output(0, "Got error : %s, Vendor code : %d Frag : %p",
@ -564,26 +564,26 @@ int mca_btl_ib_component_progress()
case VAPI_CQE_SQ_SEND_DATA :
/* Process a completed send */
frag = (mca_btl_ib_frag_t*) comp.id;
frag = (mca_btl_mvapi_frag_t*) comp.id;
frag->rc = OMPI_SUCCESS;
frag->base.des_cbfunc(&ib_btl->super, frag->endpoint, &frag->base, frag->rc);
frag->base.des_cbfunc(&mvapi_btl->super, frag->endpoint, &frag->base, frag->rc);
count++;
break;
case VAPI_CQE_RQ_SEND_DATA:
DEBUG_OUT(0, "%s:%d ib recv under redesign\n", __FILE__, __LINE__);
frag = (mca_btl_ib_frag_t*) comp.id;
frag = (mca_btl_mvapi_frag_t*) comp.id;
frag->rc=OMPI_SUCCESS;
frag->segment.seg_len = comp.byte_len-((unsigned char*) frag->segment.seg_addr.pval - (unsigned char*) frag->hdr);
/* advance the segment address past the header and subtract from the length..*/
ib_btl->ib_reg[frag->hdr->tag].cbfunc(&ib_btl->super, frag->hdr->tag, &frag->base, ib_btl->ib_reg[frag->hdr->tag].cbdata);
mvapi_btl->ib_reg[frag->hdr->tag].cbfunc(&mvapi_btl->super, frag->hdr->tag, &frag->base, mvapi_btl->ib_reg[frag->hdr->tag].cbdata);
OMPI_FREE_LIST_RETURN(&(ib_btl->recv_free_max), (ompi_list_item_t*) frag);
OMPI_THREAD_ADD32(&ib_btl->rr_posted_low, -1);
OMPI_FREE_LIST_RETURN(&(mvapi_btl->recv_free_max), (ompi_list_item_t*) frag);
OMPI_THREAD_ADD32(&mvapi_btl->rr_posted_low, -1);
mca_btl_ib_endpoint_post_rr(((mca_btl_ib_frag_t*)comp.id)->endpoint, 0);
mca_btl_mvapi_endpoint_post_rr(((mca_btl_mvapi_frag_t*)comp.id)->endpoint, 0);
count++;
break;

Просмотреть файл

@ -25,17 +25,17 @@
#include "mca/rml/rml.h"
#include "mca/errmgr/errmgr.h"
#include "dps/dps.h"
#include "btl_ib.h"
#include "btl_ib_endpoint.h"
#include "btl_ib_proc.h"
#include "btl_ib_frag.h"
#include "btl_mvapi.h"
#include "btl_mvapi_endpoint.h"
#include "btl_mvapi_proc.h"
#include "btl_mvapi_frag.h"
#include "class/ompi_free_list.h"
static void mca_btl_ib_endpoint_construct(mca_btl_base_endpoint_t* endpoint);
static void mca_btl_ib_endpoint_destruct(mca_btl_base_endpoint_t* endpoint);
static void mca_btl_mvapi_endpoint_construct(mca_btl_base_endpoint_t* endpoint);
static void mca_btl_mvapi_endpoint_destruct(mca_btl_base_endpoint_t* endpoint);
int mca_btl_ib_endpoint_create_qp(
mca_btl_ib_module_t* ib_btl,
int mca_btl_mvapi_endpoint_create_qp(
mca_btl_mvapi_module_t* mvapi_btl,
VAPI_hca_hndl_t nic,
VAPI_pd_hndl_t ptag,
VAPI_cq_hndl_t cq_hndl,
@ -44,9 +44,9 @@ int mca_btl_ib_endpoint_create_qp(
int transport_type);
int mca_btl_ib_endpoint_qp_init_query(
int mca_btl_mvapi_endpoint_qp_init_query(
mca_btl_ib_module_t* ib_btl,
mca_btl_mvapi_module_t* mvapi_btl,
VAPI_hca_hndl_t nic,
VAPI_qp_hndl_t qp_hndl,
VAPI_qp_num_t remote_qp_num,
@ -55,14 +55,14 @@ int mca_btl_ib_endpoint_qp_init_query(
);
static inline int mca_btl_ib_endpoint_post_send(mca_btl_ib_module_t* ib_btl, mca_btl_ib_endpoint_t * endpoint, mca_btl_ib_frag_t * frag)
static inline int mca_btl_mvapi_endpoint_post_send(mca_btl_mvapi_module_t* mvapi_btl, mca_btl_mvapi_endpoint_t * endpoint, mca_btl_mvapi_frag_t * frag)
{
frag->sr_desc.remote_qkey = 0;
frag->sg_entry.addr = (VAPI_virt_addr_t) (MT_virt_addr_t) frag->hdr;
VAPI_qp_hndl_t qp_hndl;
if(frag->base.des_flags && MCA_BMI_DES_FLAGS_PRIORITY && frag->size <= ib_btl->super.btl_eager_limit){
if(frag->base.des_flags && MCA_BTL_DES_FLAGS_PRIORITY && frag->size <= mvapi_btl->super.btl_eager_limit){
frag->sr_desc.remote_qp = endpoint->rem_qp_num_high;
qp_hndl = endpoint->lcl_qp_hndl_high;
} else {
@ -70,15 +70,15 @@ static inline int mca_btl_ib_endpoint_post_send(mca_btl_ib_module_t* ib_btl, mca
qp_hndl = endpoint->lcl_qp_hndl_low;
}
frag->sr_desc.opcode = VAPI_SEND;
frag->sg_entry.len = frag->segment.seg_len + ((unsigned char*) frag->segment.seg_addr.pval - (unsigned char*) frag->hdr); /* sizeof(mca_btl_ib_header_t); */
frag->sg_entry.len = frag->segment.seg_len + ((unsigned char*) frag->segment.seg_addr.pval - (unsigned char*) frag->hdr); /* sizeof(mca_btl_mvapi_header_t); */
if(frag->sg_entry.len <= ib_btl->ib_inline_max) {
frag->ret = EVAPI_post_inline_sr(ib_btl->nic,
if(frag->sg_entry.len <= mvapi_btl->ib_inline_max) {
frag->ret = EVAPI_post_inline_sr(mvapi_btl->nic,
qp_hndl,
&frag->sr_desc);
}else {
frag->ret = VAPI_post_sr(ib_btl->nic,
frag->ret = VAPI_post_sr(mvapi_btl->nic,
qp_hndl,
&frag->sr_desc);
}
@ -88,28 +88,28 @@ static inline int mca_btl_ib_endpoint_post_send(mca_btl_ib_module_t* ib_btl, mca
if(VAPI_OK != frag->ret)
return OMPI_ERROR;
mca_btl_ib_endpoint_post_rr(endpoint, 1);
mca_btl_mvapi_endpoint_post_rr(endpoint, 1);
return OMPI_SUCCESS;
}
OBJ_CLASS_INSTANCE(mca_btl_ib_endpoint_t,
ompi_list_item_t, mca_btl_ib_endpoint_construct,
mca_btl_ib_endpoint_destruct);
OBJ_CLASS_INSTANCE(mca_btl_mvapi_endpoint_t,
ompi_list_item_t, mca_btl_mvapi_endpoint_construct,
mca_btl_mvapi_endpoint_destruct);
/*
* Initialize state of the endpoint instance.
*
*/
static void mca_btl_ib_endpoint_construct(mca_btl_base_endpoint_t* endpoint)
static void mca_btl_mvapi_endpoint_construct(mca_btl_base_endpoint_t* endpoint)
{
endpoint->endpoint_btl = 0;
endpoint->endpoint_proc = 0;
endpoint->endpoint_tstamp = 0.0;
endpoint->endpoint_state = MCA_BMI_IB_CLOSED;
endpoint->endpoint_state = MCA_BTL_IB_CLOSED;
endpoint->endpoint_retries = 0;
OBJ_CONSTRUCT(&endpoint->endpoint_send_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&endpoint->endpoint_recv_lock, ompi_mutex_t);
@ -121,7 +121,7 @@ static void mca_btl_ib_endpoint_construct(mca_btl_base_endpoint_t* endpoint)
*
*/
static void mca_btl_ib_endpoint_destruct(mca_btl_base_endpoint_t* endpoint)
static void mca_btl_mvapi_endpoint_destruct(mca_btl_base_endpoint_t* endpoint)
{
}
@ -130,7 +130,7 @@ static void mca_btl_ib_endpoint_destruct(mca_btl_base_endpoint_t* endpoint)
*
*/
static void mca_btl_ib_endpoint_send_cb(
static void mca_btl_mvapi_endpoint_send_cb(
int status,
orte_process_name_t* endpoint,
orte_buffer_t* buffer,
@ -141,7 +141,7 @@ static void mca_btl_ib_endpoint_send_cb(
}
static int mca_btl_ib_endpoint_send_connect_req(mca_btl_base_endpoint_t* endpoint)
static int mca_btl_mvapi_endpoint_send_connect_req(mca_btl_base_endpoint_t* endpoint)
{
orte_buffer_t* buffer = OBJ_NEW(orte_buffer_t);
int rc;
@ -171,7 +171,7 @@ static int mca_btl_ib_endpoint_send_connect_req(mca_btl_base_endpoint_t* endpoin
/* send to endpoint */
rc = orte_rml.send_buffer_nb(&endpoint->endpoint_proc->proc_guid, buffer, ORTE_RML_TAG_DYNAMIC-1, 0,
mca_btl_ib_endpoint_send_cb, NULL);
mca_btl_mvapi_endpoint_send_cb, NULL);
DEBUG_OUT("Sending High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
@ -191,7 +191,7 @@ static int mca_btl_ib_endpoint_send_connect_req(mca_btl_base_endpoint_t* endpoin
*
*/
static int mca_btl_ib_endpoint_send_connect_ack(mca_btl_base_endpoint_t* endpoint)
static int mca_btl_mvapi_endpoint_send_connect_ack(mca_btl_base_endpoint_t* endpoint)
{
orte_buffer_t* buffer = OBJ_NEW(orte_buffer_t);
int rc;
@ -213,7 +213,7 @@ static int mca_btl_ib_endpoint_send_connect_ack(mca_btl_base_endpoint_t* endpoin
/* send to endpoint */
rc = orte_rml.send_buffer_nb(&endpoint->endpoint_proc->proc_guid, buffer, ORTE_RML_TAG_DYNAMIC-1, 0,
mca_btl_ib_endpoint_send_cb, NULL);
mca_btl_mvapi_endpoint_send_cb, NULL);
if(rc < 0) {
ORTE_ERROR_LOG(rc);
}
@ -228,7 +228,7 @@ static int mca_btl_ib_endpoint_send_connect_ack(mca_btl_base_endpoint_t* endpoin
* setup.
*
*/
static int mca_btl_ib_endpoint_set_remote_info(mca_btl_base_endpoint_t* endpoint, orte_buffer_t* buffer)
static int mca_btl_mvapi_endpoint_set_remote_info(mca_btl_base_endpoint_t* endpoint, orte_buffer_t* buffer)
{
int rc;
@ -269,13 +269,13 @@ static int mca_btl_ib_endpoint_set_remote_info(mca_btl_base_endpoint_t* endpoint
*
*/
static int mca_btl_ib_endpoint_start_connect(mca_btl_base_endpoint_t* endpoint)
static int mca_btl_mvapi_endpoint_start_connect(mca_btl_base_endpoint_t* endpoint)
{
int rc;
/* Create the High Priority Queue Pair */
if(OMPI_SUCCESS != (rc = mca_btl_ib_endpoint_create_qp(endpoint->endpoint_btl,
if(OMPI_SUCCESS != (rc = mca_btl_mvapi_endpoint_create_qp(endpoint->endpoint_btl,
endpoint->endpoint_btl->nic,
endpoint->endpoint_btl->ptag,
endpoint->endpoint_btl->cq_hndl_high,
@ -289,7 +289,7 @@ static int mca_btl_ib_endpoint_start_connect(mca_btl_base_endpoint_t* endpoint)
/* Create the Low Priority Queue Pair */
if(OMPI_SUCCESS != (rc = mca_btl_ib_endpoint_create_qp(endpoint->endpoint_btl,
if(OMPI_SUCCESS != (rc = mca_btl_mvapi_endpoint_create_qp(endpoint->endpoint_btl,
endpoint->endpoint_btl->nic,
endpoint->endpoint_btl->ptag,
endpoint->endpoint_btl->cq_hndl_low,
@ -304,11 +304,11 @@ static int mca_btl_ib_endpoint_start_connect(mca_btl_base_endpoint_t* endpoint)
DEBUG_OUT("Initialized High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
endpoint->lcl_qp_prop_high.qp_num,
endpoint->lcl_qp_prop_low.qp_num,
ib_btl->port.lid);
mvapi_btl->port.lid);
/* Send connection info over to remote endpoint */
endpoint->endpoint_state = MCA_BMI_IB_CONNECTING;
if(OMPI_SUCCESS != (rc = mca_btl_ib_endpoint_send_connect_req(endpoint))) {
endpoint->endpoint_state = MCA_BTL_IB_CONNECTING;
if(OMPI_SUCCESS != (rc = mca_btl_mvapi_endpoint_send_connect_req(endpoint))) {
ompi_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
return rc;
@ -320,13 +320,13 @@ static int mca_btl_ib_endpoint_start_connect(mca_btl_base_endpoint_t* endpoint)
* Reply to a `start - connect' message
*
*/
static int mca_btl_ib_endpoint_reply_start_connect(mca_btl_ib_endpoint_t *endpoint, orte_buffer_t* buffer)
static int mca_btl_mvapi_endpoint_reply_start_connect(mca_btl_mvapi_endpoint_t *endpoint, orte_buffer_t* buffer)
{
int rc;
/* Create the High Priority Queue Pair */
if(OMPI_SUCCESS != (rc = mca_btl_ib_endpoint_create_qp(endpoint->endpoint_btl,
if(OMPI_SUCCESS != (rc = mca_btl_mvapi_endpoint_create_qp(endpoint->endpoint_btl,
endpoint->endpoint_btl->nic,
endpoint->endpoint_btl->ptag,
endpoint->endpoint_btl->cq_hndl_high,
@ -340,7 +340,7 @@ static int mca_btl_ib_endpoint_reply_start_connect(mca_btl_ib_endpoint_t *endpoi
/* Create the Low Priority Queue Pair */
if(OMPI_SUCCESS != (rc = mca_btl_ib_endpoint_create_qp(endpoint->endpoint_btl,
if(OMPI_SUCCESS != (rc = mca_btl_mvapi_endpoint_create_qp(endpoint->endpoint_btl,
endpoint->endpoint_btl->nic,
endpoint->endpoint_btl->ptag,
endpoint->endpoint_btl->cq_hndl_low,
@ -355,17 +355,17 @@ static int mca_btl_ib_endpoint_reply_start_connect(mca_btl_ib_endpoint_t *endpoi
DEBUG_OUT("Initialized High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
endpoint->lcl_qp_prop_high.qp_num,
endpoint->lcl_qp_prop_low.qp_num,
ib_btl->port.lid);
mvapi_btl->port.lid);
/* Set the remote side info */
mca_btl_ib_endpoint_set_remote_info(endpoint, buffer);
mca_btl_mvapi_endpoint_set_remote_info(endpoint, buffer);
/* Connect to endpoint */
rc = mca_btl_ib_endpoint_connect(endpoint);
rc = mca_btl_mvapi_endpoint_connect(endpoint);
if(rc != OMPI_SUCCESS) {
ompi_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
@ -373,7 +373,7 @@ static int mca_btl_ib_endpoint_reply_start_connect(mca_btl_ib_endpoint_t *endpoi
}
/* Send connection info over to remote endpoint */
if(OMPI_SUCCESS != (rc = mca_btl_ib_endpoint_send_connect_req(endpoint))) {
if(OMPI_SUCCESS != (rc = mca_btl_mvapi_endpoint_send_connect_req(endpoint))) {
ompi_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
return rc;
@ -385,10 +385,10 @@ static int mca_btl_ib_endpoint_reply_start_connect(mca_btl_ib_endpoint_t *endpoi
*
*/
static void mca_btl_ib_endpoint_connected(mca_btl_ib_endpoint_t *endpoint)
static void mca_btl_mvapi_endpoint_connected(mca_btl_mvapi_endpoint_t *endpoint)
{
endpoint->endpoint_state = MCA_BMI_IB_CONNECTED;
mca_btl_ib_progress_send_frags(endpoint);
endpoint->endpoint_state = MCA_BTL_IB_CONNECTED;
mca_btl_mvapi_progress_send_frags(endpoint);
}
/*
@ -400,23 +400,23 @@ static void mca_btl_ib_endpoint_connected(mca_btl_ib_endpoint_t *endpoint)
*
*/
static void mca_btl_ib_endpoint_recv(
static void mca_btl_mvapi_endpoint_recv(
int status,
orte_process_name_t* endpoint,
orte_buffer_t* buffer,
orte_rml_tag_t tag,
void* cbdata)
{
mca_btl_ib_proc_t *ib_proc;
mca_btl_ib_endpoint_t *ib_endpoint;
mca_btl_mvapi_proc_t *ib_proc;
mca_btl_mvapi_endpoint_t *ib_endpoint;
int endpoint_state;
int rc;
for(ib_proc = (mca_btl_ib_proc_t*)
ompi_list_get_first(&mca_btl_ib_component.ib_procs);
ib_proc != (mca_btl_ib_proc_t*)
ompi_list_get_end(&mca_btl_ib_component.ib_procs);
ib_proc = (mca_btl_ib_proc_t*)ompi_list_get_next(ib_proc)) {
for(ib_proc = (mca_btl_mvapi_proc_t*)
ompi_list_get_first(&mca_btl_mvapi_component.ib_procs);
ib_proc != (mca_btl_mvapi_proc_t*)
ompi_list_get_end(&mca_btl_mvapi_component.ib_procs);
ib_proc = (mca_btl_mvapi_proc_t*)ompi_list_get_next(ib_proc)) {
if(ib_proc->proc_guid.vpid == endpoint->vpid) {
@ -424,52 +424,52 @@ static void mca_btl_ib_endpoint_recv(
/* Limitation: Right now, we have only 1 endpoint
* for every process. Need several changes, some
* in PML/BMI interface to set this right */
* in PML/BTL interface to set this right */
ib_endpoint = ib_proc->proc_endpoints[0];
endpoint_state = ib_endpoint->endpoint_state;
/* Update status */
switch(endpoint_state) {
case MCA_BMI_IB_CLOSED :
case MCA_BTL_IB_CLOSED :
/* We had this connection closed before.
* The endpoint is trying to connect. Move the
* status of this connection to CONNECTING,
* and then reply with our QP information */
if(OMPI_SUCCESS != (rc = mca_btl_ib_endpoint_reply_start_connect(ib_endpoint, buffer))) {
if(OMPI_SUCCESS != (rc = mca_btl_mvapi_endpoint_reply_start_connect(ib_endpoint, buffer))) {
ompi_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
break;
}
/* Setup state as connected */
ib_endpoint->endpoint_state = MCA_BMI_IB_CONNECT_ACK;
ib_endpoint->endpoint_state = MCA_BTL_IB_CONNECT_ACK;
break;
case MCA_BMI_IB_CONNECTING :
case MCA_BTL_IB_CONNECTING :
mca_btl_ib_endpoint_set_remote_info(ib_endpoint, buffer);
if(OMPI_SUCCESS != (rc = mca_btl_ib_endpoint_connect(ib_endpoint))) {
mca_btl_mvapi_endpoint_set_remote_info(ib_endpoint, buffer);
if(OMPI_SUCCESS != (rc = mca_btl_mvapi_endpoint_connect(ib_endpoint))) {
ompi_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
break;
}
/* Setup state as connected */
mca_btl_ib_endpoint_connected(ib_endpoint);
mca_btl_mvapi_endpoint_connected(ib_endpoint);
/* Send him an ack */
mca_btl_ib_endpoint_send_connect_ack(ib_endpoint);
mca_btl_mvapi_endpoint_send_connect_ack(ib_endpoint);
break;
case MCA_BMI_IB_CONNECT_ACK:
case MCA_BTL_IB_CONNECT_ACK:
mca_btl_ib_endpoint_connected(ib_endpoint);
mca_btl_mvapi_endpoint_connected(ib_endpoint);
break;
case MCA_BMI_IB_CONNECTED :
case MCA_BTL_IB_CONNECTED :
break;
default :
ompi_output(0, "Connected -> Connecting not possible.\n");
@ -481,10 +481,10 @@ static void mca_btl_ib_endpoint_recv(
/* Okay, now that we are done receiving,
* re-post the buffer */
mca_btl_ib_post_recv();
mca_btl_mvapi_post_recv();
}
void mca_btl_ib_post_recv()
void mca_btl_mvapi_post_recv()
{
DEBUG_OUT("");
@ -492,7 +492,7 @@ void mca_btl_ib_post_recv()
ORTE_RML_NAME_ANY,
ORTE_RML_TAG_DYNAMIC-1,
0,
mca_btl_ib_endpoint_recv,
mca_btl_mvapi_endpoint_recv,
NULL);
}
@ -502,18 +502,18 @@ void mca_btl_ib_post_recv()
* connected, queue the fragment and start the connection as required.
*/
int mca_btl_ib_endpoint_send(
int mca_btl_mvapi_endpoint_send(
mca_btl_base_endpoint_t* endpoint,
mca_btl_ib_frag_t* frag
mca_btl_mvapi_frag_t* frag
)
{
int rc;
mca_btl_ib_module_t *ib_btl;
mca_btl_mvapi_module_t *mvapi_btl;
OMPI_THREAD_LOCK(&endpoint->endpoint_send_lock);
switch(endpoint->endpoint_state) {
case MCA_BMI_IB_CONNECTING:
case MCA_BTL_IB_CONNECTING:
DEBUG_OUT("Queing because state is connecting");
@ -523,7 +523,7 @@ int mca_btl_ib_endpoint_send(
rc = OMPI_SUCCESS;
break;
case MCA_BMI_IB_CONNECT_ACK:
case MCA_BTL_IB_CONNECT_ACK:
DEBUG_OUT("Queuing because waiting for ack");
@ -533,25 +533,25 @@ int mca_btl_ib_endpoint_send(
rc = OMPI_SUCCESS;
break;
case MCA_BMI_IB_CLOSED:
case MCA_BTL_IB_CLOSED:
DEBUG_OUT("Connection to endpoint closed ... connecting ...");
ompi_list_append(&endpoint->pending_send_frags,
(ompi_list_item_t *)frag);
rc = mca_btl_ib_endpoint_start_connect(endpoint);
rc = mca_btl_mvapi_endpoint_start_connect(endpoint);
break;
case MCA_BMI_IB_FAILED:
case MCA_BTL_IB_FAILED:
rc = OMPI_ERR_UNREACH;
break;
case MCA_BMI_IB_CONNECTED:
case MCA_BTL_IB_CONNECTED:
{
ib_btl = endpoint->endpoint_btl;
mvapi_btl = endpoint->endpoint_btl;
DEBUG_OUT("Send to : %d, len : %d, frag : %p",
@ -559,7 +559,7 @@ int mca_btl_ib_endpoint_send(
frag->ib_buf.desc.sg_entry.len,
frag);
rc = mca_btl_ib_endpoint_post_send(ib_btl, endpoint, frag);
rc = mca_btl_mvapi_endpoint_post_send(mvapi_btl, endpoint, frag);
break;
}
@ -573,13 +573,13 @@ int mca_btl_ib_endpoint_send(
return rc;
}
void mca_btl_ib_progress_send_frags(mca_btl_ib_endpoint_t* endpoint)
void mca_btl_mvapi_progress_send_frags(mca_btl_mvapi_endpoint_t* endpoint)
{
ompi_list_item_t *frag_item;
mca_btl_ib_frag_t *frag;
mca_btl_ib_module_t* ib_btl;
mca_btl_mvapi_frag_t *frag;
mca_btl_mvapi_module_t* mvapi_btl;
/*Check if endpoint is connected */
if(endpoint->endpoint_state != MCA_BMI_IB_CONNECTED) {
if(endpoint->endpoint_state != MCA_BTL_IB_CONNECTED) {
return;
}
@ -589,12 +589,12 @@ void mca_btl_ib_progress_send_frags(mca_btl_ib_endpoint_t* endpoint)
while(!ompi_list_is_empty(&(endpoint->pending_send_frags))) {
frag_item = ompi_list_remove_first(&(endpoint->pending_send_frags));
frag = (mca_btl_ib_frag_t *) frag_item;
ib_btl = endpoint->endpoint_btl;
frag = (mca_btl_mvapi_frag_t *) frag_item;
mvapi_btl = endpoint->endpoint_btl;
/* We need to post this one */
if(OMPI_SUCCESS != mca_btl_ib_endpoint_post_send(ib_btl, endpoint, frag))
ompi_output(0, "error in mca_btl_ib_endpoint_send");
if(OMPI_SUCCESS != mca_btl_mvapi_endpoint_post_send(mvapi_btl, endpoint, frag))
ompi_output(0, "error in mca_btl_mvapi_endpoint_send");
}
}
@ -604,19 +604,19 @@ void mca_btl_ib_progress_send_frags(mca_btl_ib_endpoint_t* endpoint)
* Complete connection to endpoint.
*/
int mca_btl_ib_endpoint_connect(
mca_btl_ib_endpoint_t *endpoint)
int mca_btl_mvapi_endpoint_connect(
mca_btl_mvapi_endpoint_t *endpoint)
{
int rc;
/* Connection establishment RC */
rc = mca_btl_ib_endpoint_qp_init_query(endpoint->endpoint_btl,
rc = mca_btl_mvapi_endpoint_qp_init_query(endpoint->endpoint_btl,
endpoint->endpoint_btl->nic,
endpoint->lcl_qp_hndl_high,
endpoint->rem_qp_num_high,
endpoint->rem_lid,
endpoint->endpoint_btl->port_id);
rc = mca_btl_ib_endpoint_qp_init_query(endpoint->endpoint_btl,
rc = mca_btl_mvapi_endpoint_qp_init_query(endpoint->endpoint_btl,
endpoint->endpoint_btl->nic,
endpoint->lcl_qp_hndl_low,
endpoint->rem_qp_num_low,
@ -628,15 +628,15 @@ int mca_btl_ib_endpoint_connect(
return rc;
}
mca_btl_ib_endpoint_post_rr(endpoint, 0);
mca_btl_mvapi_endpoint_post_rr(endpoint, 0);
return OMPI_SUCCESS;
}
int mca_btl_ib_endpoint_create_qp(
mca_btl_ib_module_t* ib_btl,
int mca_btl_mvapi_endpoint_create_qp(
mca_btl_mvapi_module_t* mvapi_btl,
VAPI_hca_hndl_t nic,
VAPI_pd_hndl_t ptag,
VAPI_cq_hndl_t cq_hndl,
@ -651,10 +651,10 @@ int mca_btl_ib_endpoint_create_qp(
switch(transport_type) {
case VAPI_TS_RC: /* Set up RC qp parameters */
qp_init_attr.cap.max_oust_wr_rq = ib_btl->ib_wq_size;
qp_init_attr.cap.max_oust_wr_sq = ib_btl->ib_wq_size;
qp_init_attr.cap.max_sg_size_rq = ib_btl->ib_sg_list_size;
qp_init_attr.cap.max_sg_size_sq = ib_btl->ib_sg_list_size;
qp_init_attr.cap.max_oust_wr_rq = mvapi_btl->ib_wq_size;
qp_init_attr.cap.max_oust_wr_sq = mvapi_btl->ib_wq_size;
qp_init_attr.cap.max_sg_size_rq = mvapi_btl->ib_sg_list_size;
qp_init_attr.cap.max_sg_size_sq = mvapi_btl->ib_sg_list_size;
qp_init_attr.pd_hndl = ptag;
/* We don't have Reliable Datagram Handle right now */
qp_init_attr.rdd_hndl = 0;
@ -682,15 +682,15 @@ int mca_btl_ib_endpoint_create_qp(
qp_hndl, qp_prop);
if(VAPI_OK != ret) {
MCA_BMI_IB_VAPI_ERROR(ret, "VAPI_create_qp");
MCA_BTL_IB_VAPI_ERROR(ret, "VAPI_create_qp");
return OMPI_ERROR;
}
return OMPI_SUCCESS;
}
int mca_btl_ib_endpoint_qp_init_query(
int mca_btl_mvapi_endpoint_qp_init_query(
mca_btl_ib_module_t* ib_btl,
mca_btl_mvapi_module_t* mvapi_btl,
VAPI_hca_hndl_t nic,
VAPI_qp_hndl_t qp_hndl,
VAPI_qp_num_t remote_qp_num,
@ -712,7 +712,7 @@ int mca_btl_ib_endpoint_qp_init_query(
QP_ATTR_MASK_CLR_ALL(qp_attr_mask);
qp_attr.qp_state = VAPI_INIT;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_QP_STATE);
qp_attr.pkey_ix = ib_btl->ib_pkey_ix;
qp_attr.pkey_ix = mvapi_btl->ib_pkey_ix;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_PKEY_IX);
qp_attr.port = port_id;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_PORT);
@ -723,7 +723,7 @@ int mca_btl_ib_endpoint_qp_init_query(
&qp_attr, &qp_attr_mask, &qp_cap);
if(VAPI_OK != ret) {
MCA_BMI_IB_VAPI_ERROR(ret, "VAPI_modify_qp");
MCA_BTL_IB_VAPI_ERROR(ret, "VAPI_modify_qp");
return OMPI_ERROR;
}
@ -733,21 +733,21 @@ int mca_btl_ib_endpoint_qp_init_query(
QP_ATTR_MASK_CLR_ALL(qp_attr_mask);
qp_attr.qp_state = VAPI_RTR;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_QP_STATE);
qp_attr.qp_ous_rd_atom = ib_btl->ib_qp_ous_rd_atom;
qp_attr.qp_ous_rd_atom = mvapi_btl->ib_qp_ous_rd_atom;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_QP_OUS_RD_ATOM);
qp_attr.path_mtu = ib_btl->ib_mtu;
qp_attr.path_mtu = mvapi_btl->ib_mtu;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_PATH_MTU);
qp_attr.rq_psn = ib_btl->ib_psn;
qp_attr.rq_psn = mvapi_btl->ib_psn;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_RQ_PSN);
qp_attr.pkey_ix = ib_btl->ib_pkey_ix;
qp_attr.pkey_ix = mvapi_btl->ib_pkey_ix;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_PKEY_IX);
qp_attr.min_rnr_timer = ib_btl->ib_min_rnr_timer;
qp_attr.min_rnr_timer = mvapi_btl->ib_min_rnr_timer;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_MIN_RNR_TIMER);
qp_attr.av.sl = ib_btl->ib_service_level;
qp_attr.av.sl = mvapi_btl->ib_service_level;
qp_attr.av.grh_flag = FALSE;
qp_attr.av.static_rate = ib_btl->ib_static_rate;
qp_attr.av.src_path_bits = ib_btl->ib_src_path_bits;
qp_attr.av.static_rate = mvapi_btl->ib_static_rate;
qp_attr.av.src_path_bits = mvapi_btl->ib_src_path_bits;
qp_attr.dest_qp_num = remote_qp_num;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_DEST_QP_NUM);
@ -758,7 +758,7 @@ int mca_btl_ib_endpoint_qp_init_query(
&qp_attr, &qp_attr_mask, &qp_cap);
if(VAPI_OK != ret) {
MCA_BMI_IB_VAPI_ERROR(ret, "VAPI_modify_qp");
MCA_BTL_IB_VAPI_ERROR(ret, "VAPI_modify_qp");
return OMPI_ERROR;
}
@ -768,22 +768,22 @@ int mca_btl_ib_endpoint_qp_init_query(
QP_ATTR_MASK_CLR_ALL(qp_attr_mask);
qp_attr.qp_state = VAPI_RTS;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_QP_STATE);
qp_attr.sq_psn = ib_btl->ib_psn;
qp_attr.sq_psn = mvapi_btl->ib_psn;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_SQ_PSN);
qp_attr.timeout = ib_btl->ib_timeout;
qp_attr.timeout = mvapi_btl->ib_timeout;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_TIMEOUT);
qp_attr.retry_count = ib_btl->ib_retry_count;
qp_attr.retry_count = mvapi_btl->ib_retry_count;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_RETRY_COUNT);
qp_attr.rnr_retry = ib_btl->ib_rnr_retry;
qp_attr.rnr_retry = mvapi_btl->ib_rnr_retry;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_RNR_RETRY);
qp_attr.ous_dst_rd_atom = ib_btl->ib_max_rdma_dst_ops;
qp_attr.ous_dst_rd_atom = mvapi_btl->ib_max_rdma_dst_ops;
QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_OUS_DST_RD_ATOM);
ret = VAPI_modify_qp(nic, qp_hndl,
&qp_attr, &qp_attr_mask, &qp_cap);
if(VAPI_OK != ret) {
MCA_BMI_IB_VAPI_ERROR(ret, "VAPI_modify_qp");
MCA_BTL_IB_VAPI_ERROR(ret, "VAPI_modify_qp");
return OMPI_ERROR;
}
DEBUG_OUT("Modified to RTS..Qp %d", qp_hndl);
@ -794,7 +794,7 @@ int mca_btl_ib_endpoint_qp_init_query(
return OMPI_ERROR;
}
ib_btl->ib_inline_max = qp_init_attr.cap.max_inline_data_sq;
mvapi_btl->ib_inline_max = qp_init_attr.cap.max_inline_data_sq;
return OMPI_SUCCESS;
}

Просмотреть файл

@ -14,63 +14,63 @@
* $HEADER$
*/
#ifndef MCA_BMI_IB_ENDPOINT_H
#define MCA_BMI_IB_ENDPOINT_H
#ifndef MCA_BTL_IB_ENDPOINT_H
#define MCA_BTL_IB_ENDPOINT_H
#include "class/ompi_list.h"
#include "event/event.h"
#include "mca/pml/pml.h"
#include "mca/btl/btl.h"
#include "btl_ib_frag.h"
#include "btl_ib.h"
#include "btl_mvapi_frag.h"
#include "btl_mvapi.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
#define MAX_POST_RR (16)
OBJ_CLASS_DECLARATION(mca_btl_ib_endpoint_t);
OBJ_CLASS_DECLARATION(mca_btl_mvapi_endpoint_t);
/**
* State of IB endpoint connection.
*/
typedef enum {
/* Defines the state in which this BMI instance
/* Defines the state in which this BTL instance
* has started the process of connection */
MCA_BMI_IB_CONNECTING,
MCA_BTL_IB_CONNECTING,
/* Waiting for ack from endpoint */
MCA_BMI_IB_CONNECT_ACK,
MCA_BTL_IB_CONNECT_ACK,
/* Connected ... both sender & receiver have
* buffers associated with this connection */
MCA_BMI_IB_CONNECTED,
MCA_BTL_IB_CONNECTED,
/* Connection is closed, there are no resources
* associated with this */
MCA_BMI_IB_CLOSED,
MCA_BTL_IB_CLOSED,
/* Maximum number of retries have been used.
* Report failure on send to upper layer */
MCA_BMI_IB_FAILED
} mca_btl_ib_endpoint_state_t;
MCA_BTL_IB_FAILED
} mca_btl_mvapi_endpoint_state_t;
/**
* An abstraction that represents a connection to a endpoint process.
* An instance of mca_btl_base_endpoint_t is associated w/ each process
* and BMI pair at startup. However, connections to the endpoint
* and BTL pair at startup. However, connections to the endpoint
* are established dynamically on an as-needed basis:
*/
struct mca_btl_base_endpoint_t {
ompi_list_item_t super;
struct mca_btl_ib_module_t* endpoint_btl;
/**< BMI instance that created this connection */
struct mca_btl_mvapi_module_t* endpoint_btl;
/**< BTL instance that created this connection */
struct mca_btl_ib_proc_t* endpoint_proc;
struct mca_btl_mvapi_proc_t* endpoint_proc;
/**< proc structure corresponding to endpoint */
mca_btl_ib_endpoint_state_t endpoint_state;
mca_btl_mvapi_endpoint_state_t endpoint_state;
/**< current state of the connection */
size_t endpoint_retries;
@ -112,17 +112,17 @@ struct mca_btl_base_endpoint_t {
};
typedef struct mca_btl_base_endpoint_t mca_btl_base_endpoint_t;
typedef mca_btl_base_endpoint_t mca_btl_ib_endpoint_t;
typedef mca_btl_base_endpoint_t mca_btl_mvapi_endpoint_t;
int mca_btl_ib_endpoint_send(mca_btl_base_endpoint_t* endpoint, struct mca_btl_ib_frag_t* frag);
int mca_btl_ib_endpoint_connect(mca_btl_base_endpoint_t*);
void mca_btl_ib_post_recv(void);
int mca_btl_mvapi_endpoint_send(mca_btl_base_endpoint_t* endpoint, struct mca_btl_mvapi_frag_t* frag);
int mca_btl_mvapi_endpoint_connect(mca_btl_base_endpoint_t*);
void mca_btl_mvapi_post_recv(void);
void mca_btl_ib_progress_send_frags(mca_btl_ib_endpoint_t*);
void mca_btl_mvapi_progress_send_frags(mca_btl_mvapi_endpoint_t*);
static inline int mca_btl_ib_endpoint_post_rr_sub(int cnt,
mca_btl_ib_endpoint_t* endpoint,
static inline int mca_btl_mvapi_endpoint_post_rr_sub(int cnt,
mca_btl_mvapi_endpoint_t* endpoint,
ompi_free_list_t* frag_list,
uint32_t* rr_posted,
VAPI_hca_hndl_t nic,
@ -132,16 +132,16 @@ static inline int mca_btl_ib_endpoint_post_rr_sub(int cnt,
int rc, i;
ompi_list_item_t* item;
mca_btl_ib_frag_t* frag;
mca_btl_ib_module_t *ib_btl = endpoint->endpoint_btl;
VAPI_rr_desc_t* rr_desc_post = ib_btl->rr_desc_post;
mca_btl_mvapi_frag_t* frag;
mca_btl_mvapi_module_t *mvapi_btl = endpoint->endpoint_btl;
VAPI_rr_desc_t* rr_desc_post = mvapi_btl->rr_desc_post;
/* prepare frags and post receive requests */
for(i = 0; i < cnt; i++) {
OMPI_FREE_LIST_WAIT(frag_list, item, rc);
frag = (mca_btl_ib_frag_t*) item;
frag = (mca_btl_mvapi_frag_t*) item;
frag->endpoint = endpoint;
frag->sg_entry.len = frag->size + ((unsigned char*) frag->segment.seg_addr.pval- (unsigned char*) frag->hdr); /* sizeof(mca_btl_ib_header_t); */
frag->sg_entry.len = frag->size + ((unsigned char*) frag->segment.seg_addr.pval- (unsigned char*) frag->hdr); /* sizeof(mca_btl_mvapi_header_t); */
rr_desc_post[i] = frag->rr_desc;
}
@ -151,48 +151,48 @@ static inline int mca_btl_ib_endpoint_post_rr_sub(int cnt,
cnt,
rr_desc_post);
if(VAPI_OK != frag->ret) {
MCA_BMI_IB_VAPI_ERROR(frag->ret, "EVAPI_post_rr_list");
MCA_BTL_IB_VAPI_ERROR(frag->ret, "EVAPI_post_rr_list");
return OMPI_ERROR;
}
OMPI_THREAD_ADD32(rr_posted, cnt);
return OMPI_SUCCESS;
}
static inline int mca_btl_ib_endpoint_post_rr( mca_btl_ib_endpoint_t * endpoint, int additional){
mca_btl_ib_module_t * ib_btl = endpoint->endpoint_btl;
static inline int mca_btl_mvapi_endpoint_post_rr( mca_btl_mvapi_endpoint_t * endpoint, int additional){
mca_btl_mvapi_module_t * mvapi_btl = endpoint->endpoint_btl;
int rc;
OMPI_THREAD_LOCK(&ib_btl->ib_lock);
OMPI_THREAD_LOCK(&mvapi_btl->ib_lock);
if(ib_btl->rr_posted_high <= mca_btl_ib_component.ib_rr_buf_min+additional && ib_btl->rr_posted_high < mca_btl_ib_component.ib_rr_buf_max){
if(mvapi_btl->rr_posted_high <= mca_btl_mvapi_component.ib_rr_buf_min+additional && mvapi_btl->rr_posted_high < mca_btl_mvapi_component.ib_rr_buf_max){
rc = mca_btl_ib_endpoint_post_rr_sub(mca_btl_ib_component.ib_rr_buf_max - ib_btl->rr_posted_high,
rc = mca_btl_mvapi_endpoint_post_rr_sub(mca_btl_mvapi_component.ib_rr_buf_max - mvapi_btl->rr_posted_high,
endpoint,
&ib_btl->recv_free_eager,
&ib_btl->rr_posted_high,
ib_btl->nic,
&mvapi_btl->recv_free_eager,
&mvapi_btl->rr_posted_high,
mvapi_btl->nic,
endpoint->lcl_qp_hndl_high
);
if(rc != OMPI_SUCCESS){
OMPI_THREAD_UNLOCK(&ib_btl->ib_lock);
OMPI_THREAD_UNLOCK(&mvapi_btl->ib_lock);
return rc;
}
}
if(ib_btl->rr_posted_low <= mca_btl_ib_component.ib_rr_buf_min+additional && ib_btl->rr_posted_low < mca_btl_ib_component.ib_rr_buf_max){
if(mvapi_btl->rr_posted_low <= mca_btl_mvapi_component.ib_rr_buf_min+additional && mvapi_btl->rr_posted_low < mca_btl_mvapi_component.ib_rr_buf_max){
rc = mca_btl_ib_endpoint_post_rr_sub(mca_btl_ib_component.ib_rr_buf_max - ib_btl->rr_posted_low,
rc = mca_btl_mvapi_endpoint_post_rr_sub(mca_btl_mvapi_component.ib_rr_buf_max - mvapi_btl->rr_posted_low,
endpoint,
&ib_btl->recv_free_max,
&ib_btl->rr_posted_low,
ib_btl->nic,
&mvapi_btl->recv_free_max,
&mvapi_btl->rr_posted_low,
mvapi_btl->nic,
endpoint->lcl_qp_hndl_low
);
if(rc != OMPI_SUCCESS) {
OMPI_THREAD_UNLOCK(&ib_btl->ib_lock);
OMPI_THREAD_UNLOCK(&mvapi_btl->ib_lock);
return rc;
}
}
OMPI_THREAD_UNLOCK(&ib_btl->ib_lock);
OMPI_THREAD_UNLOCK(&mvapi_btl->ib_lock);
return OMPI_SUCCESS;

Просмотреть файл

@ -14,8 +14,8 @@
* $HEADER$
*/
#ifndef MCA_BMI_IB_ERROR_H
#define MCA_BMI_IB_ERROR_H
#ifndef MCA_BTL_IB_ERROR_H
#define MCA_BTL_IB_ERROR_H
#include <vapi.h>
#include <mtl_common.h>
@ -25,7 +25,7 @@
*
*
*/
#define MCA_BMI_IB_VAPI_ERROR(vapi_ret, func_name) { \
#define MCA_BTL_IB_VAPI_ERROR(vapi_ret, func_name) { \
ompi_output(0,"[%s:%d] ", __FILE__, __LINE__); \
ompi_output(0,"%s : %s",func_name,VAPI_strerror(vapi_ret)); \
}

152
src/mca/btl/mvapi/btl_mvapi_frag.c Обычный файл
Просмотреть файл

@ -0,0 +1,152 @@
#include "btl_mvapi_frag.h"
#include "mca/common/vapi/vapi_mem_reg.h"
#include "mca/mpool/vapi/mpool_vapi.h"
static void mca_btl_mvapi_frag_common_constructor( mca_btl_mvapi_frag_t* frag)
{
mca_mpool_vapi_registration_t* mem_hndl = (mca_mpool_vapi_registration_t*) frag->base.super.user_data;
frag->hdr = (mca_btl_mvapi_header_t*) (frag+1); /* initialize the btl header to point to start at end of frag */
#if 0
mod = (unsigned long) frag->hdr % MCA_BTL_IB_FRAG_ALIGN;
if(mod != 0) {
frag->hdr = (mca_btl_mvapi_header_t*) ((unsigned char*) frag->hdr + (MCA_BTL_IB_FRAG_ALIGN - mod));
}
#endif
frag->segment.seg_addr.pval = ((unsigned char* )frag->hdr) + sizeof(mca_btl_mvapi_header_t); /* init the segment address to start after the btl header */
#if 0
mod = (frag->segment.seg_addr.lval) % MCA_BTL_IB_FRAG_ALIGN;
if(mod != 0) {
frag->segment.seg_addr.lval += (MCA_BTL_IB_FRAG_ALIGN - mod);
}
#endif
frag->mem_hndl = mem_hndl->hndl;
frag->segment.seg_len = frag->size;
frag->segment.seg_key.key32[0] = (uint32_t) mem_hndl->l_key;
frag->sg_entry.lkey = mem_hndl->l_key;
frag->sg_entry.addr = (VAPI_virt_addr_t) (MT_virt_addr_t) frag->hdr;
frag->base.des_flags = 0;
}
static void mca_btl_mvapi_send_frag_common_constructor(mca_btl_mvapi_frag_t* frag)
{
mca_btl_mvapi_frag_common_constructor(frag);
frag->base.des_src = &frag->segment;
frag->base.des_src_cnt = 1;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->sr_desc.comp_type = VAPI_SIGNALED;
frag->sr_desc.opcode = VAPI_SEND;
frag->sr_desc.remote_qkey = 0;
frag->sr_desc.sg_lst_len = 1;
frag->sr_desc.sg_lst_p = &frag->sg_entry;
frag->sr_desc.id = (VAPI_virt_addr_t) (MT_virt_addr_t) frag;
}
static void mca_btl_mvapi_recv_frag_common_constructor(mca_btl_mvapi_frag_t* frag)
{
mca_btl_mvapi_frag_common_constructor(frag);
frag->base.des_dst = &frag->segment;
frag->base.des_dst_cnt = 1;
frag->base.des_src = NULL;
frag->base.des_src_cnt = 0;
frag->rr_desc.comp_type = VAPI_SIGNALED;
frag->rr_desc.opcode = VAPI_RECEIVE;
frag->rr_desc.sg_lst_len = 1;
frag->rr_desc.sg_lst_p = &frag->sg_entry;
frag->rr_desc.id = (VAPI_virt_addr_t) (MT_virt_addr_t) frag;
}
static void mca_btl_mvapi_send_frag_eager_constructor(mca_btl_mvapi_frag_t* frag)
{
frag->size = mca_btl_mvapi_component.eager_limit;
mca_btl_mvapi_send_frag_common_constructor(frag);
}
static void mca_btl_mvapi_send_frag_max_constructor(mca_btl_mvapi_frag_t* frag)
{
frag->size = mca_btl_mvapi_component.max_send_size;
mca_btl_mvapi_send_frag_common_constructor(frag);
}
static void mca_btl_mvapi_recv_frag_max_constructor(mca_btl_mvapi_frag_t* frag)
{
frag->size = mca_btl_mvapi_component.max_send_size;
mca_btl_mvapi_recv_frag_common_constructor(frag);
}
static void mca_btl_mvapi_recv_frag_eager_constructor(mca_btl_mvapi_frag_t* frag)
{
frag->size = mca_btl_mvapi_component.eager_limit;
mca_btl_mvapi_recv_frag_common_constructor(frag);
}
static void mca_btl_mvapi_send_frag_frag_constructor(mca_btl_mvapi_frag_t* frag)
{
frag->size = 0;
mca_btl_mvapi_send_frag_common_constructor(frag);
}
OBJ_CLASS_INSTANCE(
mca_btl_mvapi_frag_t,
mca_btl_base_descriptor_t,
NULL,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_mvapi_send_frag_eager_t,
mca_btl_base_descriptor_t,
mca_btl_mvapi_send_frag_eager_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_mvapi_send_frag_max_t,
mca_btl_base_descriptor_t,
mca_btl_mvapi_send_frag_max_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_mvapi_send_frag_frag_t,
mca_btl_base_descriptor_t,
mca_btl_mvapi_send_frag_frag_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_mvapi_recv_frag_eager_t,
mca_btl_base_descriptor_t,
mca_btl_mvapi_recv_frag_eager_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_mvapi_recv_frag_max_t,
mca_btl_base_descriptor_t,
mca_btl_mvapi_recv_frag_max_constructor,
NULL);

149
src/mca/btl/mvapi/btl_mvapi_frag.h Обычный файл
Просмотреть файл

@ -0,0 +1,149 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MCA_BTL_IB_FRAG_H
#define MCA_BTL_IB_FRAG_H
#define MCA_BTL_IB_FRAG_ALIGN (8)
#include "ompi_config.h"
#include "btl_mvapi.h"
#include <vapi.h>
#include <mtl_common.h>
#include <vapi_common.h>
#include "mca/mpool/vapi/mpool_vapi.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_btl_mvapi_frag_t);
typedef mca_btl_base_header_t mca_btl_mvapi_header_t;
typedef enum {
MCA_BTL_IB_FRAG_SEND,
MCA_BTL_IB_FRAG_PUT,
MCA_BTL_IB_FRAG_GET,
MCA_BTL_IB_FRAG_ACK
} mca_btl_mvapi_frag_type_t;
/**
* IB send fragment derived type.
*/
struct mca_btl_mvapi_frag_t {
mca_btl_base_descriptor_t base;
mca_btl_base_segment_t segment;
struct mca_btl_base_endpoint_t *endpoint;
mca_btl_mvapi_frag_type_t type;
size_t size;
int rc;
union{
VAPI_rr_desc_t rr_desc;
VAPI_sr_desc_t sr_desc;
};
VAPI_sg_lst_entry_t sg_entry;
VAPI_mr_hndl_t mem_hndl;
VAPI_ret_t ret;
mca_btl_mvapi_header_t *hdr;
mca_mpool_vapi_registration_t * vapi_reg;
};
typedef struct mca_btl_mvapi_frag_t mca_btl_mvapi_frag_t;
OBJ_CLASS_DECLARATION(mca_btl_mvapi_frag_t);
typedef struct mca_btl_mvapi_frag_t mca_btl_mvapi_send_frag_eager_t;
OBJ_CLASS_DECLARATION(mca_btl_mvapi_send_frag_eager_t);
typedef struct mca_btl_mvapi_frag_t mca_btl_mvapi_send_frag_max_t;
OBJ_CLASS_DECLARATION(mca_btl_mvapi_send_frag_max_t);
typedef struct mca_btl_mvapi_frag_t mca_btl_mvapi_send_frag_frag_t;
OBJ_CLASS_DECLARATION(mca_btl_mvapi_send_frag_frag_t);
typedef struct mca_btl_mvapi_frag_t mca_btl_mvapi_recv_frag_eager_t;
OBJ_CLASS_DECLARATION(mca_btl_mvapi_recv_frag_eager_t);
typedef struct mca_btl_mvapi_frag_t mca_btl_mvapi_recv_frag_max_t;
OBJ_CLASS_DECLARATION(mca_btl_mvapi_recv_frag_max_t);
/*
* Allocate an IB send descriptor
*
*/
#define MCA_BTL_IB_FRAG_ALLOC_EAGER(btl, frag, rc) \
{ \
\
ompi_list_item_t *item; \
OMPI_FREE_LIST_WAIT(&((mca_btl_mvapi_module_t*)btl)->send_free_eager, item, rc); \
frag = (mca_btl_mvapi_frag_t*) item; \
}
#define MCA_BTL_IB_FRAG_RETURN_EAGER(btl, frag) \
{ \
OMPI_FREE_LIST_RETURN(&((mca_btl_mvapi_module_t*)btl)->send_free_eager, (ompi_list_item_t*)(frag)); \
}
#define MCA_BTL_IB_FRAG_ALLOC_MAX(btl, frag, rc) \
{ \
\
ompi_list_item_t *item; \
OMPI_FREE_LIST_WAIT(&((mca_btl_mvapi_module_t*)btl)->send_free_max, item, rc); \
frag = (mca_btl_mvapi_frag_t*) item; \
}
#define MCA_BTL_IB_FRAG_RETURN_MAX(btl, frag) \
{ \
OMPI_FREE_LIST_RETURN(&((mca_btl_mvapi_module_t*)btl)->send_free_max, (ompi_list_item_t*)(frag)); \
}
#define MCA_BTL_IB_FRAG_ALLOC_FRAG(btl, frag, rc) \
{ \
\
ompi_list_item_t *item; \
OMPI_FREE_LIST_WAIT(&((mca_btl_mvapi_module_t*)btl)->send_free_frag, item, rc); \
frag = (mca_btl_mvapi_frag_t*) item; \
}
#define MCA_BTL_IB_FRAG_RETURN_FRAG(btl, frag) \
{ \
OMPI_FREE_LIST_RETURN(&((mca_btl_mvapi_module_t*)btl)->send_free_frag, (ompi_list_item_t*)(frag)); \
}
struct mca_btl_mvapi_module_t;
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

Просмотреть файл

@ -19,17 +19,17 @@
#include "class/ompi_hash_table.h"
#include "mca/base/mca_base_module_exchange.h"
#include "btl_ib.h"
#include "btl_ib_proc.h"
#include "btl_mvapi.h"
#include "btl_mvapi_proc.h"
static void mca_btl_ib_proc_construct(mca_btl_ib_proc_t* proc);
static void mca_btl_ib_proc_destruct(mca_btl_ib_proc_t* proc);
static void mca_btl_mvapi_proc_construct(mca_btl_mvapi_proc_t* proc);
static void mca_btl_mvapi_proc_destruct(mca_btl_mvapi_proc_t* proc);
OBJ_CLASS_INSTANCE(mca_btl_ib_proc_t,
ompi_list_item_t, mca_btl_ib_proc_construct,
mca_btl_ib_proc_destruct);
OBJ_CLASS_INSTANCE(mca_btl_mvapi_proc_t,
ompi_list_item_t, mca_btl_mvapi_proc_construct,
mca_btl_mvapi_proc_destruct);
void mca_btl_ib_proc_construct(mca_btl_ib_proc_t* proc)
void mca_btl_mvapi_proc_construct(mca_btl_mvapi_proc_t* proc)
{
proc->proc_ompi = 0;
proc->proc_addr_count = 0;
@ -37,21 +37,21 @@ void mca_btl_ib_proc_construct(mca_btl_ib_proc_t* proc)
proc->proc_endpoint_count = 0;
OBJ_CONSTRUCT(&proc->proc_lock, ompi_mutex_t);
/* add to list of all proc instance */
OMPI_THREAD_LOCK(&mca_btl_ib_component.ib_lock);
ompi_list_append(&mca_btl_ib_component.ib_procs, &proc->super);
OMPI_THREAD_UNLOCK(&mca_btl_ib_component.ib_lock);
OMPI_THREAD_LOCK(&mca_btl_mvapi_component.ib_lock);
ompi_list_append(&mca_btl_mvapi_component.ib_procs, &proc->super);
OMPI_THREAD_UNLOCK(&mca_btl_mvapi_component.ib_lock);
}
/*
* Cleanup ib proc instance
*/
void mca_btl_ib_proc_destruct(mca_btl_ib_proc_t* proc)
void mca_btl_mvapi_proc_destruct(mca_btl_mvapi_proc_t* proc)
{
/* remove from list of all proc instances */
OMPI_THREAD_LOCK(&mca_btl_ib_component.ib_lock);
ompi_list_remove_item(&mca_btl_ib_component.ib_procs, &proc->super);
OMPI_THREAD_UNLOCK(&mca_btl_ib_component.ib_lock);
OMPI_THREAD_LOCK(&mca_btl_mvapi_component.ib_lock);
ompi_list_remove_item(&mca_btl_mvapi_component.ib_procs, &proc->super);
OMPI_THREAD_UNLOCK(&mca_btl_mvapi_component.ib_lock);
/* release resources */
if(NULL != proc->proc_endpoints) {
@ -64,45 +64,45 @@ void mca_btl_ib_proc_destruct(mca_btl_ib_proc_t* proc)
* Look for an existing IB process instances based on the associated
* ompi_proc_t instance.
*/
static mca_btl_ib_proc_t* mca_btl_ib_proc_lookup_ompi(ompi_proc_t* ompi_proc)
static mca_btl_mvapi_proc_t* mca_btl_mvapi_proc_lookup_ompi(ompi_proc_t* ompi_proc)
{
mca_btl_ib_proc_t* ib_proc;
mca_btl_mvapi_proc_t* ib_proc;
OMPI_THREAD_LOCK(&mca_btl_ib_component.ib_lock);
OMPI_THREAD_LOCK(&mca_btl_mvapi_component.ib_lock);
for(ib_proc = (mca_btl_ib_proc_t*)
ompi_list_get_first(&mca_btl_ib_component.ib_procs);
ib_proc != (mca_btl_ib_proc_t*)
ompi_list_get_end(&mca_btl_ib_component.ib_procs);
ib_proc = (mca_btl_ib_proc_t*)ompi_list_get_next(ib_proc)) {
for(ib_proc = (mca_btl_mvapi_proc_t*)
ompi_list_get_first(&mca_btl_mvapi_component.ib_procs);
ib_proc != (mca_btl_mvapi_proc_t*)
ompi_list_get_end(&mca_btl_mvapi_component.ib_procs);
ib_proc = (mca_btl_mvapi_proc_t*)ompi_list_get_next(ib_proc)) {
if(ib_proc->proc_ompi == ompi_proc) {
OMPI_THREAD_UNLOCK(&mca_btl_ib_component.ib_lock);
OMPI_THREAD_UNLOCK(&mca_btl_mvapi_component.ib_lock);
return ib_proc;
}
}
OMPI_THREAD_UNLOCK(&mca_btl_ib_component.ib_lock);
OMPI_THREAD_UNLOCK(&mca_btl_mvapi_component.ib_lock);
return NULL;
}
/*
* Create a IB process structure. There is a one-to-one correspondence
* between a ompi_proc_t and a mca_btl_ib_proc_t instance. We cache
* additional data (specifically the list of mca_btl_ib_endpoint_t instances,
* between a ompi_proc_t and a mca_btl_mvapi_proc_t instance. We cache
* additional data (specifically the list of mca_btl_mvapi_endpoint_t instances,
* and published addresses) associated w/ a given destination on this
* datastructure.
*/
mca_btl_ib_proc_t* mca_btl_ib_proc_create(ompi_proc_t* ompi_proc)
mca_btl_mvapi_proc_t* mca_btl_mvapi_proc_create(ompi_proc_t* ompi_proc)
{
mca_btl_ib_proc_t* module_proc = NULL;
mca_btl_mvapi_proc_t* module_proc = NULL;
/* Check if we have already created a IB proc
* structure for this ompi process */
module_proc = mca_btl_ib_proc_lookup_ompi(ompi_proc);
module_proc = mca_btl_mvapi_proc_lookup_ompi(ompi_proc);
if(module_proc != NULL) {
@ -113,7 +113,7 @@ mca_btl_ib_proc_t* mca_btl_ib_proc_create(ompi_proc_t* ompi_proc)
/* Oops! First time, gotta create a new IB proc
* out of the ompi_proc ... */
module_proc = OBJ_NEW(mca_btl_ib_proc_t);
module_proc = OBJ_NEW(mca_btl_mvapi_proc_t);
/* Initialize number of peer */
module_proc->proc_endpoint_count = 0;
@ -131,7 +131,7 @@ mca_btl_ib_proc_t* mca_btl_ib_proc_create(ompi_proc_t* ompi_proc)
/* XXX: Right now, there can be only 1 peer associated
* with a proc. Needs a little bit change in
* mca_btl_ib_proc_t to allow on demand increasing of
* mca_btl_mvapi_proc_t to allow on demand increasing of
* number of endpoints for this proc */
module_proc->proc_endpoints = (mca_btl_base_endpoint_t**)
@ -150,7 +150,7 @@ mca_btl_ib_proc_t* mca_btl_ib_proc_create(ompi_proc_t* ompi_proc)
* already held. Insert a btl instance into the proc array and assign
* it an address.
*/
int mca_btl_ib_proc_insert(mca_btl_ib_proc_t* module_proc,
int mca_btl_mvapi_proc_insert(mca_btl_mvapi_proc_t* module_proc,
mca_btl_base_endpoint_t* module_endpoint)
{
/* insert into endpoint array */

Просмотреть файл

@ -14,27 +14,27 @@
* $HEADER$
*/
#ifndef MCA_BMI_IB_PROC_H
#define MCA_BMI_IB_PROC_H
#ifndef MCA_BTL_IB_PROC_H
#define MCA_BTL_IB_PROC_H
#include "mca/ns/ns.h"
#include "class/ompi_object.h"
#include "proc/proc.h"
#include "btl_ib.h"
#include "btl_ib_endpoint.h"
#include "btl_mvapi.h"
#include "btl_mvapi_endpoint.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
OBJ_CLASS_DECLARATION(mca_btl_ib_proc_t);
OBJ_CLASS_DECLARATION(mca_btl_mvapi_proc_t);
/**
* Represents the state of a remote process and the set of addresses
* that it exports. Also cache an instance of mca_btl_base_endpoint_t for
* each
* BMI instance that attempts to open a connection to the process.
* BTL instance that attempts to open a connection to the process.
*/
struct mca_btl_ib_proc_t {
struct mca_btl_mvapi_proc_t {
ompi_list_item_t super;
/**< allow proc to be placed on a list */
@ -56,10 +56,10 @@ struct mca_btl_ib_proc_t {
ompi_mutex_t proc_lock;
/**< lock to protect against concurrent access to proc state */
};
typedef struct mca_btl_ib_proc_t mca_btl_ib_proc_t;
typedef struct mca_btl_mvapi_proc_t mca_btl_mvapi_proc_t;
mca_btl_ib_proc_t* mca_btl_ib_proc_create(ompi_proc_t* ompi_proc);
int mca_btl_ib_proc_insert(mca_btl_ib_proc_t*, mca_btl_base_endpoint_t*);
mca_btl_mvapi_proc_t* mca_btl_mvapi_proc_create(ompi_proc_t* ompi_proc);
int mca_btl_mvapi_proc_insert(mca_btl_mvapi_proc_t*, mca_btl_base_endpoint_t*);
#if defined(c_plusplus) || defined(__cplusplus)
}

Просмотреть файл

@ -1,43 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MCA_BMI_IB_ERROR_H
#define MCA_BMI_IB_ERROR_H
#include <vapi.h>
#include <mtl_common.h>
#include <vapi_common.h>
/*
*
*
*/
#define MCA_BMI_IB_VAPI_ERROR(vapi_ret, func_name) { \
ompi_output(0,"[%s:%d] ", __FILE__, __LINE__); \
ompi_output(0,"%s : %s",func_name,VAPI_strerror(vapi_ret)); \
}
/* Debug Print */
#if 0
#define DEBUG_OUT(fmt, args...) { \
ompi_output(0, "[%s:%d:%s] " fmt, __FILE__, __LINE__, __func__, \
##args); \
}
#else
#define DEBUG_OUT(fmt, args...)
#endif
#endif

Просмотреть файл

@ -1,152 +0,0 @@
#include "btl_ib_frag.h"
#include "mca/common/vapi/vapi_mem_reg.h"
#include "mca/mpool/vapi/mpool_vapi.h"
static void mca_btl_ib_frag_common_constructor( mca_btl_ib_frag_t* frag)
{
mca_mpool_vapi_registration_t* mem_hndl = (mca_mpool_vapi_registration_t*) frag->base.super.user_data;
frag->hdr = (mca_btl_ib_header_t*) (frag+1); /* initialize the btl header to point to start at end of frag */
#if 0
mod = (unsigned long) frag->hdr % MCA_BMI_IB_FRAG_ALIGN;
if(mod != 0) {
frag->hdr = (mca_btl_ib_header_t*) ((unsigned char*) frag->hdr + (MCA_BMI_IB_FRAG_ALIGN - mod));
}
#endif
frag->segment.seg_addr.pval = ((unsigned char* )frag->hdr) + sizeof(mca_btl_ib_header_t); /* init the segment address to start after the btl header */
#if 0
mod = (frag->segment.seg_addr.lval) % MCA_BMI_IB_FRAG_ALIGN;
if(mod != 0) {
frag->segment.seg_addr.lval += (MCA_BMI_IB_FRAG_ALIGN - mod);
}
#endif
frag->mem_hndl = mem_hndl->hndl;
frag->segment.seg_len = frag->size;
frag->segment.seg_key.key32[0] = (uint32_t) mem_hndl->l_key;
frag->sg_entry.lkey = mem_hndl->l_key;
frag->sg_entry.addr = (VAPI_virt_addr_t) (MT_virt_addr_t) frag->hdr;
frag->base.des_flags = 0;
}
static void mca_btl_ib_send_frag_common_constructor(mca_btl_ib_frag_t* frag)
{
mca_btl_ib_frag_common_constructor(frag);
frag->base.des_src = &frag->segment;
frag->base.des_src_cnt = 1;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->sr_desc.comp_type = VAPI_SIGNALED;
frag->sr_desc.opcode = VAPI_SEND;
frag->sr_desc.remote_qkey = 0;
frag->sr_desc.sg_lst_len = 1;
frag->sr_desc.sg_lst_p = &frag->sg_entry;
frag->sr_desc.id = (VAPI_virt_addr_t) (MT_virt_addr_t) frag;
}
static void mca_btl_ib_recv_frag_common_constructor(mca_btl_ib_frag_t* frag)
{
mca_btl_ib_frag_common_constructor(frag);
frag->base.des_dst = &frag->segment;
frag->base.des_dst_cnt = 1;
frag->base.des_src = NULL;
frag->base.des_src_cnt = 0;
frag->rr_desc.comp_type = VAPI_SIGNALED;
frag->rr_desc.opcode = VAPI_RECEIVE;
frag->rr_desc.sg_lst_len = 1;
frag->rr_desc.sg_lst_p = &frag->sg_entry;
frag->rr_desc.id = (VAPI_virt_addr_t) (MT_virt_addr_t) frag;
}
static void mca_btl_ib_send_frag_eager_constructor(mca_btl_ib_frag_t* frag)
{
frag->size = mca_btl_ib_component.eager_limit;
mca_btl_ib_send_frag_common_constructor(frag);
}
static void mca_btl_ib_send_frag_max_constructor(mca_btl_ib_frag_t* frag)
{
frag->size = mca_btl_ib_component.max_send_size;
mca_btl_ib_send_frag_common_constructor(frag);
}
static void mca_btl_ib_recv_frag_max_constructor(mca_btl_ib_frag_t* frag)
{
frag->size = mca_btl_ib_component.max_send_size;
mca_btl_ib_recv_frag_common_constructor(frag);
}
static void mca_btl_ib_recv_frag_eager_constructor(mca_btl_ib_frag_t* frag)
{
frag->size = mca_btl_ib_component.eager_limit;
mca_btl_ib_recv_frag_common_constructor(frag);
}
static void mca_btl_ib_send_frag_frag_constructor(mca_btl_ib_frag_t* frag)
{
frag->size = 0;
mca_btl_ib_send_frag_common_constructor(frag);
}
OBJ_CLASS_INSTANCE(
mca_btl_ib_frag_t,
mca_btl_base_descriptor_t,
NULL,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_ib_send_frag_eager_t,
mca_btl_base_descriptor_t,
mca_btl_ib_send_frag_eager_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_ib_send_frag_max_t,
mca_btl_base_descriptor_t,
mca_btl_ib_send_frag_max_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_ib_send_frag_frag_t,
mca_btl_base_descriptor_t,
mca_btl_ib_send_frag_frag_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_ib_recv_frag_eager_t,
mca_btl_base_descriptor_t,
mca_btl_ib_recv_frag_eager_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_ib_recv_frag_max_t,
mca_btl_base_descriptor_t,
mca_btl_ib_recv_frag_max_constructor,
NULL);

Просмотреть файл

@ -1,149 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MCA_BMI_IB_FRAG_H
#define MCA_BMI_IB_FRAG_H
#define MCA_BMI_IB_FRAG_ALIGN (8)
#include "ompi_config.h"
#include "btl_ib.h"
#include <vapi.h>
#include <mtl_common.h>
#include <vapi_common.h>
#include "mca/mpool/vapi/mpool_vapi.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_btl_ib_frag_t);
typedef mca_btl_base_header_t mca_btl_ib_header_t;
typedef enum {
MCA_BMI_IB_FRAG_SEND,
MCA_BMI_IB_FRAG_PUT,
MCA_BMI_IB_FRAG_GET,
MCA_BMI_IB_FRAG_ACK
} mca_btl_ib_frag_type_t;
/**
* IB send fragment derived type.
*/
struct mca_btl_ib_frag_t {
mca_btl_base_descriptor_t base;
mca_btl_base_segment_t segment;
struct mca_btl_base_endpoint_t *endpoint;
mca_btl_ib_frag_type_t type;
size_t size;
int rc;
union{
VAPI_rr_desc_t rr_desc;
VAPI_sr_desc_t sr_desc;
};
VAPI_sg_lst_entry_t sg_entry;
VAPI_mr_hndl_t mem_hndl;
VAPI_ret_t ret;
mca_btl_ib_header_t *hdr;
mca_mpool_vapi_registration_t * vapi_reg;
};
typedef struct mca_btl_ib_frag_t mca_btl_ib_frag_t;
OBJ_CLASS_DECLARATION(mca_btl_ib_frag_t);
typedef struct mca_btl_ib_frag_t mca_btl_ib_send_frag_eager_t;
OBJ_CLASS_DECLARATION(mca_btl_ib_send_frag_eager_t);
typedef struct mca_btl_ib_frag_t mca_btl_ib_send_frag_max_t;
OBJ_CLASS_DECLARATION(mca_btl_ib_send_frag_max_t);
typedef struct mca_btl_ib_frag_t mca_btl_ib_send_frag_frag_t;
OBJ_CLASS_DECLARATION(mca_btl_ib_send_frag_frag_t);
typedef struct mca_btl_ib_frag_t mca_btl_ib_recv_frag_eager_t;
OBJ_CLASS_DECLARATION(mca_btl_ib_recv_frag_eager_t);
typedef struct mca_btl_ib_frag_t mca_btl_ib_recv_frag_max_t;
OBJ_CLASS_DECLARATION(mca_btl_ib_recv_frag_max_t);
/*
* Allocate an IB send descriptor
*
*/
#define MCA_BMI_IB_FRAG_ALLOC_EAGER(btl, frag, rc) \
{ \
\
ompi_list_item_t *item; \
OMPI_FREE_LIST_WAIT(&((mca_btl_ib_module_t*)btl)->send_free_eager, item, rc); \
frag = (mca_btl_ib_frag_t*) item; \
}
#define MCA_BMI_IB_FRAG_RETURN_EAGER(btl, frag) \
{ \
OMPI_FREE_LIST_RETURN(&((mca_btl_ib_module_t*)btl)->send_free_eager, (ompi_list_item_t*)(frag)); \
}
#define MCA_BMI_IB_FRAG_ALLOC_MAX(btl, frag, rc) \
{ \
\
ompi_list_item_t *item; \
OMPI_FREE_LIST_WAIT(&((mca_btl_ib_module_t*)btl)->send_free_max, item, rc); \
frag = (mca_btl_ib_frag_t*) item; \
}
#define MCA_BMI_IB_FRAG_RETURN_MAX(btl, frag) \
{ \
OMPI_FREE_LIST_RETURN(&((mca_btl_ib_module_t*)btl)->send_free_max, (ompi_list_item_t*)(frag)); \
}
#define MCA_BMI_IB_FRAG_ALLOC_FRAG(btl, frag, rc) \
{ \
\
ompi_list_item_t *item; \
OMPI_FREE_LIST_WAIT(&((mca_btl_ib_module_t*)btl)->send_free_frag, item, rc); \
frag = (mca_btl_ib_frag_t*) item; \
}
#define MCA_BMI_IB_FRAG_RETURN_FRAG(btl, frag) \
{ \
OMPI_FREE_LIST_RETURN(&((mca_btl_ib_module_t*)btl)->send_free_frag, (ompi_list_item_t*)(frag)); \
}
struct mca_btl_ib_module_t;
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

Просмотреть файл

@ -17,6 +17,6 @@
# Specific to this module
PARAM_INIT_FILE=btl_ib.c
PARAM_INIT_FILE=btl_mvapi.c
PARAM_CONFIG_HEADER_FILE="ib_config.h"
PARAM_CONFIG_FILES="Makefile"

Просмотреть файл

@ -23,29 +23,29 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
# Additional --with flags that can be specified
AC_ARG_WITH(btl-ib,
AC_HELP_STRING([--with-btl-ib=IBDIR],
AC_ARG_WITH(btl-mvapi,
AC_HELP_STRING([--with-btl-mvapi=IBDIR],
[Specify the installation directory of IB (should enable the correct automatic determination of using the 32 or 64 bit library, if both are present under IBDIR/lib and IBDIR/lib64)]))
AC_ARG_WITH(btl-ib-libdir,
AC_HELP_STRING([--with-btl-ib-libdir=IBLIBDIR],
AC_ARG_WITH(btl-mvapi-libdir,
AC_HELP_STRING([--with-btl-mvapi-libdir=IBLIBDIR],
[directory where the IB library can be found, if it is not in $IBDIR/lib or $IBDIR/lib64]))
# Quick sanity check
if test "$with_btl_ib" = "no"; then
AC_MSG_WARN([*** --without-btl-ib specified -- aborting])
if test "$with_btl_mvapi" = "no"; then
AC_MSG_WARN([*** --without-btl-mvapi specified -- aborting])
AC_MSG_ERROR([Will not continue])
fi
# Find the right IBDIR
if test "$with_btl_ib" != "" -a "$with_btl_ib" != "yes" ; then
IBDIR="$with_btl_ib"
IBLIBDIR="$with_btl_ib"
if test "$with_btl_mvapi" != "" -a "$with_btl_mvapi" != "yes" ; then
IBDIR="$with_btl_mvapi"
IBLIBDIR="$with_btl_mvapi"
fi
if test "$with_btl_ib_libdir" != "" -a "$with_btl_ib_libdir" != "yes" -a \
"$with_btl_ib_libdir" != "no"; then
IBLIBDIR="$with_btl_ib_libdir"
if test "$with_btl_mvapi_libdir" != "" -a "$with_btl_mvapi_libdir" != "yes" -a \
"$with_btl_mvapi_libdir" != "no"; then
IBLIBDIR="$with_btl_mvapi_libdir"
fi
# Add to CPPFLAGS if necessary
@ -56,7 +56,7 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
EXTRA_CPPFLAGS="-I$IBDIR/include"
else
AC_MSG_WARN([*** Warning: cannot find $IBDIR/include])
AC_MSG_WARN([*** Will still try to configure ib btl anyway...])
AC_MSG_WARN([*** Will still try to configure mvapi btl anyway...])
fi
if test "$IBDIR" != "" -a -d "$IBDIR/wrap"; then
EXTRA_CPPFLAGS="-I$IBDIR/wrap $EXTRA_CPPFLAGS"
@ -90,7 +90,7 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
CFLAGS="`echo $CFLAGS | sed 's/-pedantic//g'`"
mca_btl_ib_try_find_libvapi() {
mca_btl_mvapi_try_find_libvapi() {
func1=[$]1
func2=[$]2
@ -121,7 +121,7 @@ mca_btl_ib_try_find_libvapi() {
if test -d "$IBLIBDIR/lib"; then
EXTRA_LDFLAGS="-L$IBLIBDIR/lib"
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
mca_btl_ib_try_find_libvapi VAPI_open_hca VAPI_query_hca_cap
mca_btl_mvapi_try_find_libvapi VAPI_open_hca VAPI_query_hca_cap
if test "$LIBS" != "$LIBS_orig"; then
echo "--> found libvapi in $IBLIBDIR/lib"
fi
@ -130,7 +130,7 @@ mca_btl_ib_try_find_libvapi() {
if test "$LIBS" = "$LIBS_orig" -a -d "$IBLIBDIR/lib64"; then
EXTRA_LDFLAGS="-L$IBLIBDIR/lib64"
LDFLAGS="$LDFLAGS_save $EXTRA_LDFLAGS"
mca_btl_ib_try_find_libvapi EVAPI_list_hcas EVAPI_open_hca
mca_btl_mvapi_try_find_libvapi EVAPI_list_hcas EVAPI_open_hca
if test "$LIBS" != "$LIBS_orig"; then
echo "--> found libvapi in $IBLIBDIR/lib64"
fi

Просмотреть файл

@ -22,34 +22,34 @@ include $(top_ompi_srcdir)/config/Makefile.options
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if OMPI_BUILD_bmi_portals_DSO
if OMPI_BUILD_btl_portals_DSO
component_noinst =
component_install = mca_bmi_portals.la
component_install = mca_btl_portals.la
else
component_noinst = libmca_bmi_portals.la
component_noinst = libmca_btl_portals.la
component_install =
endif
EXTRA_DIST = \
src/bmi_portals_compat_utcp.c \
src/bmi_portals_compat_redstorm.c
src/btl_portals_compat_utcp.c \
src/btl_portals_compat_redstorm.c
portals_SOURCES = \
src/bmi_portals.h \
src/bmi_portals_compat.h \
src/bmi_portals.c \
src/bmi_portals_component.c \
src/bmi_portals_stubs.c \
src/bmi_portals_compat_utcp.c
src/btl_portals.h \
src/btl_portals_compat.h \
src/btl_portals.c \
src/btl_portals_component.c \
src/btl_portals_stubs.c \
src/btl_portals_compat_utcp.c
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component_install)
mca_bmi_portals_la_SOURCES = $(portals_SOURCES)
mca_bmi_portals_la_LIBADD =
mca_bmi_portals_la_LDFLAGS = -module -avoid-version
mca_btl_portals_la_SOURCES = $(portals_SOURCES)
mca_btl_portals_la_LIBADD =
mca_btl_portals_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(component_noinst)
libmca_bmi_portals_la_SOURCES = $(portals_SOURCES)
libmca_bmi_portals_la_LIBADD =
libmca_bmi_portals_la_LDFLAGS = -module -avoid-version
libmca_btl_portals_la_SOURCES = $(portals_SOURCES)
libmca_btl_portals_la_LIBADD =
libmca_btl_portals_la_LDFLAGS = -module -avoid-version

Просмотреть файл

@ -17,6 +17,6 @@
# Specific to this module
PARAM_INIT_FILE=src/bmi_portals.h
PARAM_INIT_FILE=src/btl_portals.h
PARAM_CONFIG_HEADER_FILE="portals_config.h"
PARAM_CONFIG_FILES="Makefile"

Просмотреть файл

@ -19,26 +19,26 @@
# quicky function to set #defines based on argument values
#
# ARGUMENTS:
# 1 configure name (first argument to ARG_WITH, minus the bmi-portals-)
# 1 configure name (first argument to ARG_WITH, minus the btl-portals-)
# 2 define name
# 3 default value
# 4 description (used for both ARG_WITH and DEFINE)
AC_DEFUN([MCA_BMI_PORTALS_CONFIG_VAL],
[
AC_ARG_WITH([bmi-portals-$1], AC_HELP_STRING([--with-bmi-portals-$1],
AC_ARG_WITH([btl-portals-$1], AC_HELP_STRING([--with-btl-portals-$1],
[$4 (default: $3)]))
AC_MSG_CHECKING([for $1 value])
case "[$with_]m4_bpatsubst([bmi-portals-$1], -, _)" in
case "[$with_]m4_bpatsubst([btl-portals-$1], -, _)" in
"")
$2=$3
AC_MSG_RESULT([[$]$2 (default)])
;;
"no")
AC_MSG_RESULT([error])
AC_MSG_ERROR([--without-bmi-portals-$1 is invalid argument])
AC_MSG_ERROR([--without-btl-portals-$1 is invalid argument])
;;
*)
$2="$with_m4_bpatsubst([bmi-portals-$1], -, _)"
$2="$with_m4_bpatsubst([btl-portals-$1], -, _)"
AC_MSG_RESULT([[$]$2])
;;
esac
@ -54,18 +54,18 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
# Additional --with flags that can be specified
AC_ARG_WITH(bmi-portals,
AC_HELP_STRING([--with-bmi-portals=DIR],
AC_ARG_WITH(btl-portals,
AC_HELP_STRING([--with-btl-portals=DIR],
[Specify the installation directory of PORTALS]))
# Add to CPPFLAGS if necessary
EXTRA_CPPFLAGS=
if test -n "$with_bmi_portals"; then
if test -d "$with_bmi_portals/include"; then
EXTRA_CPPFLAGS="-I$with_bmi_portals/include"
if test -n "$with_btl_portals"; then
if test -d "$with_btl_portals/include"; then
EXTRA_CPPFLAGS="-I$with_btl_portals/include"
else
AC_MSG_WARN([*** Warning: cannot find $with_bmi_portals/include])
AC_MSG_WARN([*** Will still try to configure portals bmi anyway...])
AC_MSG_WARN([*** Warning: cannot find $with_btl_portals/include])
AC_MSG_WARN([*** Will still try to configure portals btl anyway...])
fi
fi
@ -76,12 +76,12 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
# Add to LDFLAGS if necessary
EXTRA_LDFLAGS=
if test -n "$with_bmi_portals"; then
if test -d "$with_bmi_portals/lib"; then
EXTRA_LDFLAGS="-L$with_bmi_portals/lib"
if test -n "$with_btl_portals"; then
if test -d "$with_btl_portals/lib"; then
EXTRA_LDFLAGS="-L$with_btl_portals/lib"
else
AC_MSG_WARN([*** Warning: cannot find $with_bmi_portals/lib])
AC_MSG_WARN([*** Will still try to configure portals bmi anyway...])
AC_MSG_WARN([*** Warning: cannot find $with_btl_portals/lib])
AC_MSG_WARN([*** Will still try to configure portals btl anyway...])
fi
fi
@ -94,15 +94,15 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
BMI_PORTALS_COMPAT=""
BMI_PORTALS_HAVE_EVENT_UNLINK=0
AC_ARG_WITH([bmi-portals-config],
AC_HELP_STRING([--with-bmi-portals-config],
AC_ARG_WITH([btl-portals-config],
AC_HELP_STRING([--with-btl-portals-config],
[configuration to use for Portals support.
One of "utcp", "redstorm". (default: utcp)]))
AC_MSG_CHECKING([for Portals configuration])
if test "$with_bmi_portals_config" = "" ; then
with_bmi_portals_config="utcp"
if test "$with_btl_portals_config" = "" ; then
with_btl_portals_config="utcp"
fi
case "$with_bmi_portals_config" in
case "$with_btl_portals_config" in
"utcp")
BMI_PORTALS_UTCP=1
PORTALS_LIBS="-lutcpapi -lutcplib -lp3api -lp3lib -lp3rt"
@ -121,12 +121,12 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
esac
# Try to find all the portals libraries (this is not fun!)
AC_ARG_WITH(bmi-portals-libs,
AC_HELP_STRING([--with-bmi-portals-libs=LIBS],
AC_ARG_WITH(btl-portals-libs,
AC_HELP_STRING([--with-btl-portals-libs=LIBS],
[Libraries to link with for portals]))
if test -n "$with_bmi_portals_libs" ; then
if test -n "$with_btl_portals_libs" ; then
PORTALS_LIBS=""
for lib in $with_bmi_portals_libs ; do
for lib in $with_btl_portals_libs ; do
PORTALS_LIBS="$PORTALS_LIBS -l$lib"
done
fi
@ -164,7 +164,7 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
MCA_BMI_PORTALS_CONFIG_VAL([debug-level],
[BMI_PORTALS_DEFAULT_DEBUG_LEVEL], [100],
[debugging level for portals bmi])
[debugging level for portals btl])
MCA_BMI_PORTALS_CONFIG_VAL([eager-limit],
[BMI_PORTALS_DEFAULT_EAGER_LIMIT], [16384],

Просмотреть файл

@ -25,14 +25,14 @@
#include "include/constants.h"
#include "util/output.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "mca/btl/btl.h"
#include "bmi_portals.h"
#include "bmi_portals_compat.h"
#include "btl_portals.h"
#include "btl_portals_compat.h"
mca_bmi_portals_module_t mca_bmi_portals_module = {
mca_btl_portals_module_t mca_btl_portals_module = {
{
&mca_bmi_portals_component.super,
&mca_btl_portals_component.super,
/* NOTE: All these default values are set in
component_open() */
@ -45,29 +45,29 @@ mca_bmi_portals_module_t mca_bmi_portals_module = {
0, /* exclusivity - higher than sm, lower than self */
0, /* latency */
0, /* bandwidth */
0, /* bmi flags */
0, /* btl flags */
mca_bmi_portals_add_procs,
mca_bmi_portals_del_procs,
mca_bmi_portals_register,
mca_bmi_portals_finalize,
mca_btl_portals_add_procs,
mca_btl_portals_del_procs,
mca_btl_portals_register,
mca_btl_portals_finalize,
mca_bmi_portals_alloc,
mca_bmi_portals_free,
mca_bmi_portals_prepare_src,
mca_bmi_portals_prepare_dst,
mca_bmi_portals_send,
mca_bmi_portals_put,
mca_bmi_portals_get,
mca_btl_portals_alloc,
mca_btl_portals_free,
mca_btl_portals_prepare_src,
mca_btl_portals_prepare_dst,
mca_btl_portals_send,
mca_btl_portals_put,
mca_btl_portals_get,
},
};
int
mca_bmi_portals_add_procs(struct mca_bmi_base_module_t* bmi,
mca_btl_portals_add_procs(struct mca_btl_base_module_t* btl,
size_t nprocs, struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t** peers,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable)
{
int ret;
@ -76,14 +76,14 @@ mca_bmi_portals_add_procs(struct mca_bmi_base_module_t* bmi,
ptl_process_id_t *portals_procs;
size_t i;
unsigned long distance;
struct mca_bmi_portals_module_t *mybmi =
(struct mca_bmi_portals_module_t*) bmi;
struct mca_btl_portals_module_t *mybtl =
(struct mca_btl_portals_module_t*) btl;
/* make sure our environment is fully initialized. At end of this
call, we have a working network handle on our module and
portals_procs will have the portals process identifier for each
proc (ordered, in theory) */
ret = mca_bmi_portals_add_procs_compat(mybmi, nprocs, procs,
ret = mca_btl_portals_add_procs_compat(mybtl, nprocs, procs,
&portals_procs);
if (OMPI_SUCCESS != ret) return ret;
@ -94,17 +94,17 @@ mca_bmi_portals_add_procs(struct mca_bmi_base_module_t* bmi,
if (curr_proc == local_proc) continue;
/* make sure we can reach the process */
ret = PtlNIDist(mybmi->ni_handle,
ret = PtlNIDist(mybtl->ni_handle,
portals_procs[i],
&distance);
if (ret != PTL_OK) {
ompi_output_verbose(10, mca_bmi_portals_component.portals_output,
ompi_output_verbose(10, mca_btl_portals_component.portals_output,
"Could not find distance to process %d", i);
continue;
}
/* set the peer as a pointer to the address */
peers[i] = (struct mca_bmi_base_endpoint_t*) &(portals_procs[i]);
peers[i] = (struct mca_btl_base_endpoint_t*) &(portals_procs[i]);
/* and here we can reach */
ompi_bitmap_set_bit(reachable, i);
@ -115,10 +115,10 @@ mca_bmi_portals_add_procs(struct mca_bmi_base_module_t* bmi,
int
mca_bmi_portals_del_procs(struct mca_bmi_base_module_t *bmi,
mca_btl_portals_del_procs(struct mca_btl_base_module_t *btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t **peers)
struct mca_btl_base_endpoint_t **peers)
{
/* yeah, I have no idea what to do here */
@ -128,21 +128,21 @@ mca_bmi_portals_del_procs(struct mca_bmi_base_module_t *bmi,
int
mca_bmi_portals_finalize(struct mca_bmi_base_module_t *bmi_base)
mca_btl_portals_finalize(struct mca_btl_base_module_t *btl_base)
{
struct mca_bmi_portals_module_t *bmi =
(struct mca_bmi_portals_module_t *) bmi_base;
struct mca_btl_portals_module_t *btl =
(struct mca_btl_portals_module_t *) btl_base;
int ret;
if (PTL_INVALID_HANDLE != bmi->ni_handle) {
ret = PtlNIFini(bmi->ni_handle);
if (PTL_INVALID_HANDLE != btl->ni_handle) {
ret = PtlNIFini(btl->ni_handle);
if (PTL_OK != ret) {
ompi_output_verbose(20, mca_bmi_portals_component.portals_output,
ompi_output_verbose(20, mca_btl_portals_component.portals_output,
"PtlNIFini returned %d", ret);
return OMPI_ERROR;
}
}
ompi_output_verbose(20, mca_bmi_portals_component.portals_output,
ompi_output_verbose(20, mca_btl_portals_component.portals_output,
"successfully finalized module");
return OMPI_SUCCESS;

Просмотреть файл

@ -22,7 +22,7 @@
#include <portals3.h>
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "mca/btl/btl.h"
#include "class/ompi_bitmap.h"
#include "class/ompi_free_list.h"
#include "class/ompi_proc_table.h"
@ -31,9 +31,9 @@
/*
* Portals BMI component.
*/
struct mca_bmi_portals_component_t {
struct mca_btl_portals_component_t {
/* base BMI component */
mca_bmi_base_component_1_0_0_t super;
mca_btl_base_component_1_0_0_t super;
/* output channel for debugging. Value settings when using
* output_verbose:
@ -58,7 +58,7 @@ struct mca_bmi_portals_component_t {
locked */
uint32_t portals_num_modules;
/* List of currently available modules */
struct mca_bmi_portals_module_t *portals_modules;
struct mca_btl_portals_module_t *portals_modules;
/* initial size of free lists */
int portals_free_list_init_num;
@ -70,7 +70,7 @@ struct mca_bmi_portals_component_t {
/* lock for accessing component */
ompi_mutex_t portals_lock;
};
typedef struct mca_bmi_portals_component_t mca_bmi_portals_component_t;
typedef struct mca_btl_portals_component_t mca_btl_portals_component_t;
#define MCA_BMI_PORTALS_EQ_RECV 0
@ -78,12 +78,12 @@ typedef struct mca_bmi_portals_component_t mca_bmi_portals_component_t;
#define MCA_BMI_PORTALS_EQ_RDMA 2
#define MCA_BMI_PORTALS_EQ_SIZE 3
struct mca_bmi_portals_module_t {
struct mca_btl_portals_module_t {
/* base BMI module interface */
mca_bmi_base_module_t super;
mca_btl_base_module_t super;
/* registered callbacks */
mca_bmi_base_recv_reg_t portals_reg[MCA_BMI_TAG_MAX];
mca_btl_base_recv_reg_t portals_reg[MCA_BMI_TAG_MAX];
ompi_free_list_t portals_frag_eager;
ompi_free_list_t portals_frag_max;
@ -107,99 +107,99 @@ struct mca_bmi_portals_module_t {
/* number of dropped messages */
ptl_sr_value_t portals_sr_dropped;
};
typedef struct mca_bmi_portals_module_t mca_bmi_portals_module_t;
typedef struct mca_btl_portals_module_t mca_btl_portals_module_t;
/*
* Component functions (bmi_portals_component.c)
* Component functions (btl_portals_component.c)
*/
int mca_bmi_portals_component_open(void);
int mca_bmi_portals_component_close(void);
int mca_btl_portals_component_open(void);
int mca_btl_portals_component_close(void);
mca_bmi_base_module_t** mca_bmi_portals_component_init(int *num_bmis,
mca_btl_base_module_t** mca_btl_portals_component_init(int *num_btls,
bool has_progress_threads,
bool has_mpi_threads);
int mca_bmi_portals_component_progress(void);
int mca_btl_portals_component_progress(void);
/*
* Compatibility functions (bmi_portals_compat_{}.c)
* Compatibility functions (btl_portals_compat_{}.c)
*
* Not part of the BMI interface. Need to be implemented for every
* version of Portals
*/
int mca_bmi_portals_init(mca_bmi_portals_component_t *comp);
int mca_btl_portals_init(mca_btl_portals_component_t *comp);
int mca_bmi_portals_add_procs_compat(mca_bmi_portals_module_t* bmi,
int mca_btl_portals_add_procs_compat(mca_btl_portals_module_t* btl,
size_t nprocs, struct ompi_proc_t **procs,
ptl_process_id_t **portals_procs);
/*
* Module configuration functions (bmi_portals.c)
* Module configuration functions (btl_portals.c)
*/
int mca_bmi_portals_finalize(struct mca_bmi_base_module_t* bmi);
int mca_btl_portals_finalize(struct mca_btl_base_module_t* btl);
int mca_bmi_portals_add_procs(struct mca_bmi_base_module_t* bmi,
int mca_btl_portals_add_procs(struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t** peers,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable);
int mca_bmi_portals_del_procs(struct mca_bmi_base_module_t* bmi,
int mca_btl_portals_del_procs(struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t** peers);
struct mca_btl_base_endpoint_t** peers);
/*
* stubbed functions
*/
int mca_bmi_portals_register(struct mca_bmi_base_module_t* bmi,
mca_bmi_base_tag_t tag,
mca_bmi_base_module_recv_cb_fn_t cbfunc,
int mca_btl_portals_register(struct mca_btl_base_module_t* btl,
mca_btl_base_tag_t tag,
mca_btl_base_module_recv_cb_fn_t cbfunc,
void* cbdata);
mca_bmi_base_descriptor_t*
mca_bmi_portals_alloc(struct mca_bmi_base_module_t* bmi,
mca_btl_base_descriptor_t*
mca_btl_portals_alloc(struct mca_btl_base_module_t* btl,
size_t size);
int mca_bmi_portals_free(struct mca_bmi_base_module_t* bmi,
mca_bmi_base_descriptor_t* des);
int mca_btl_portals_free(struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* des);
mca_bmi_base_descriptor_t*
mca_bmi_portals_prepare_src(struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* peer,
mca_btl_base_descriptor_t*
mca_btl_portals_prepare_src(struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* peer,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size);
mca_bmi_base_descriptor_t*
mca_bmi_portals_prepare_dst(struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* peer,
mca_btl_base_descriptor_t*
mca_btl_portals_prepare_dst(struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* peer,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size);
int mca_bmi_portals_send(struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* bmi_peer,
struct mca_bmi_base_descriptor_t* descriptor,
mca_bmi_base_tag_t tag);
int mca_btl_portals_send(struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* btl_peer,
struct mca_btl_base_descriptor_t* descriptor,
mca_btl_base_tag_t tag);
int mca_bmi_portals_put(struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* bmi_peer,
struct mca_bmi_base_descriptor_t* decriptor);
int mca_btl_portals_put(struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* btl_peer,
struct mca_btl_base_descriptor_t* decriptor);
int mca_bmi_portals_get(struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* bmi_peer,
struct mca_bmi_base_descriptor_t* decriptor);
int mca_btl_portals_get(struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* btl_peer,
struct mca_btl_base_descriptor_t* decriptor);
/*
* global structures
*/
extern mca_bmi_portals_component_t mca_bmi_portals_component;
extern mca_btl_portals_component_t mca_btl_portals_component;
/* don't use, except as base for creating module instances */
extern mca_bmi_portals_module_t mca_bmi_portals_module;
extern mca_btl_portals_module_t mca_btl_portals_module;
#endif

Просмотреть файл

@ -20,22 +20,22 @@
#include "include/constants.h"
#include "util/output.h"
#include "bmi_portals.h"
#include "bmi_portals_compat.h"
#include "btl_portals.h"
#include "btl_portals_compat.h"
int
mca_bmi_portals_init(mca_bmi_portals_component_t *comp)
mca_btl_portals_init(mca_btl_portals_component_t *comp)
{
int ret, max_interfaces;
struct mca_bmi_portals_module_t *bmi;
struct mca_btl_portals_module_t *btl;
/*
* Initialize Portals interface
*/
ret = PtlInit(&max_interfaces);
if (PTL_OK != ret) {
ompi_output_verbose(10, mca_bmi_portals_component.portals_output,
ompi_output_verbose(10, mca_btl_portals_component.portals_output,
"PtlInit failed, returning %d\n", ret);
return OMPI_ERR_FATAL;
}
@ -45,21 +45,21 @@ mca_bmi_portals_init(mca_bmi_portals_component_t *comp)
*/
comp->portals_num_modules = 1;
comp->portals_modules = calloc(comp->portals_num_modules,
sizeof(mca_bmi_portals_module_t *));
sizeof(mca_btl_portals_module_t *));
if (NULL == comp->portals_modules) {
ompi_output_verbose(10, mca_bmi_portals_component.portals_output,
"malloc failed in mca_bmi_portals_init");
ompi_output_verbose(10, mca_btl_portals_component.portals_output,
"malloc failed in mca_btl_portals_init");
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
}
comp->portals_modules[0] = malloc(sizeof(mca_bmi_portals_module_t));
comp->portals_modules[0] = malloc(sizeof(mca_btl_portals_module_t));
if (NULL == comp->portals_modules) {
ompi_output_verbose(10, mca_bmi_portals_component.portals_output,
"malloc failed in mca_bmi_portals_init");
ompi_output_verbose(10, mca_btl_portals_component.portals_output,
"malloc failed in mca_btl_portals_init");
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
}
bmi = comp->portals_modules[0];
btl = comp->portals_modules[0];
*bmi = = mca_bmi_portals_module;
*btl = = mca_btl_portals_module;
/*
* Initialize a network device
@ -67,8 +67,8 @@ mca_bmi_portals_init(mca_bmi_portals_component_t *comp)
ret = PtlNIInit(PTL_IFACE_DEFAULT, /* interface to initialize */
PTL_PID_ANY, /* let library assign our pid */
NULL, /* no desired limits */
&(bmi->limits), /* save our limits somewhere */
&(bmi->ni_handle) /* our interface handle */
&(btl->limits), /* save our limits somewhere */
&(btl->ni_handle) /* our interface handle */
);
if (PTL_OK != ret) {
ompi_output_verbose(10, mca_ptl_portals_component.portals_output,
@ -82,9 +82,9 @@ mca_bmi_portals_init(mca_bmi_portals_component_t *comp)
int
mca_bmi_portals_add_procs_compat(struct mca_bmi_portals_module_t* bmi,
mca_btl_portals_add_procs_compat(struct mca_btl_portals_module_t* btl,
size_t nprocs, struct ompi_proc_t **procs,
bmi_process_id_t **portals_procs)
btl_process_id_t **portals_procs)
{
int nptl_procs = 0;
@ -96,11 +96,11 @@ mca_bmi_portals_add_procs_compat(struct mca_bmi_portals_module_t* bmi,
nptl_procs = cnos_get_nidpid_map(portals_procs);
if (nptl_procs <= 0) {
ompi_output_verbose(10, mca_bmi_portals_component.portals_output,
ompi_output_verbose(10, mca_btl_portals_component.portals_output,
"cnos_get_nidpid_map() returned %d", nptl_procs);
return OMPI_ERR_FATAL;
} else if (nptl_procs != nprocs) {
ompi_output_verbose(10, mca_bmi_portals_component.portals_output,
ompi_output_verbose(10, mca_btl_portals_component.portals_output,
"nptl_procs != nprocs (%d, %d)", nptl_procs,
nprocs);
return OMPI_ERR_FATAL;

Просмотреть файл

@ -27,8 +27,8 @@
#include "include/constants.h"
#include "util/output.h"
#include "bmi_portals.h"
#include "bmi_portals_compat.h"
#include "btl_portals.h"
#include "btl_portals_compat.h"
#include <p3api/debug.h>
@ -41,7 +41,7 @@ FILE* utcp_api_out;
FILE* utcp_lib_out;
int
mca_bmi_portals_init(mca_bmi_portals_component_t *comp)
mca_btl_portals_init(mca_btl_portals_component_t *comp)
{
ptl_process_id_t info;
int ret, i;
@ -60,16 +60,16 @@ mca_bmi_portals_init(mca_bmi_portals_component_t *comp)
utcp_api_out = stderr;
#endif
info.nid = htonl(utcp_my_nid(mca_bmi_portals_component.portals_ifname));
info.nid = htonl(utcp_my_nid(mca_btl_portals_component.portals_ifname));
info.pid = htonl((ptl_pid_t) getpid());
ompi_output_verbose(100, mca_bmi_portals_component.portals_output,
ompi_output_verbose(100, mca_btl_portals_component.portals_output,
"contact info: %u, %u", ntohl(info.nid),
ntohl(info.pid));
ret = mca_base_modex_send(&mca_bmi_portals_component.super.bmi_version,
ret = mca_base_modex_send(&mca_btl_portals_component.super.btl_version,
&info, sizeof(ptl_process_id_t));
if (OMPI_SUCCESS != ret) {
ompi_output_verbose(10, mca_bmi_portals_component.portals_output,
ompi_output_verbose(10, mca_btl_portals_component.portals_output,
"mca_base_modex_send failed: %d", ret);
return ret;
}
@ -77,10 +77,10 @@ mca_bmi_portals_init(mca_bmi_portals_component_t *comp)
/* with the utcp interface, only ever one "NIC" */
comp->portals_num_modules = 1;
comp->portals_modules = calloc(comp->portals_num_modules,
sizeof(mca_bmi_portals_module_t));
sizeof(mca_btl_portals_module_t));
if (NULL == comp->portals_modules) {
ompi_output_verbose(10, mca_bmi_portals_component.portals_output,
"malloc failed in mca_bmi_portals_init");
ompi_output_verbose(10, mca_btl_portals_component.portals_output,
"malloc failed in mca_btl_portals_init");
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
}
@ -90,8 +90,8 @@ mca_bmi_portals_init(mca_bmi_portals_component_t *comp)
Portals-specific entries */
for (i = 0 ; i < comp->portals_num_modules ; ++i) {
memcpy(&(comp->portals_modules[i]),
mca_bmi_portals_module,
sizeof(mca_bmi_portals_module_t));
mca_btl_portals_module,
sizeof(mca_btl_portals_module_t));
/* the defaults are good enough for the rest */
}
@ -100,7 +100,7 @@ mca_bmi_portals_init(mca_bmi_portals_component_t *comp)
int
mca_bmi_portals_add_procs_compat(struct mca_bmi_portals_module_t* bmi,
mca_btl_portals_add_procs_compat(struct mca_btl_portals_module_t* btl,
size_t nprocs, struct ompi_proc_t **procs,
ptl_process_id_t **portals_procs)
{
@ -130,7 +130,7 @@ mca_bmi_portals_add_procs_compat(struct mca_bmi_portals_module_t* bmi,
/* get space for the portals procs list */
*portals_procs = calloc(nprocs, sizeof(ptl_process_id_t));
if (NULL == *portals_procs) {
ompi_output_verbose(10, mca_bmi_portals_component.portals_output,
ompi_output_verbose(10, mca_btl_portals_component.portals_output,
"calloc(nprocs, sizeof(ptl_process_id_t)) failed");
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
}
@ -138,14 +138,14 @@ mca_bmi_portals_add_procs_compat(struct mca_bmi_portals_module_t* bmi,
for (i = 0 ; i < nprocs ; ++i) {
if (proc_self == procs[i]) my_rid = i;
ret = mca_base_modex_recv(&mca_bmi_portals_component.super.bmi_version,
ret = mca_base_modex_recv(&mca_btl_portals_component.super.btl_version,
procs[i], (void**) &info, &size);
if (OMPI_SUCCESS != ret) {
ompi_output_verbose(10, mca_bmi_portals_component.portals_output,
ompi_output_verbose(10, mca_btl_portals_component.portals_output,
"mca_base_modex_recv failed: %d", ret);
return ret;
} else if (sizeof(ptl_process_id_t) != size) {
ompi_output_verbose(10, mca_bmi_portals_component.portals_output,
ompi_output_verbose(10, mca_btl_portals_component.portals_output,
"mca_base_modex_recv returned size %d, expected %d",
size, sizeof(ptl_process_id_t));
return OMPI_ERROR;
@ -168,15 +168,15 @@ mca_bmi_portals_add_procs_compat(struct mca_bmi_portals_module_t* bmi,
free(info);
}
ompi_output_verbose(100, mca_bmi_portals_component.portals_output,
ompi_output_verbose(100, mca_btl_portals_component.portals_output,
"my rid: %u", my_rid);
ompi_output_verbose(100, mca_bmi_portals_component.portals_output,
ompi_output_verbose(100, mca_btl_portals_component.portals_output,
"nid map: %s", nidmap);
ompi_output_verbose(100, mca_bmi_portals_component.portals_output,
ompi_output_verbose(100, mca_btl_portals_component.portals_output,
"pid map: %s", pidmap);
ompi_output_verbose(100, mca_bmi_portals_component.portals_output,
ompi_output_verbose(100, mca_btl_portals_component.portals_output,
"iface: %s",
mca_bmi_portals_component.portals_ifname);
mca_btl_portals_component.portals_ifname);
asprintf(&tmp, "PTL_MY_RID=%u", my_rid);
putenv(tmp);
@ -184,7 +184,7 @@ mca_bmi_portals_add_procs_compat(struct mca_bmi_portals_module_t* bmi,
putenv(tmp);
asprintf(&tmp, "PTL_PIDMAP=%s", pidmap);
putenv(tmp);
asprintf(&tmp, "PTL_IFACE=%s", mca_bmi_portals_component.portals_ifname);
asprintf(&tmp, "PTL_IFACE=%s", mca_btl_portals_component.portals_ifname);
putenv(tmp);
free(pidmap);
@ -197,7 +197,7 @@ mca_bmi_portals_add_procs_compat(struct mca_bmi_portals_module_t* bmi,
*/
ret = PtlInit(&max_interfaces);
if (PTL_OK != ret) {
ompi_output_verbose(10, mca_bmi_portals_component.portals_output,
ompi_output_verbose(10, mca_btl_portals_component.portals_output,
"PtlInit failed, returning %d\n", ret);
return OMPI_ERR_FATAL;
}
@ -205,17 +205,17 @@ mca_bmi_portals_add_procs_compat(struct mca_bmi_portals_module_t* bmi,
ret = PtlNIInit(PTL_IFACE_DEFAULT, /* interface to initialize */
PTL_PID_ANY, /* let library assign our pid */
NULL, /* no desired limits */
&(bmi->portals_limits), /* save our limits somewhere */
&(bmi->portals_ni_h) /* our interface handle */
&(btl->portals_limits), /* save our limits somewhere */
&(btl->portals_ni_h) /* our interface handle */
);
if (PTL_OK != ret) {
ompi_output_verbose(10, mca_bmi_portals_component.portals_output,
ompi_output_verbose(10, mca_btl_portals_component.portals_output,
"PtlNIInit failed, returning %d\n", ret);
return OMPI_ERR_FATAL;
}
#if 0
PtlNIDebug(bmi->portals_ni_h, PTL_DBG_ALL | PTL_DBG_NI_ALL);
PtlNIDebug(btl->portals_ni_h, PTL_DBG_ALL | PTL_DBG_NI_ALL);
#endif
return OMPI_SUCCESS;

Просмотреть файл

@ -25,11 +25,11 @@
#include "util/output.h"
#include "threads/thread.h"
#include "bmi_portals.h"
#include "bmi_portals_compat.h"
#include "btl_portals.h"
#include "btl_portals_compat.h"
mca_bmi_portals_component_t mca_bmi_portals_component = {
mca_btl_portals_component_t mca_btl_portals_component = {
{
/* First, the mca_base_module_t struct containing meta
information about the module itself */
@ -43,8 +43,8 @@ mca_bmi_portals_component_t mca_bmi_portals_component = {
1, /* MCA module major version */
0, /* MCA module minor version */
0, /* MCA module release version */
mca_bmi_portals_component_open, /* module open */
mca_bmi_portals_component_close /* module close */
mca_btl_portals_component_open, /* module open */
mca_btl_portals_component_close /* module close */
},
/* Next the MCA v1.0.0 module meta data */
@ -55,8 +55,8 @@ mca_bmi_portals_component_t mca_bmi_portals_component = {
false
},
mca_bmi_portals_component_init,
mca_bmi_portals_component_progress,
mca_btl_portals_component_init,
mca_btl_portals_component_progress,
}
};
@ -72,7 +72,7 @@ static ompi_output_stream_t portals_output_stream = {
false, /* want stderr */
false, /* want file */
false, /* file append */
"bmi-portals" /* file suffix */
"btl-portals" /* file suffix */
};
@ -81,7 +81,7 @@ param_register_string(const char* param_name,
const char* default_value)
{
char *param_value;
int id = mca_base_param_register_string("bmi", "portals",
int id = mca_base_param_register_string("btl", "portals",
param_name, NULL,
default_value);
mca_base_param_lookup_string(id, &param_value);
@ -93,7 +93,7 @@ static inline int
param_register_int(const char* param_name,
int default_value)
{
int id = mca_base_param_register_int("bmi", "portals", param_name,
int id = mca_base_param_register_int("btl", "portals", param_name,
NULL, default_value);
int param_value = default_value;
mca_base_param_lookup_int(id, &param_value);
@ -103,16 +103,16 @@ param_register_int(const char* param_name,
int
mca_bmi_portals_component_open(void)
mca_btl_portals_component_open(void)
{
int i;
/* initialize component state */
mca_bmi_portals_component.portals_num_modules = 0;
mca_bmi_portals_component.portals_modules = NULL;
mca_btl_portals_component.portals_num_modules = 0;
mca_btl_portals_component.portals_modules = NULL;
/* initalize component objects */
OBJ_CONSTRUCT(&mca_bmi_portals_component.portals_lock,
OBJ_CONSTRUCT(&mca_btl_portals_component.portals_lock,
ompi_mutex_t);
/* get configured state for component */
@ -136,47 +136,47 @@ mca_bmi_portals_component_open(void)
/* start up debugging output */
asprintf(&(portals_output_stream.lds_prefix),
"bmi: portals (%5d): ", getpid());
"btl: portals (%5d): ", getpid());
mca_bmi_portals_component.portals_output =
mca_btl_portals_component.portals_output =
ompi_output_open(&portals_output_stream);
/* fill default module state */
mca_ptl_portals_module.super.bmi_flags = MCA_BMI_FLAGS_RDMA;
mca_ptl_portals_module.super.btl_flags = MCA_BMI_FLAGS_RDMA;
for (i = 0 ; i < MCA_BMI_TAG_MAX ; ++i) {
mca_bmi_portals_module.portals_reg = NULL;
mca_btl_portals_module.portals_reg = NULL;
}
for (i = 0 ; i < MCA_BMI_PORTALS_EQ_SIZE ; ++i) {
mca_bmi_portals_module.portals_eq_sizes[i] = 0;
mca_bmi_portals_module.portals_eq_handles[i] = PTL_EQ_NONE;
mca_btl_portals_module.portals_eq_sizes[i] = 0;
mca_btl_portals_module.portals_eq_handles[i] = PTL_EQ_NONE;
}
mca_bmi_portals_module.portals_ni_h = PTL_INVALID_HANDLE;
mca_bmi_portals_module.portals_sr_dropped = 0;
mca_btl_portals_module.portals_ni_h = PTL_INVALID_HANDLE;
mca_btl_portals_module.portals_sr_dropped = 0;
/* get configured state for default module */
mca_ptl_portals_module.super.bmi_eager_limit =
mca_ptl_portals_module.super.btl_eager_limit =
param_register_int("eager_limit",
PTL_PORTALS_DEFAULT_EAGER_LIMIT);
mca_ptl_portals_module.super.bmi_min_send_size =
mca_ptl_portals_module.super.btl_min_send_size =
param_register_int("min_send_size",
PTL_PORTALS_DEFAULT_MIN_SEND_SIZE);
mca_ptl_portals_module.super.bmi_max_send_size =
mca_ptl_portals_module.super.btl_max_send_size =
param_register_int("max_send_size",
PTL_PORTALS_DEFAULT_MAX_SEND_SIZE);
mca_ptl_portals_module.super.bmi_min_rdma_size =
mca_ptl_portals_module.super.btl_min_rdma_size =
param_register_int("min_rdma_size",
PTL_PORTALS_DEFAULT_MIN_RDMA_SIZE);
mca_ptl_portals_module.super.bmi_max_rdma_size =
mca_ptl_portals_module.super.btl_max_rdma_size =
param_register_int("max_rdma_size",
PTL_PORTALS_DEFAULT_MAX_RDMA_SIZE);
mca_ptl_portals_module.super.bmi_exclusivity =
mca_ptl_portals_module.super.btl_exclusivity =
param_register_int("exclusivity", 60);
mca_ptl_portals_module.super.bmi_latency =
mca_ptl_portals_module.super.btl_latency =
param_register_int("latency", 0);
mca_ptl_portals_module.super.bmi_bandwidth =
mca_ptl_portals_module.super.btl_bandwidth =
param_register_int("bandwidth", 1000);
return OMPI_SUCCESS;
@ -184,109 +184,109 @@ mca_bmi_portals_component_open(void)
int
mca_bmi_portals_component_close(void)
mca_btl_portals_component_close(void)
{
/* release resources */
OBJ_DESTRUCT(&mca_bmi_portals_component.portals_lock);
OBJ_DESTRUCT(&mca_btl_portals_component.portals_lock);
if (NULL != mca_bmi_portals_component.portals_modules) {
free(mca_bmi_portals_component.portals_modules);
if (NULL != mca_btl_portals_component.portals_modules) {
free(mca_btl_portals_component.portals_modules);
}
if (NULL != mca_bmi_portals_component.portals_ifname) {
free(mca_bmi_portals_component.portals_ifname);
if (NULL != mca_btl_portals_component.portals_ifname) {
free(mca_btl_portals_component.portals_ifname);
}
if (NULL != portals_output_stream.lds_prefix) {
free(portals_output_stream.lds_prefix);
}
ompi_output_close(mca_bmi_portals_component.portals_output);
mca_bmi_portals_component.portals_output = -1;
ompi_output_close(mca_btl_portals_component.portals_output);
mca_btl_portals_component.portals_output = -1;
return OMPI_SUCCESS;
}
mca_bmi_base_module_t**
mca_bmi_portals_component_init(int *num_bmis,
mca_btl_base_module_t**
mca_btl_portals_component_init(int *num_btls,
bool enable_progress_threads,
bool enable_mpi_threads)
{
mca_bmi_base_module_t** bmis;
*num_bmis = 0;
mca_btl_base_module_t** btls;
*num_btls = 0;
int i;
uint32_t length;
if (enable_progress_threads) {
ompi_output_verbose(20, mca_bmi_portals_component.portals_output,
ompi_output_verbose(20, mca_btl_portals_component.portals_output,
"disabled because progress threads enabled");
return NULL;
}
/* initialize portals bmi. note that this is in the compat code because
/* initialize portals btl. note that this is in the compat code because
it's fairly non-portable between implementations */
if (OMPI_SUCCESS != mca_bmi_portals_init(&mca_bmi_portals_component)) {
ompi_output_verbose(20, mca_bmi_portals_component.portals_output,
if (OMPI_SUCCESS != mca_btl_portals_init(&mca_btl_portals_component)) {
ompi_output_verbose(20, mca_btl_portals_component.portals_output,
"disabled because compatibility init failed");
return NULL;
}
bmis = malloc(mca_bmi_portals_component.portals_num_modules *
sizeof(mca_bmi_portals_module_t*));
for (i = 0 ; i < mca_bmi_portals_component.portals_num_modules ; ++i) {
bmis[i] = (mca_bmi_base_module_t*)
(mca_bmi_portals_component.portals_modules + i);
btls = malloc(mca_btl_portals_component.portals_num_modules *
sizeof(mca_btl_portals_module_t*));
for (i = 0 ; i < mca_btl_portals_component.portals_num_modules ; ++i) {
btls[i] = (mca_btl_base_module_t*)
(mca_btl_portals_component.portals_modules + i);
OBJ_CONSTRUCT(&bmis[i]->portals_frag_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&bmis[i]->portals_frag_max, ompi_free_list_t);
OBJ_CONSTRUCT(&bmis[i]->portals_frag_user, ompi_free_list_t);
OBJ_CONSTRUCT(&btls[i]->portals_frag_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&btls[i]->portals_frag_max, ompi_free_list_t);
OBJ_CONSTRUCT(&btls[i]->portals_frag_user, ompi_free_list_t);
/* eager frags */
ompi_free_list_init(&(bmis[i].send_free_eager),
sizeof(mca_bmi_portals_bmis[i].super.bmi_eager_limit,
OBJ_CLASS(mca_bmi_portals_send_frag_eager_t),
mca_bmi_portals_component.portals_free_list_init_num,
mca_bmi_portals_component.portals_free_list_max_num,
mca_bmi_portals_component.portals_free_list_inc_num);
ompi_free_list_init(&(btls[i].send_free_eager),
sizeof(mca_btl_portals_btls[i].super.btl_eager_limit,
OBJ_CLASS(mca_btl_portals_send_frag_eager_t),
mca_btl_portals_component.portals_free_list_init_num,
mca_btl_portals_component.portals_free_list_max_num,
mca_btl_portals_component.portals_free_list_inc_num);
/* send frags */
ompi_free_list_init(&(bmis[i].send_free_eager),
bmis[i].super.bmi_max_sender_size,
OBJ_CLASS(mca_bmi_portals_send_frag_eager_t),
mca_bmi_portals_component.portals_free_list_init_num,
mca_bmi_portals_component.portals_free_list_max_num,
mca_bmi_portals_component.portals_free_list_inc_num);
ompi_free_list_init(&(btls[i].send_free_eager),
btls[i].super.btl_max_sender_size,
OBJ_CLASS(mca_btl_portals_send_frag_eager_t),
mca_btl_portals_component.portals_free_list_init_num,
mca_btl_portals_component.portals_free_list_max_num,
mca_btl_portals_component.portals_free_list_inc_num);
/* user frags */
ompi_free_list_init(&(bmis[i].send_free_eager),
bmis[i].super.bmi_max_sender_size,
OBJ_CLASS(mca_bmi_portals_send_frag_eager_t),
mca_bmi_portals_component.portals_free_list_init_num,
mca_bmi_portals_component.portals_free_list_max_num,
mca_bmi_portals_component.portals_free_list_inc_num);
ompi_free_list_init(&(btls[i].send_free_eager),
btls[i].super.btl_max_sender_size,
OBJ_CLASS(mca_btl_portals_send_frag_eager_t),
mca_btl_portals_component.portals_free_list_init_num,
mca_btl_portals_component.portals_free_list_max_num,
mca_btl_portals_component.portals_free_list_inc_num);
}
*num_bmis = mca_bmi_portals_component.portals_num_modules;
*num_btls = mca_btl_portals_component.portals_num_modules;
ompi_output_verbose(20, mca_bmi_portals_component.portals_output,
ompi_output_verbose(20, mca_btl_portals_component.portals_output,
"initialized %d modules",
*num_bmis);
*num_btls);
return bmis;
return btls;
}
int
mca_bmi_portals_component_progress(void)
mca_btl_portals_component_progress(void)
{
int num_progressed = 0;
size_t i;
for (i = 0 ; i < mca_bmi_portals_component.portals_num_modules ; ++i) {
struct mca_bmi_portals_module_t *module =
mca_bmi_portals_component.portals_modules[i];
for (i = 0 ; i < mca_btl_portals_component.portals_num_modules ; ++i) {
struct mca_btl_portals_module_t *module =
mca_btl_portals_component.portals_modules[i];
ptl_event_t ev;
ptl_sr_value_t numdropped;
int which;
@ -301,7 +301,7 @@ mca_bmi_portals_component_progress(void)
PTL_SR_DROP_COUNT,
&numdropped);
if (numdropped != module->dropped) {
ompi_output_verbose(30, mca_bmi_portals_component.portals_output,
ompi_output_verbose(30, mca_btl_portals_component.portals_output,
"*** Dropped message count changed. %lld, %lld",
module->dropped, numdropped);
module->dropped = numdropped;
@ -318,11 +318,11 @@ mca_bmi_portals_component_progress(void)
continue;
} else if (!(PTL_OK == ret || PTL_EQ_DROPPED == ret)) {
/* BWB - how can we report errors? */
ompi_output(mca_bmi_portals_component.portals_output,
ompi_output(mca_btl_portals_component.portals_output,
"Error calling PtlEQGet: %d", ret);
continue;
} else if (PTL_EQ_DROPPED == ret) {
ompi_output_verbose(10, mca_bmi_portals_component.portals_output,
ompi_output_verbose(10, mca_btl_portals_component.portals_output,
"*** Event queue entries were dropped");
}
@ -331,7 +331,7 @@ mca_bmi_portals_component_progress(void)
so we can make sure we properly re-initialize the ones that
need to be re-initialized */
if (PTL_EVENT_UNLINK == ev.type) {
OMPI_OUTPUT_VERBOSE((100, mca_bmi_portals_component.portals_output,
OMPI_OUTPUT_VERBOSE((100, mca_btl_portals_component.portals_output,
"unlink event occurred"));
continue;
}

Просмотреть файл

@ -18,7 +18,7 @@
#include "ompi_config.h"
#include "portals_config.h"
#include "bmi_portals.h"
#include "btl_portals.h"
/* BWB - README - BWB - README - BWB - README - BWB - README - BWB
*
@ -31,86 +31,86 @@
int
mca_bmi_portals_register(struct mca_bmi_base_module_t* bmi,
mca_bmi_base_tag_t tag,
mca_bmi_base_module_recv_cb_fn_t cbfunc,
mca_btl_portals_register(struct mca_btl_base_module_t* btl,
mca_btl_base_tag_t tag,
mca_btl_base_module_recv_cb_fn_t cbfunc,
void* cbdata)
{
printf("bmi register\n");
printf("btl register\n");
return OMPI_SUCCESS;
}
mca_bmi_base_descriptor_t*
mca_bmi_portals_alloc(struct mca_bmi_base_module_t* bmi,
mca_btl_base_descriptor_t*
mca_btl_portals_alloc(struct mca_btl_base_module_t* btl,
size_t size)
{
printf("bmi alloc: %d\n", size);
printf("btl alloc: %d\n", size);
return NULL;
}
int
mca_bmi_portals_free(struct mca_bmi_base_module_t* bmi,
mca_bmi_base_descriptor_t* des)
mca_btl_portals_free(struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* des)
{
printf("bmi free\n");
printf("btl free\n");
return OMPI_ERR_NOT_IMPLEMENTED;
}
mca_bmi_base_descriptor_t*
mca_bmi_portals_prepare_src(struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* peer,
mca_btl_base_descriptor_t*
mca_btl_portals_prepare_src(struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* peer,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size)
{
printf("bmi prepare src\n");
printf("btl prepare src\n");
return NULL;
}
mca_bmi_base_descriptor_t*
mca_bmi_portals_prepare_dst(struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* peer,
mca_btl_base_descriptor_t*
mca_btl_portals_prepare_dst(struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* peer,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size)
{
printf("bmi prepare dst\n");
printf("btl prepare dst\n");
return NULL;
}
int
mca_bmi_portals_send(struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* bmi_peer,
struct mca_bmi_base_descriptor_t* descriptor,
mca_bmi_base_tag_t tag)
mca_btl_portals_send(struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* btl_peer,
struct mca_btl_base_descriptor_t* descriptor,
mca_btl_base_tag_t tag)
{
printf("bmi send\n");
printf("btl send\n");
return OMPI_ERR_NOT_IMPLEMENTED;
}
int
mca_bmi_portals_put(struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* bmi_peer,
struct mca_bmi_base_descriptor_t* decriptor)
mca_btl_portals_put(struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* btl_peer,
struct mca_btl_base_descriptor_t* decriptor)
{
printf("bmi put\n");
printf("btl put\n");
return OMPI_ERR_NOT_IMPLEMENTED;
}
int
mca_bmi_portals_get(struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* bmi_peer,
struct mca_bmi_base_descriptor_t* decriptor)
mca_btl_portals_get(struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* btl_peer,
struct mca_btl_base_descriptor_t* decriptor)
{
printf("bmi get\n");
printf("btl get\n");
return OMPI_ERR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -18,32 +18,32 @@
include $(top_ompi_srcdir)/config/Makefile.options
libmca_bmi_self_la_sources = \
bmi_self.c \
bmi_self.h \
bmi_self_component.c \
bmi_self_frag.c \
bmi_self_frag.h
libmca_btl_self_la_sources = \
btl_self.c \
btl_self.h \
btl_self_component.c \
btl_self_frag.c \
btl_self_frag.h
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if OMPI_BUILD_bmi_self_DSO
if OMPI_BUILD_btl_self_DSO
component_noinst =
component_install = mca_bmi_self.la
component_install = mca_btl_self.la
else
component_noinst = libmca_bmi_self.la
component_noinst = libmca_btl_self.la
component_install =
endif
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component_install)
mca_bmi_self_la_SOURCES = $(libmca_bmi_self_la_sources)
mca_bmi_self_la_LDFLAGS = -module -avoid-version
mca_bmi_self_la_LIBADD =
mca_btl_self_la_SOURCES = $(libmca_btl_self_la_sources)
mca_btl_self_la_LDFLAGS = -module -avoid-version
mca_btl_self_la_LIBADD =
noinst_LTLIBRARIES = $(component_noinst)
libmca_bmi_self_la_SOURCES = $(libmca_bmi_self_la_sources)
libmca_bmi_self_la_LDFLAGS = -module -avoid-version
libmca_bmi_self_la_LIBADD =
libmca_btl_self_la_SOURCES = $(libmca_btl_self_la_sources)
libmca_btl_self_la_LDFLAGS = -module -avoid-version
libmca_btl_self_la_LIBADD =

Просмотреть файл

@ -1,61 +0,0 @@
#include "bmi_self_frag.h"
static inline void mca_bmi_self_frag_constructor(mca_bmi_self_frag_t* frag)
{
frag->segment.seg_addr.pval = frag+1;
frag->segment.seg_len = frag->size;
frag->base.des_src = &frag->segment;
frag->base.des_src_cnt = 1;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->base.des_flags = 0;
}
static void mca_bmi_self_frag_eager_constructor(mca_bmi_self_frag_t* frag)
{
frag->size = mca_bmi_self.bmi_eager_limit;
mca_bmi_self_frag_constructor(frag);
}
static void mca_bmi_self_frag_send_constructor(mca_bmi_self_frag_t* frag)
{
frag->size = mca_bmi_self.bmi_max_send_size;
mca_bmi_self_frag_constructor(frag);
}
static void mca_bmi_self_frag_rdma_constructor(mca_bmi_self_frag_t* frag)
{
frag->size = 0;
frag->segment.seg_addr.pval = frag+1;
frag->segment.seg_len = frag->size;
frag->base.des_src = NULL;
frag->base.des_src_cnt = 0;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->base.des_flags = 0;
}
static void mca_bmi_self_frag_destructor(mca_bmi_self_frag_t* frag)
{
}
OBJ_CLASS_INSTANCE(
mca_bmi_self_frag_eager_t,
mca_bmi_base_descriptor_t,
mca_bmi_self_frag_eager_constructor,
mca_bmi_self_frag_destructor);
OBJ_CLASS_INSTANCE(
mca_bmi_self_frag_send_t,
mca_bmi_base_descriptor_t,
mca_bmi_self_frag_send_constructor,
mca_bmi_self_frag_destructor);
OBJ_CLASS_INSTANCE(
mca_bmi_self_frag_rdma_t,
mca_bmi_base_descriptor_t,
mca_bmi_self_frag_rdma_constructor,
mca_bmi_self_frag_destructor);

Просмотреть файл

@ -34,42 +34,42 @@
#include "class/ompi_fifo.h"
#include "class/ompi_free_list.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "mca/btl/btl.h"
#include "mca/mpool/base/base.h"
#include "bmi_self.h"
#include "bmi_self_frag.h"
#include "btl_self.h"
#include "btl_self_frag.h"
mca_bmi_base_module_t mca_bmi_self = {
&mca_bmi_self_component.super,
0, /* bmi_eager_limit */
0, /* bmi_min_send_size */
0, /* bmi_max_send_size */
0, /* bmi_min_rdma_size */
0, /* bmi_max_rdma_size */
0, /* bmi_exclusivity */
0, /* bmi_latency */
0, /* bmi_bandwidth */
0, /* bmi flags */
mca_bmi_self_add_procs,
mca_bmi_self_del_procs,
mca_bmi_self_register,
mca_bmi_self_finalize,
mca_bmi_self_alloc,
mca_bmi_self_free,
mca_bmi_self_prepare_src,
mca_bmi_self_prepare_dst,
mca_bmi_self_send,
mca_bmi_self_rdma, /* put */
mca_bmi_self_rdma /* get */
mca_btl_base_module_t mca_btl_self = {
&mca_btl_self_component.super,
0, /* btl_eager_limit */
0, /* btl_min_send_size */
0, /* btl_max_send_size */
0, /* btl_min_rdma_size */
0, /* btl_max_rdma_size */
0, /* btl_exclusivity */
0, /* btl_latency */
0, /* btl_bandwidth */
0, /* btl flags */
mca_btl_self_add_procs,
mca_btl_self_del_procs,
mca_btl_self_register,
mca_btl_self_finalize,
mca_btl_self_alloc,
mca_btl_self_free,
mca_btl_self_prepare_src,
mca_btl_self_prepare_dst,
mca_btl_self_send,
mca_btl_self_rdma, /* put */
mca_btl_self_rdma /* get */
};
int mca_bmi_self_add_procs(
struct mca_bmi_base_module_t* bmi,
int mca_btl_self_add_procs(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t **peers,
struct mca_btl_base_endpoint_t **peers,
ompi_bitmap_t* reachability)
{
size_t i;
@ -82,30 +82,30 @@ int mca_bmi_self_add_procs(
}
int mca_bmi_self_del_procs(
struct mca_bmi_base_module_t* bmi,
int mca_btl_self_del_procs(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t **peers)
struct mca_btl_base_endpoint_t **peers)
{
return OMPI_SUCCESS;
}
/**
* MCA->BMI Clean up any resources held by BMI module
* MCA->BTL Clean up any resources held by BTL module
* before the module is unloaded.
*
* @param bmi (IN) BMI module.
* @param btl (IN) BTL module.
*
* Prior to unloading a BMI module, the MCA framework will call
* the BMI finalize method of the module. Any resources held by
* the BMI should be released and if required the memory corresponding
* to the BMI module freed.
* Prior to unloading a BTL module, the MCA framework will call
* the BTL finalize method of the module. Any resources held by
* the BTL should be released and if required the memory corresponding
* to the BTL module freed.
*
*/
int mca_bmi_self_finalize(struct mca_bmi_base_module_t* bmi)
int mca_btl_self_finalize(struct mca_btl_base_module_t* btl)
{
return OMPI_SUCCESS;
}
@ -115,22 +115,22 @@ int mca_bmi_self_finalize(struct mca_bmi_base_module_t* bmi)
* Register a callback function that is called on receipt
* of a fragment.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @return Status indicating if cleanup was successful
*
* When the process list changes, the PML notifies the BMI of the
* When the process list changes, the PML notifies the BTL of the
* change, to provide the opportunity to cleanup or release any
* resources associated with the peer.
*/
int mca_bmi_self_register(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_tag_t tag,
mca_bmi_base_module_recv_cb_fn_t cbfunc,
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,
void* cbdata)
{
mca_bmi_self_component.self_reg[tag].cbfunc = cbfunc;
mca_bmi_self_component.self_reg[tag].cbdata = cbdata;
mca_btl_self_component.self_reg[tag].cbfunc = cbfunc;
mca_btl_self_component.self_reg[tag].cbdata = cbdata;
return OMPI_SUCCESS;
}
@ -138,41 +138,41 @@ int mca_bmi_self_register(
/**
* Allocate a segment.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @param size (IN) Request segment size.
*/
extern mca_bmi_base_descriptor_t* mca_bmi_self_alloc(
struct mca_bmi_base_module_t* bmi,
extern mca_btl_base_descriptor_t* mca_btl_self_alloc(
struct mca_btl_base_module_t* btl,
size_t size)
{
mca_bmi_self_frag_t* frag;
mca_btl_self_frag_t* frag;
int rc;
if(size <= mca_bmi_self.bmi_eager_limit) {
MCA_BMI_SELF_FRAG_ALLOC_EAGER(frag,rc);
if(size <= mca_btl_self.btl_eager_limit) {
MCA_BTL_SELF_FRAG_ALLOC_EAGER(frag,rc);
} else {
MCA_BMI_SELF_FRAG_ALLOC_SEND(frag,rc);
MCA_BTL_SELF_FRAG_ALLOC_SEND(frag,rc);
}
frag->base.des_flags = 0;
return (mca_bmi_base_descriptor_t*)frag;
return (mca_btl_base_descriptor_t*)frag;
}
/**
* Return a segment allocated by this BMI.
* Return a segment allocated by this BTL.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @param segment (IN) Allocated segment.
*/
extern int mca_bmi_self_free(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_descriptor_t* des)
extern int mca_btl_self_free(
struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* des)
{
mca_bmi_self_frag_t* frag = (mca_bmi_self_frag_t*)des;
if(frag->size <= mca_bmi_self.bmi_eager_limit) {
MCA_BMI_SELF_FRAG_RETURN_EAGER(frag);
} else if (frag->size <= mca_bmi_self.bmi_max_send_size) {
MCA_BMI_SELF_FRAG_RETURN_SEND(frag);
mca_btl_self_frag_t* frag = (mca_btl_self_frag_t*)des;
if(frag->size <= mca_btl_self.btl_eager_limit) {
MCA_BTL_SELF_FRAG_RETURN_EAGER(frag);
} else if (frag->size <= mca_btl_self.btl_max_send_size) {
MCA_BTL_SELF_FRAG_RETURN_SEND(frag);
} else {
MCA_BMI_SELF_FRAG_RETURN_RDMA(frag);
MCA_BTL_SELF_FRAG_RETURN_RDMA(frag);
}
return OMPI_SUCCESS;
}
@ -181,17 +181,17 @@ extern int mca_bmi_self_free(
/**
* Prepare data for send/put
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
*/
struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_src(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
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,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size)
{
mca_bmi_self_frag_t* frag;
mca_btl_self_frag_t* frag;
struct iovec iov;
uint32_t iov_count = 1;
size_t max_data = *size;
@ -199,8 +199,8 @@ struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_src(
int rc;
/* non-contigous data */
if(ompi_convertor_need_buffers(convertor) || max_data < mca_bmi_self.bmi_max_send_size ) {
MCA_BMI_SELF_FRAG_ALLOC_SEND(frag, rc);
if(ompi_convertor_need_buffers(convertor) || max_data < mca_btl_self.btl_max_send_size ) {
MCA_BTL_SELF_FRAG_ALLOC_SEND(frag, rc);
if(NULL == frag) {
return NULL;
}
@ -213,7 +213,7 @@ struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_src(
rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data, &free_after);
if(rc < 0) {
MCA_BMI_SELF_FRAG_RETURN_SEND(frag);
MCA_BTL_SELF_FRAG_RETURN_SEND(frag);
return NULL;
}
frag->base.des_flags = 0;
@ -221,7 +221,7 @@ struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_src(
frag->segment.seg_len = reserve + max_data;
*size = max_data;
} else {
MCA_BMI_SELF_FRAG_ALLOC_RDMA(frag, rc);
MCA_BTL_SELF_FRAG_ALLOC_RDMA(frag, rc);
if(NULL == frag) {
return NULL;
}
@ -231,7 +231,7 @@ struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_src(
/* convertor should return offset into users buffer */
rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data, &free_after);
if(rc < 0) {
MCA_BMI_SELF_FRAG_RETURN_RDMA(frag);
MCA_BTL_SELF_FRAG_RETURN_RDMA(frag);
return NULL;
}
frag->segment.seg_addr.pval = iov.iov_base;
@ -249,19 +249,19 @@ struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_src(
/**
* Prepare data for receive.
*/
struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_dst(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
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,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size)
{
mca_bmi_self_frag_t* frag;
mca_btl_self_frag_t* frag;
size_t max_data = *size;
int rc;
MCA_BMI_SELF_FRAG_ALLOC_RDMA(frag, rc);
MCA_BTL_SELF_FRAG_ALLOC_RDMA(frag, rc);
if(NULL == frag) {
return NULL;
}
@ -282,46 +282,46 @@ struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_dst(
/**
* Initiate a send to the peer.
*
* @param bmi (IN) BMI module
* @param peer (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
int mca_bmi_self_send(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_descriptor_t* des,
mca_bmi_base_tag_t tag)
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* des,
mca_btl_base_tag_t tag)
{
/* upcall */
des->des_dst = des->des_src;
des->des_dst_cnt = des->des_src_cnt;
des->des_src = NULL;
des->des_src_cnt = 0;
mca_bmi_self_component.self_reg[tag].cbfunc(bmi,tag,des,OMPI_SUCCESS);
mca_btl_self_component.self_reg[tag].cbfunc(btl,tag,des,OMPI_SUCCESS);
des->des_src = des->des_dst;
des->des_src_cnt = des->des_dst_cnt;
des->des_dst = NULL;
des->des_dst_cnt = 0;
/* send completion */
des->des_cbfunc(bmi,endpoint,des,OMPI_SUCCESS);
des->des_cbfunc(btl,endpoint,des,OMPI_SUCCESS);
return OMPI_SUCCESS;
}
/**
* Initiate a put to the peer.
*
* @param bmi (IN) BMI module
* @param peer (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
extern int mca_bmi_self_rdma(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_descriptor_t* des)
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* des)
{
mca_bmi_base_segment_t* src = des->des_src;
mca_bmi_base_segment_t* dst = des->des_dst;
mca_btl_base_segment_t* src = des->des_src;
mca_btl_base_segment_t* dst = des->des_dst;
size_t src_cnt = des->des_src_cnt;
size_t dst_cnt = des->des_dst_cnt;
unsigned char* src_addr = dst->seg_addr.pval;
@ -383,7 +383,7 @@ extern int mca_bmi_self_rdma(
}
/* rdma completion */
des->des_cbfunc(bmi,endpoint,des,OMPI_SUCCESS);
des->des_cbfunc(btl,endpoint,des,OMPI_SUCCESS);
return OMPI_SUCCESS;
}

Просмотреть файл

@ -16,8 +16,8 @@
/**
* @file
*/
#ifndef MCA_BMI_SELF_H
#define MCA_BMI_SELF_H
#ifndef MCA_BTL_SELF_H
#define MCA_BTL_SELF_H
#include <stdlib.h>
#include <sys/types.h>
@ -28,8 +28,8 @@
#include "class/ompi_fifo.h"
#include "event/event.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "mca/bmi/base/base.h"
#include "mca/btl/btl.h"
#include "mca/btl/base/base.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
@ -37,10 +37,10 @@ extern "C" {
/**
* Shared Memory (SELF) BMI module.
* Shared Memory (SELF) BTL module.
*/
struct mca_bmi_self_component_t {
mca_bmi_base_component_1_0_0_t super; /**< base BMI component */
struct mca_btl_self_component_t {
mca_btl_base_component_1_0_0_t super; /**< base BTL component */
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 */
@ -48,110 +48,110 @@ struct mca_bmi_self_component_t {
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 */
mca_bmi_base_recv_reg_t self_reg[256];
mca_btl_base_recv_reg_t self_reg[256];
};
typedef struct mca_bmi_self_component_t mca_bmi_self_component_t;
extern mca_bmi_self_component_t mca_bmi_self_component;
typedef struct mca_btl_self_component_t mca_btl_self_component_t;
extern mca_btl_self_component_t mca_btl_self_component;
/**
* Register shared memory module parameters with the MCA framework
*/
extern int mca_bmi_self_component_open(void);
extern int mca_btl_self_component_open(void);
/**
* Any final cleanup before being unloaded.
*/
extern int mca_bmi_self_component_close(void);
extern int mca_btl_self_component_close(void);
/**
* SELF module initialization.
*
* @param num_bmis (OUT) Number of BMIs returned in BMI array.
* @param enable_progress_threads (IN) Flag indicating whether BMI is allowed to have progress threads
* @param enable_mpi_threads (IN) Flag indicating whether BMI must support multilple simultaneous invocations from different threads
* @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
*
*/
extern mca_bmi_base_module_t** mca_bmi_self_component_init(
int *num_bmis,
extern mca_btl_base_module_t** mca_btl_self_component_init(
int *num_btls,
bool enable_progress_threads,
bool enable_mpi_threads
);
extern mca_bmi_base_module_t mca_bmi_self;
extern mca_btl_base_module_t mca_btl_self;
/**
* Cleanup any resources held by the BMI.
* Cleanup any resources held by the BTL.
*
* @param bmi BMI instance.
* @param btl BTL instance.
* @return OMPI_SUCCESS or error status on failure.
*/
extern int mca_bmi_self_finalize(
struct mca_bmi_base_module_t* bmi
extern int mca_btl_self_finalize(
struct mca_btl_base_module_t* btl
);
/**
* PML->BMI notification of change in the process list.
* PML->BMI Notification that a receive fragment has been matched.
* PML->BTL notification of change in the process list.
* PML->BTL Notification that a receive fragment has been matched.
* Called for message that is send from process with the virtual
* address of the shared memory segment being different than that of
* the receiver.
*
* @param bmi (IN)
* @param btl (IN)
* @param proc (IN)
* @param peer (OUT)
* @return OMPI_SUCCESS or error status on failure.
*
*/
extern int mca_bmi_self_add_procs(
struct mca_bmi_base_module_t* bmi,
extern int mca_btl_self_add_procs(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t** peers,
struct mca_btl_base_endpoint_t** peers,
struct ompi_bitmap_t* reachability
);
/**
* PML->BMI notification of change in the process list.
* PML->BMI Notification that a receive fragment has been matched.
* PML->BTL notification of change in the process list.
* PML->BTL Notification that a receive fragment has been matched.
* 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.
*
* @param bmi (IN)
* @param btl (IN)
* @param proc (IN)
* @param peer (OUT)
* @return OMPI_SUCCESS or error status on failure.
*
*/
extern int mca_bmi_self_add_procs_same_base_addr(
struct mca_bmi_base_module_t* bmi,
extern int mca_btl_self_add_procs_same_base_addr(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t** peers,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachability
);
/**
* PML->BMI notification of change in the process list.
* PML->BTL notification of change in the process list.
*
* @param bmi (IN) BMI instance
* @param btl (IN) BTL instance
* @param proc (IN) Peer process
* @param peer (IN) Peer addressing information.
* @return Status indicating if cleanup was successful
*
*/
extern int mca_bmi_self_del_procs(
struct mca_bmi_base_module_t* bmi,
extern int mca_btl_self_del_procs(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t **peers
struct mca_btl_base_endpoint_t **peers
);
@ -159,18 +159,18 @@ extern int mca_bmi_self_del_procs(
* Register a callback function that is called on receipt
* of a fragment.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @return Status indicating if cleanup was successful
*
* When the process list changes, the PML notifies the BMI of the
* When the process list changes, the PML notifies the BTL of the
* change, to provide the opportunity to cleanup or release any
* resources associated with the peer.
*/
extern int mca_bmi_self_register(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_tag_t tag,
mca_bmi_base_module_recv_cb_fn_t cbfunc,
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,
void* cbdata
);
@ -178,34 +178,34 @@ extern int mca_bmi_self_register(
/**
* Allocate a segment.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @param size (IN) Request segment size.
*/
extern mca_bmi_base_descriptor_t* mca_bmi_self_alloc(
struct mca_bmi_base_module_t* bmi,
extern mca_btl_base_descriptor_t* mca_btl_self_alloc(
struct mca_btl_base_module_t* btl,
size_t size
);
/**
* Return a segment allocated by this BMI.
* Return a segment allocated by this BTL.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @param segment (IN) Allocated segment.
*/
extern int mca_bmi_self_free(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_descriptor_t* segment
extern int mca_btl_self_free(
struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* segment
);
/**
* Pack data
*
* @param bmi (IN) BMI module
* @param peer (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_src(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
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,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
@ -215,12 +215,12 @@ struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_src(
/**
* Prepare data for RDMA
*
* @param bmi (IN) BMI module
* @param peer (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_dst(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
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,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
@ -230,27 +230,27 @@ struct mca_bmi_base_descriptor_t* mca_bmi_self_prepare_dst(
/**
* Initiate a send to the peer.
*
* @param bmi (IN) BMI module
* @param peer (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
extern int mca_bmi_self_send(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_descriptor_t* descriptor,
mca_bmi_base_tag_t tag
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
);
/**
* Initiate a put to the peer.
*
* @param bmi (IN) BMI module
* @param peer (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
extern int mca_bmi_self_rdma(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_descriptor_t* descriptor
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
);

Просмотреть файл

@ -32,8 +32,8 @@
#include "util/proc_info.h"
#include "mca/pml/pml.h"
#include "mca/base/mca_base_param.h"
#include "bmi_self.h"
#include "bmi_self_frag.h"
#include "btl_self.h"
#include "btl_self_frag.h"
@ -41,20 +41,20 @@
* Shared Memory (SELF) component instance.
*/
mca_bmi_self_component_t mca_bmi_self_component = {
mca_btl_self_component_t mca_btl_self_component = {
{ /* super is being filled in */
/* First, the mca_base_component_t struct containing meta information
about the component itself */
{
/* Indicate that we are a pml v1.0.0 component (which also implies a
specific MCA version) */
MCA_BMI_BASE_VERSION_1_0_0,
MCA_BTL_BASE_VERSION_1_0_0,
"self", /* MCA component name */
1, /* MCA component major version */
0, /* MCA component minor version */
0, /* MCA component release version */
mca_bmi_self_component_open, /* component open */
mca_bmi_self_component_close /* component close */
mca_btl_self_component_open, /* component open */
mca_btl_self_component_close /* component close */
},
/* Next the MCA v1.0.0 component meta data */
@ -63,7 +63,7 @@ mca_bmi_self_component_t mca_bmi_self_component = {
false
},
mca_bmi_self_component_init,
mca_btl_self_component_init,
NULL,
} /* end super */
};
@ -73,7 +73,7 @@ mca_bmi_self_component_t mca_bmi_self_component = {
* utility routines for parameter registration
*/
static inline char* mca_bmi_self_param_register_string(
static inline char* mca_btl_self_param_register_string(
const char* param_name,
const char* default_value)
{
@ -83,7 +83,7 @@ static inline char* mca_bmi_self_param_register_string(
return param_value;
}
static inline int mca_bmi_self_param_register_int(
static inline int mca_btl_self_param_register_int(
const char* param_name,
int default_value)
{
@ -99,33 +99,33 @@ static inline int mca_bmi_self_param_register_int(
* component parameters.
*/
int mca_bmi_self_component_open(void)
int mca_btl_self_component_open(void)
{
/* register SELF component parameters */
mca_bmi_self_component.free_list_num =
mca_bmi_self_param_register_int("free_list_num", 256);
mca_bmi_self_component.free_list_max =
mca_bmi_self_param_register_int("free_list_max", -1);
mca_bmi_self_component.free_list_inc =
mca_bmi_self_param_register_int("free_list_inc", 256);
mca_bmi_self.bmi_eager_limit =
mca_bmi_self_param_register_int("eager_limit", 64*1024);
mca_bmi_self.bmi_min_send_size =
mca_bmi_self.bmi_max_send_size =
mca_bmi_self_param_register_int("max_send_size", 256*1024);
mca_bmi_self.bmi_min_rdma_size =
mca_bmi_self.bmi_max_rdma_size =
mca_bmi_self_param_register_int("max_rdma_size", INT_MAX);
mca_bmi_self.bmi_exclusivity =
mca_bmi_self_param_register_int("exclusivity", 64*1024);
mca_bmi_self.bmi_flags =
mca_bmi_self_param_register_int("flags", MCA_BMI_FLAGS_RDMA);
mca_btl_self_component.free_list_num =
mca_btl_self_param_register_int("free_list_num", 256);
mca_btl_self_component.free_list_max =
mca_btl_self_param_register_int("free_list_max", -1);
mca_btl_self_component.free_list_inc =
mca_btl_self_param_register_int("free_list_inc", 256);
mca_btl_self.btl_eager_limit =
mca_btl_self_param_register_int("eager_limit", 64*1024);
mca_btl_self.btl_min_send_size =
mca_btl_self.btl_max_send_size =
mca_btl_self_param_register_int("max_send_size", 256*1024);
mca_btl_self.btl_min_rdma_size =
mca_btl_self.btl_max_rdma_size =
mca_btl_self_param_register_int("max_rdma_size", INT_MAX);
mca_btl_self.btl_exclusivity =
mca_btl_self_param_register_int("exclusivity", 64*1024);
mca_btl_self.btl_flags =
mca_btl_self_param_register_int("flags", MCA_BTL_FLAGS_RDMA);
/* initialize objects */
OBJ_CONSTRUCT(&mca_bmi_self_component.self_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&mca_bmi_self_component.self_frags_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_bmi_self_component.self_frags_send, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_bmi_self_component.self_frags_rdma, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_self_component.self_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&mca_btl_self_component.self_frags_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_self_component.self_frags_send, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_self_component.self_frags_rdma, ompi_free_list_t);
return OMPI_SUCCESS;
}
@ -134,12 +134,12 @@ int mca_bmi_self_component_open(void)
* component cleanup - sanity checking of queue lengths
*/
int mca_bmi_self_component_close(void)
int mca_btl_self_component_close(void)
{
OBJ_DESTRUCT(&mca_bmi_self_component.self_lock);
OBJ_DESTRUCT(&mca_bmi_self_component.self_frags_eager);
OBJ_DESTRUCT(&mca_bmi_self_component.self_frags_send);
OBJ_DESTRUCT(&mca_bmi_self_component.self_frags_rdma);
OBJ_DESTRUCT(&mca_btl_self_component.self_lock);
OBJ_DESTRUCT(&mca_btl_self_component.self_frags_eager);
OBJ_DESTRUCT(&mca_btl_self_component.self_frags_send);
OBJ_DESTRUCT(&mca_btl_self_component.self_frags_rdma);
return OMPI_SUCCESS;
}
@ -147,46 +147,46 @@ int mca_bmi_self_component_close(void)
/*
* SELF component initialization
*/
mca_bmi_base_module_t** mca_bmi_self_component_init(
mca_btl_base_module_t** mca_btl_self_component_init(
int *num_ptls,
bool enable_progress_threads,
bool enable_mpi_threads)
{
mca_bmi_base_module_t **ptls = NULL;
mca_btl_base_module_t **ptls = NULL;
*num_ptls = 0;
/* allocate the Shared Memory PTL */
*num_ptls = 1;
ptls = malloc((*num_ptls)*sizeof(mca_bmi_base_module_t*));
ptls = malloc((*num_ptls)*sizeof(mca_btl_base_module_t*));
if (NULL == ptls) {
return NULL;
}
/* initialize free lists */
ompi_free_list_init(&mca_bmi_self_component.self_frags_eager,
sizeof(mca_bmi_self_frag_eager_t) + mca_bmi_self.bmi_eager_limit,
OBJ_CLASS(mca_bmi_self_frag_eager_t),
mca_bmi_self_component.free_list_num,
mca_bmi_self_component.free_list_max,
mca_bmi_self_component.free_list_inc,
ompi_free_list_init(&mca_btl_self_component.self_frags_eager,
sizeof(mca_btl_self_frag_eager_t) + mca_btl_self.btl_eager_limit,
OBJ_CLASS(mca_btl_self_frag_eager_t),
mca_btl_self_component.free_list_num,
mca_btl_self_component.free_list_max,
mca_btl_self_component.free_list_inc,
NULL);
ompi_free_list_init(&mca_bmi_self_component.self_frags_send,
sizeof(mca_bmi_self_frag_send_t) + mca_bmi_self.bmi_max_send_size,
OBJ_CLASS(mca_bmi_self_frag_send_t),
mca_bmi_self_component.free_list_num,
mca_bmi_self_component.free_list_max,
mca_bmi_self_component.free_list_inc,
ompi_free_list_init(&mca_btl_self_component.self_frags_send,
sizeof(mca_btl_self_frag_send_t) + mca_btl_self.btl_max_send_size,
OBJ_CLASS(mca_btl_self_frag_send_t),
mca_btl_self_component.free_list_num,
mca_btl_self_component.free_list_max,
mca_btl_self_component.free_list_inc,
NULL);
ompi_free_list_init(&mca_bmi_self_component.self_frags_rdma,
sizeof(mca_bmi_self_frag_rdma_t),
OBJ_CLASS(mca_bmi_self_frag_rdma_t),
mca_bmi_self_component.free_list_num,
mca_bmi_self_component.free_list_max,
mca_bmi_self_component.free_list_inc,
ompi_free_list_init(&mca_btl_self_component.self_frags_rdma,
sizeof(mca_btl_self_frag_rdma_t),
OBJ_CLASS(mca_btl_self_frag_rdma_t),
mca_btl_self_component.free_list_num,
mca_btl_self_component.free_list_max,
mca_btl_self_component.free_list_inc,
NULL);
/* get pointer to the ptls */
ptls[0] = (mca_bmi_base_module_t *)(&mca_bmi_self);
ptls[0] = (mca_btl_base_module_t *)(&mca_btl_self);
return ptls;
}

61
src/mca/btl/self/btl_self_frag.c Обычный файл
Просмотреть файл

@ -0,0 +1,61 @@
#include "btl_self_frag.h"
static inline void mca_btl_self_frag_constructor(mca_btl_self_frag_t* frag)
{
frag->segment.seg_addr.pval = frag+1;
frag->segment.seg_len = frag->size;
frag->base.des_src = &frag->segment;
frag->base.des_src_cnt = 1;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->base.des_flags = 0;
}
static void mca_btl_self_frag_eager_constructor(mca_btl_self_frag_t* frag)
{
frag->size = mca_btl_self.btl_eager_limit;
mca_btl_self_frag_constructor(frag);
}
static void mca_btl_self_frag_send_constructor(mca_btl_self_frag_t* frag)
{
frag->size = mca_btl_self.btl_max_send_size;
mca_btl_self_frag_constructor(frag);
}
static void mca_btl_self_frag_rdma_constructor(mca_btl_self_frag_t* frag)
{
frag->size = 0;
frag->segment.seg_addr.pval = frag+1;
frag->segment.seg_len = frag->size;
frag->base.des_src = NULL;
frag->base.des_src_cnt = 0;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->base.des_flags = 0;
}
static void mca_btl_self_frag_destructor(mca_btl_self_frag_t* frag)
{
}
OBJ_CLASS_INSTANCE(
mca_btl_self_frag_eager_t,
mca_btl_base_descriptor_t,
mca_btl_self_frag_eager_constructor,
mca_btl_self_frag_destructor);
OBJ_CLASS_INSTANCE(
mca_btl_self_frag_send_t,
mca_btl_base_descriptor_t,
mca_btl_self_frag_send_constructor,
mca_btl_self_frag_destructor);
OBJ_CLASS_INSTANCE(
mca_btl_self_frag_rdma_t,
mca_btl_base_descriptor_t,
mca_btl_self_frag_rdma_constructor,
mca_btl_self_frag_destructor);

Просмотреть файл

@ -16,68 +16,68 @@
/**
* @file
*/
#ifndef MCA_BMI_SELF_SEND_FRAG_H
#define MCA_BMI_SELF_SEND_FRAG_H
#ifndef MCA_BTL_SELF_SEND_FRAG_H
#define MCA_BTL_SELF_SEND_FRAG_H
#include <sys/types.h>
#include "ompi_config.h"
#include "class/ompi_free_list.h"
#include "bmi_self.h"
#include "btl_self.h"
/**
* shared memory send fragment derived type.
*/
struct mca_bmi_self_frag_t {
mca_bmi_base_descriptor_t base;
mca_bmi_base_segment_t segment;
struct mca_bmi_base_endpoint_t *endpoint;
struct mca_btl_self_frag_t {
mca_btl_base_descriptor_t base;
mca_btl_base_segment_t segment;
struct mca_btl_base_endpoint_t *endpoint;
size_t size;
};
typedef struct mca_bmi_self_frag_t mca_bmi_self_frag_t;
typedef struct mca_bmi_self_frag_t mca_bmi_self_frag_eager_t;
typedef struct mca_bmi_self_frag_t mca_bmi_self_frag_send_t;
typedef struct mca_bmi_self_frag_t mca_bmi_self_frag_rdma_t;
typedef struct mca_btl_self_frag_t mca_btl_self_frag_t;
typedef struct mca_btl_self_frag_t mca_btl_self_frag_eager_t;
typedef struct mca_btl_self_frag_t mca_btl_self_frag_send_t;
typedef struct mca_btl_self_frag_t mca_btl_self_frag_rdma_t;
OBJ_CLASS_DECLARATION(mca_bmi_self_frag_eager_t);
OBJ_CLASS_DECLARATION(mca_bmi_self_frag_send_t);
OBJ_CLASS_DECLARATION(mca_bmi_self_frag_rdma_t);
OBJ_CLASS_DECLARATION(mca_btl_self_frag_eager_t);
OBJ_CLASS_DECLARATION(mca_btl_self_frag_send_t);
OBJ_CLASS_DECLARATION(mca_btl_self_frag_rdma_t);
#define MCA_BMI_SELF_FRAG_ALLOC_EAGER(frag, rc) \
#define MCA_BTL_SELF_FRAG_ALLOC_EAGER(frag, rc) \
{ \
ompi_list_item_t* item; \
OMPI_FREE_LIST_WAIT(&mca_bmi_self_component.self_frags_eager, item, rc); \
frag = (mca_bmi_self_frag_t*)item; \
OMPI_FREE_LIST_WAIT(&mca_btl_self_component.self_frags_eager, item, rc); \
frag = (mca_btl_self_frag_t*)item; \
}
#define MCA_BMI_SELF_FRAG_RETURN_EAGER(frag) \
#define MCA_BTL_SELF_FRAG_RETURN_EAGER(frag) \
{ \
OMPI_FREE_LIST_RETURN(&mca_bmi_self_component.self_frags_eager, (ompi_list_item_t*)(frag)); \
OMPI_FREE_LIST_RETURN(&mca_btl_self_component.self_frags_eager, (ompi_list_item_t*)(frag)); \
}
#define MCA_BMI_SELF_FRAG_ALLOC_SEND(frag, rc) \
#define MCA_BTL_SELF_FRAG_ALLOC_SEND(frag, rc) \
{ \
ompi_list_item_t* item; \
OMPI_FREE_LIST_WAIT(&mca_bmi_self_component.self_frags_send, item, rc); \
frag = (mca_bmi_self_frag_t*)item; \
OMPI_FREE_LIST_WAIT(&mca_btl_self_component.self_frags_send, item, rc); \
frag = (mca_btl_self_frag_t*)item; \
}
#define MCA_BMI_SELF_FRAG_RETURN_SEND(frag) \
#define MCA_BTL_SELF_FRAG_RETURN_SEND(frag) \
{ \
OMPI_FREE_LIST_RETURN(&mca_bmi_self_component.self_frags_send, (ompi_list_item_t*)(frag)); \
OMPI_FREE_LIST_RETURN(&mca_btl_self_component.self_frags_send, (ompi_list_item_t*)(frag)); \
}
#define MCA_BMI_SELF_FRAG_ALLOC_RDMA(frag, rc) \
#define MCA_BTL_SELF_FRAG_ALLOC_RDMA(frag, rc) \
{ \
ompi_list_item_t* item; \
OMPI_FREE_LIST_WAIT(&mca_bmi_self_component.self_frags_rdma, item, rc); \
frag = (mca_bmi_self_frag_t*)item; \
OMPI_FREE_LIST_WAIT(&mca_btl_self_component.self_frags_rdma, item, rc); \
frag = (mca_btl_self_frag_t*)item; \
}
#define MCA_BMI_SELF_FRAG_RETURN_RDMA(frag) \
#define MCA_BTL_SELF_FRAG_RETURN_RDMA(frag) \
{ \
OMPI_FREE_LIST_RETURN(&mca_bmi_self_component.self_frags_rdma, (ompi_list_item_t*)(frag)); \
OMPI_FREE_LIST_RETURN(&mca_btl_self_component.self_frags_rdma, (ompi_list_item_t*)(frag)); \
}
#endif

Просмотреть файл

@ -16,8 +16,8 @@
/**
* @file
*/
#ifndef MCA_BMI_SELF_ENDPOINT_H
#define MCA_BMI_SELF_ENDPOINT_H
#ifndef MCA_BTL_SELF_ENDPOINT_H
#define MCA_BTL_SELF_ENDPOINT_H
#if OMPI_ENABLE_PROGRESS_THREADS == 1
#include "event/event.h"
@ -26,10 +26,10 @@
/**
* An abstraction that represents a connection to a endpoint process.
* An instance of mca_ptl_base_endpoint_t is associated w/ each process
* and BMI pair at startup.
* and BTL pair at startup.
*/
struct mca_bmi_base_endpoint_t {
struct mca_btl_base_endpoint_t {
int my_selfp_rank; /**< My SELFP process rank. Used for accessing
* SELFP specfic data structures. */
int peer_selfp_rank; /**< My peer's SELFP process rank. Used for accessing

Просмотреть файл

@ -17,6 +17,6 @@
# Specific to this module
PARAM_INIT_FILE=bmi_self.c
PARAM_INIT_FILE=btl_self.c
PARAM_CONFIG_HEADER_FILE="self_config.h"
PARAM_CONFIG_FILES="Makefile"

Просмотреть файл

@ -18,32 +18,32 @@
include $(top_ompi_srcdir)/config/Makefile.options
libmca_bmi_sm_la_sources = \
bmi_sm.c \
bmi_sm.h \
bmi_sm_component.c \
bmi_sm_frag.c \
bmi_sm_frag.h
libmca_btl_sm_la_sources = \
btl_sm.c \
btl_sm.h \
btl_sm_component.c \
btl_sm_frag.c \
btl_sm_frag.h
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if OMPI_BUILD_bmi_sm_DSO
if OMPI_BUILD_btl_sm_DSO
component_noinst =
component_install = mca_bmi_sm.la
component_install = mca_btl_sm.la
else
component_noinst = libmca_bmi_sm.la
component_noinst = libmca_btl_sm.la
component_install =
endif
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component_install)
mca_bmi_sm_la_SOURCES = $(libmca_bmi_sm_la_sources)
mca_bmi_sm_la_LDFLAGS = -module -avoid-version
mca_bmi_sm_la_LIBADD =
mca_btl_sm_la_SOURCES = $(libmca_btl_sm_la_sources)
mca_btl_sm_la_LDFLAGS = -module -avoid-version
mca_btl_sm_la_LIBADD =
noinst_LTLIBRARIES = $(component_noinst)
libmca_bmi_sm_la_SOURCES = $(libmca_bmi_sm_la_sources)
libmca_bmi_sm_la_LDFLAGS = -module -avoid-version
libmca_bmi_sm_la_LIBADD =
libmca_btl_sm_la_SOURCES = $(libmca_btl_sm_la_sources)
libmca_btl_sm_la_LDFLAGS = -module -avoid-version
libmca_btl_sm_la_LIBADD =

Просмотреть файл

@ -1,49 +0,0 @@
#include "bmi_sm_frag.h"
static inline void mca_bmi_sm_frag_constructor(mca_bmi_sm_frag_t* frag)
{
frag->segment.seg_addr.pval = frag+1;
frag->segment.seg_len = frag->size;
frag->base.des_src = &frag->segment;
frag->base.des_src_cnt = 1;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->base.des_flags = 0;
}
static void mca_bmi_sm_frag1_constructor(mca_bmi_sm_frag_t* frag)
{
frag->size = mca_bmi_sm_component.eager_limit;
mca_bmi_sm_frag_constructor(frag);
}
static void mca_bmi_sm_frag2_constructor(mca_bmi_sm_frag_t* frag)
{
frag->size = mca_bmi_sm_component.max_frag_size;
mca_bmi_sm_frag_constructor(frag);
}
static void mca_bmi_sm_frag_destructor(mca_bmi_sm_frag_t* frag)
{
}
OBJ_CLASS_INSTANCE(
mca_bmi_sm_frag_t,
mca_bmi_base_descriptor_t,
mca_bmi_sm_frag_constructor,
mca_bmi_sm_frag_destructor);
OBJ_CLASS_INSTANCE(
mca_bmi_sm_frag1_t,
mca_bmi_base_descriptor_t,
mca_bmi_sm_frag1_constructor,
mca_bmi_sm_frag_destructor);
OBJ_CLASS_INSTANCE(
mca_bmi_sm_frag2_t,
mca_bmi_base_descriptor_t,
mca_bmi_sm_frag2_constructor,
mca_bmi_sm_frag_destructor);

Просмотреть файл

@ -34,85 +34,85 @@
#include "class/ompi_fifo.h"
#include "class/ompi_free_list.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "mca/btl/btl.h"
#include "mca/mpool/base/base.h"
#include "mca/common/sm/common_sm_mmap.h"
#include "bmi_sm.h"
#include "bmi_sm_endpoint.h"
#include "bmi_sm_frag.h"
#include "bmi_sm_fifo.h"
#include "btl_sm.h"
#include "btl_sm_endpoint.h"
#include "btl_sm_frag.h"
#include "btl_sm_fifo.h"
mca_bmi_sm_t mca_bmi_sm[2] = {
mca_btl_sm_t mca_btl_sm[2] = {
{
{
&mca_bmi_sm_component.super,
0, /* bmi_eager_limit */
0, /* bmi_min_send_size */
0, /* bmi_max_send_size */
0, /* bmi_min_rdma_size */
0, /* bmi_max_rdma_size */
0, /* bmi_exclusivity */
0, /* bmi_latency */
0, /* bmi_bandwidth */
0, /* bmi flags */
mca_bmi_sm_add_procs_same_base_addr,
mca_bmi_sm_del_procs,
mca_bmi_sm_register,
mca_bmi_sm_finalize,
mca_bmi_sm_alloc,
mca_bmi_sm_free,
mca_bmi_sm_prepare_src,
&mca_btl_sm_component.super,
0, /* btl_eager_limit */
0, /* btl_min_send_size */
0, /* btl_max_send_size */
0, /* btl_min_rdma_size */
0, /* btl_max_rdma_size */
0, /* btl_exclusivity */
0, /* btl_latency */
0, /* btl_bandwidth */
0, /* btl flags */
mca_btl_sm_add_procs_same_base_addr,
mca_btl_sm_del_procs,
mca_btl_sm_register,
mca_btl_sm_finalize,
mca_btl_sm_alloc,
mca_btl_sm_free,
mca_btl_sm_prepare_src,
NULL,
mca_bmi_sm_send,
mca_btl_sm_send,
NULL, /* put */
NULL /* get */
}
},
{
{
&mca_bmi_sm_component.super,
0, /* bmi_eager_limit */
0, /* bmi_min_send_size */
0, /* bmi_max_send_size */
0, /* bmi_min_rdma_size */
0, /* bmi_max_rdma_size */
0, /* bmi_exclusivity */
0, /* bmi_latency */
0, /* bmi_bandwidth */
0, /* bmi flags */
mca_bmi_sm_add_procs,
mca_bmi_sm_del_procs,
mca_bmi_sm_register,
mca_bmi_sm_finalize,
mca_bmi_sm_alloc,
mca_bmi_sm_free,
mca_bmi_sm_prepare_src,
&mca_btl_sm_component.super,
0, /* btl_eager_limit */
0, /* btl_min_send_size */
0, /* btl_max_send_size */
0, /* btl_min_rdma_size */
0, /* btl_max_rdma_size */
0, /* btl_exclusivity */
0, /* btl_latency */
0, /* btl_bandwidth */
0, /* btl flags */
mca_btl_sm_add_procs,
mca_btl_sm_del_procs,
mca_btl_sm_register,
mca_btl_sm_finalize,
mca_btl_sm_alloc,
mca_btl_sm_free,
mca_btl_sm_prepare_src,
NULL,
mca_bmi_sm_send,
mca_btl_sm_send,
NULL, /* get function */
NULL /* put function */
}
}
};
/* track information needed to synchronise a Shared Memory BMI module */
mca_bmi_sm_module_resource_t mca_bmi_sm_module_resource;
/* track information needed to synchronise a Shared Memory BTL module */
mca_btl_sm_module_resource_t mca_btl_sm_module_resource;
int mca_bmi_sm_add_procs_same_base_addr(
struct mca_bmi_base_module_t* bmi,
int mca_btl_sm_add_procs_same_base_addr(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t **peers,
struct mca_btl_base_endpoint_t **peers,
ompi_bitmap_t* reachability)
{
int return_code=OMPI_SUCCESS;
size_t i,j,proc,size,n_to_allocate,length;
int n_local_procs,cnt,len, my_len;
mca_bmi_sm_exchange_t **sm_proc_info;
mca_btl_sm_exchange_t **sm_proc_info;
ompi_proc_t* my_proc; /* pointer to caller's proc structure */
mca_bmi_sm_t *bmi_sm;
mca_btl_sm_t *btl_sm;
ompi_fifo_t *my_fifos;
ompi_fifo_t * volatile *fifo_tmp;
bool same_sm_base;
@ -123,18 +123,18 @@ int mca_bmi_sm_add_procs_same_base_addr(
for(i=0 ; i < nprocs ; i++ ) {
peers[i]=NULL;
}
bmi_sm=(mca_bmi_sm_t *)bmi;
btl_sm=(mca_btl_sm_t *)btl;
/* allocate array to hold setup shared memory from all
* other procs */
sm_proc_info=(mca_bmi_sm_exchange_t **)
malloc(nprocs*sizeof(mca_bmi_sm_exchange_t *));
sm_proc_info=(mca_btl_sm_exchange_t **)
malloc(nprocs*sizeof(mca_btl_sm_exchange_t *));
if( NULL == sm_proc_info ){
return_code=OMPI_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
mca_bmi_sm_component.sm_proc_connect=(int *) malloc(nprocs*sizeof(int));
if( NULL == mca_bmi_sm_component.sm_proc_connect ){
mca_btl_sm_component.sm_proc_connect=(int *) malloc(nprocs*sizeof(int));
if( NULL == mca_btl_sm_component.sm_proc_connect ){
return_code=OMPI_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
@ -142,7 +142,7 @@ int mca_bmi_sm_add_procs_same_base_addr(
/* initialize sm_proc_info and sm_proc_connect*/
for(proc=0 ; proc < nprocs ; proc++ ) {
sm_proc_info[proc]=0;
mca_bmi_sm_component.sm_proc_connect[proc]=0;
mca_btl_sm_component.sm_proc_connect[proc]=0;
}
/* get pointer to my proc structure */
@ -161,17 +161,17 @@ int mca_bmi_sm_add_procs_same_base_addr(
for( proc=0 ; proc < nprocs; proc++ ) {
/* check to see if this is me */
if( my_proc == procs[proc] ) {
mca_bmi_sm_component.my_smp_rank=n_local_procs;
mca_btl_sm_component.my_smp_rank=n_local_procs;
}
if( procs[proc]->proc_name.jobid != my_proc->proc_name.jobid ) {
continue;
}
return_code = mca_base_modex_recv(
&mca_bmi_sm_component.super.bmi_version, procs[proc],
&mca_btl_sm_component.super.btl_version, procs[proc],
(void**)(&(sm_proc_info[proc])), &size);
if(return_code != OMPI_SUCCESS) {
ompi_output(0, "mca_bmi_sm_add_procs: mca_base_modex_recv: failed with return value=%d", return_code);
ompi_output(0, "mca_btl_sm_add_procs: mca_base_modex_recv: failed with return value=%d", return_code);
goto CLEANUP;
}
@ -185,32 +185,32 @@ int mca_bmi_sm_add_procs_same_base_addr(
if( len == my_len ) {
if( 0 == strncmp(orte_system_info.nodename,
(char *)(sm_proc_info[proc]),len) ) {
struct mca_bmi_base_endpoint_t *peer = peers[proc];
struct mca_btl_base_endpoint_t *peer = peers[proc];
#if OMPI_ENABLE_PROGRESS_THREADS == 1
char path[PATH_MAX];
/* int flags; */
#endif
/* initialize the peers information */
peer = peers[proc]=malloc(sizeof(struct mca_bmi_base_endpoint_t));
peer = peers[proc]=malloc(sizeof(struct mca_btl_base_endpoint_t));
if( NULL == peer ){
return_code=OMPI_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
peer->peer_smp_rank=n_local_procs+
mca_bmi_sm_component.num_smp_procs;
mca_btl_sm_component.num_smp_procs;
#if OMPI_ENABLE_PROGRESS_THREADS == 1
sprintf(path, "%s/sm_fifo.%d", orte_process_info.job_session_dir,
procs[proc]->proc_name.vpid);
peer->fifo_fd = open(path, O_WRONLY);
if(peer->fifo_fd < 0) {
ompi_output(0, "mca_bmi_sm_add_procs: open(%s) failed with errno=%d\n", path, errno);
ompi_output(0, "mca_btl_sm_add_procs: open(%s) failed with errno=%d\n", path, errno);
goto CLEANUP;
}
#endif
n_local_procs++;
mca_bmi_sm_component.sm_proc_connect[proc]=SM_CONNECTED;
mca_btl_sm_component.sm_proc_connect[proc]=SM_CONNECTED;
}
}
}
@ -220,55 +220,55 @@ int mca_bmi_sm_add_procs_same_base_addr(
}
/* lookup shared memory pool */
if(NULL == mca_bmi_sm_component.sm_mpool) {
mca_bmi_sm_component.sm_mpool =
mca_mpool_base_module_create(mca_bmi_sm_component.sm_mpool_name,bmi,NULL);
if(NULL == mca_btl_sm_component.sm_mpool) {
mca_btl_sm_component.sm_mpool =
mca_mpool_base_module_create(mca_btl_sm_component.sm_mpool_name,btl,NULL);
/* Sanity check to ensure that we found it */
if (NULL == mca_bmi_sm_component.sm_mpool) {
if (NULL == mca_btl_sm_component.sm_mpool) {
return_code = OMPI_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
mca_bmi_sm_component.sm_mpool_base =
mca_bmi_sm_component.sm_mpool->mpool_base(mca_bmi_sm_component.sm_mpool_base);
mca_btl_sm_component.sm_mpool_base =
mca_btl_sm_component.sm_mpool->mpool_base(mca_btl_sm_component.sm_mpool_base);
}
/* make sure that my_smp_rank has been defined */
if( 0xFFFFFFFF == mca_bmi_sm_component.my_smp_rank ) {
if( 0xFFFFFFFF == mca_btl_sm_component.my_smp_rank ) {
return_code=OMPI_ERROR;
goto CLEANUP;
}
/* see if need to allocate space for extra procs */
if( 0 > mca_bmi_sm_component.sm_max_procs ) {
if( 0 > mca_btl_sm_component.sm_max_procs ) {
/* no limit */
if( 0 <= mca_bmi_sm_component.sm_extra_procs ) {
if( 0 <= mca_btl_sm_component.sm_extra_procs ) {
/* limit */
mca_bmi_sm_component.sm_max_procs=n_local_procs+
mca_bmi_sm_component.sm_extra_procs;
mca_btl_sm_component.sm_max_procs=n_local_procs+
mca_btl_sm_component.sm_extra_procs;
} else {
/* no limit */
mca_bmi_sm_component.sm_max_procs=2*n_local_procs;
mca_btl_sm_component.sm_max_procs=2*n_local_procs;
}
}
n_to_allocate=mca_bmi_sm_component.sm_max_procs;
n_to_allocate=mca_btl_sm_component.sm_max_procs;
/* make sure n_to_allocate is greater than 0 */
if ( !mca_bmi_sm[0].bmi_inited ) {
if ( !mca_btl_sm[0].btl_inited ) {
/* set the shared memory offset */
mca_bmi_sm_component.sm_offset=(ssize_t *)
mca_btl_sm_component.sm_offset=(ssize_t *)
malloc(n_to_allocate*sizeof(ssize_t));
if(NULL == mca_bmi_sm_component.sm_offset ) {
if(NULL == mca_btl_sm_component.sm_offset ) {
return_code=OMPI_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
/* create a list of peers */
mca_bmi_sm_component.sm_peers=(struct mca_bmi_base_endpoint_t**)
malloc(n_to_allocate*sizeof(struct mca_bmi_base_endpoint_t*));
if(NULL == mca_bmi_sm_component.sm_peers ) {
mca_btl_sm_component.sm_peers=(struct mca_btl_base_endpoint_t**)
malloc(n_to_allocate*sizeof(struct mca_btl_base_endpoint_t*));
if(NULL == mca_btl_sm_component.sm_peers ) {
return_code=OMPI_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
@ -277,42 +277,42 @@ int mca_bmi_sm_add_procs_same_base_addr(
/* set local proc's smp rank in the peers structure for
* rapid access */
for( proc=0 ; proc < nprocs; proc++ ) {
struct mca_bmi_base_endpoint_t* peer = peers[proc];
struct mca_btl_base_endpoint_t* peer = peers[proc];
if(NULL != peer) {
mca_bmi_sm_component.sm_peers[peer->peer_smp_rank] = peer;
peer->my_smp_rank=mca_bmi_sm_component.my_smp_rank;
mca_btl_sm_component.sm_peers[peer->peer_smp_rank] = peer;
peer->my_smp_rank=mca_btl_sm_component.my_smp_rank;
}
}
/* Allocate Shared Memory BMI process coordination
/* Allocate Shared Memory BTL process coordination
* data structure. This will reside in shared memory */
/*
* Create backing file - only first time through
*/
if ( !mca_bmi_sm[0].bmi_inited ) {
if ( !mca_btl_sm[0].btl_inited ) {
/* set file name */
len=asprintf(&(mca_bmi_sm_component.sm_resouce_ctl_file),
"%s/shared_mem_bmi_module.%s",orte_process_info.job_session_dir,
len=asprintf(&(mca_btl_sm_component.sm_resouce_ctl_file),
"%s/shared_mem_btl_module.%s",orte_process_info.job_session_dir,
orte_system_info.nodename);
if( 0 > len ) {
goto CLEANUP;
}
size=sizeof(mca_bmi_sm_module_resource_t);
if(NULL==(mca_bmi_sm_component.mmap_file=mca_common_sm_mmap_init(size,
mca_bmi_sm_component.sm_resouce_ctl_file,
sizeof(mca_bmi_sm_module_resource_t), 8 )))
size=sizeof(mca_btl_sm_module_resource_t);
if(NULL==(mca_btl_sm_component.mmap_file=mca_common_sm_mmap_init(size,
mca_btl_sm_component.sm_resouce_ctl_file,
sizeof(mca_btl_sm_module_resource_t), 8 )))
{
ompi_output(0, "mca_bmi_sm_add_procs: unable to create shared memory BMI coordinating strucure :: size %ld \n",
ompi_output(0, "mca_btl_sm_add_procs: unable to create shared memory BTL coordinating strucure :: size %ld \n",
size);
return_code=OMPI_ERROR;
goto CLEANUP;
}
/* set the pointer to the shared memory control structure */
mca_bmi_sm_component.sm_ctl_header=(mca_bmi_sm_module_resource_t *)
mca_bmi_sm_component.mmap_file->map_seg;
mca_btl_sm_component.sm_ctl_header=(mca_btl_sm_module_resource_t *)
mca_btl_sm_component.mmap_file->map_seg;
/* Allocate a fixed size pointer array for the 2-D Shared memory queues.
@ -321,13 +321,13 @@ int mca_bmi_sm_add_procs_same_base_addr(
* for any access to these queues to ensure data consistancy when
* the array is grown */
if(0 == mca_bmi_sm_component.my_smp_rank ) {
if(0 == mca_btl_sm_component.my_smp_rank ) {
/* allocate ompi_fifo_t strucutes for each fifo of the queue
* pairs - one per pair of local processes */
/* check to make sure number of local procs is within the
* specified limits */
if( ( 0 < mca_bmi_sm_component.sm_max_procs ) &&
( n_local_procs > mca_bmi_sm_component.sm_max_procs) ) {
if( ( 0 < mca_btl_sm_component.sm_max_procs ) &&
( n_local_procs > mca_btl_sm_component.sm_max_procs) ) {
return_code=OMPI_ERROR;
goto CLEANUP;
}
@ -335,68 +335,68 @@ int mca_bmi_sm_add_procs_same_base_addr(
/* allocate array of ompi_fifo_t* elements -
* offset relative to base segement is stored, so that
* this can be used by other procs */
mca_bmi_sm_component.sm_ctl_header->fifo=
mca_bmi_sm_component.sm_mpool->mpool_alloc
(mca_bmi_sm_component.sm_mpool, n_to_allocate*sizeof(ompi_fifo_t *),
mca_btl_sm_component.sm_ctl_header->fifo=
mca_btl_sm_component.sm_mpool->mpool_alloc
(mca_btl_sm_component.sm_mpool, n_to_allocate*sizeof(ompi_fifo_t *),
CACHE_LINE_SIZE, NULL);
if ( NULL == mca_bmi_sm_component.sm_ctl_header->fifo ) {
if ( NULL == mca_btl_sm_component.sm_ctl_header->fifo ) {
return_code=OMPI_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
/* initiazlize the pointer array */
for(i=0 ; i < n_to_allocate ; i++ ) {
mca_bmi_sm_component.sm_ctl_header->fifo[i]=NULL;
mca_btl_sm_component.sm_ctl_header->fifo[i]=NULL;
}
/* allocate and initialize the array to hold the virtual address
* of the shared memory base */
mca_bmi_sm_component.sm_ctl_header->segment_header.
mca_btl_sm_component.sm_ctl_header->segment_header.
base_shared_mem_segment = ( volatile char **)
mca_bmi_sm_component.sm_mpool->mpool_alloc
(mca_bmi_sm_component.sm_mpool, n_to_allocate*sizeof(char *), CACHE_LINE_SIZE, NULL);
if ( NULL == mca_bmi_sm_component.sm_ctl_header->segment_header.
mca_btl_sm_component.sm_mpool->mpool_alloc
(mca_btl_sm_component.sm_mpool, n_to_allocate*sizeof(char *), CACHE_LINE_SIZE, NULL);
if ( NULL == mca_btl_sm_component.sm_ctl_header->segment_header.
base_shared_mem_segment ) {
return_code=OMPI_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
/* initialize the pointer array */
for(i=0 ; i < n_to_allocate ; i++ ) {
mca_bmi_sm_component.sm_ctl_header->segment_header.
mca_btl_sm_component.sm_ctl_header->segment_header.
base_shared_mem_segment[i]=NULL;
}
/* allocate and initialize the array of flags indicating
* when the virtual address of the shared memory address
* has been set */
mca_bmi_sm_component.sm_ctl_header->segment_header.
mca_btl_sm_component.sm_ctl_header->segment_header.
base_shared_mem_flags = ( int *)
mca_bmi_sm_component.sm_mpool->mpool_alloc
(mca_bmi_sm_component.sm_mpool, n_to_allocate*sizeof(int), CACHE_LINE_SIZE, NULL);
if ( NULL == mca_bmi_sm_component.sm_ctl_header->segment_header.
mca_btl_sm_component.sm_mpool->mpool_alloc
(mca_btl_sm_component.sm_mpool, n_to_allocate*sizeof(int), CACHE_LINE_SIZE, NULL);
if ( NULL == mca_btl_sm_component.sm_ctl_header->segment_header.
base_shared_mem_flags ) {
return_code=OMPI_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
for(i=0 ; i < n_to_allocate ; i++ ) {
mca_bmi_sm_component.sm_ctl_header->segment_header.
mca_btl_sm_component.sm_ctl_header->segment_header.
base_shared_mem_flags[i]=0;
}
/* set the addresses to be a relative, so that
* they can be used by other procs */
mca_bmi_sm_component.sm_ctl_header->fifo=
mca_btl_sm_component.sm_ctl_header->fifo=
(volatile ompi_fifo_t **)
( (char *)(mca_bmi_sm_component.sm_ctl_header->fifo)-
(char *)(mca_bmi_sm_component.sm_mpool->mpool_base(mca_bmi_sm_component.sm_mpool)) );
( (char *)(mca_btl_sm_component.sm_ctl_header->fifo)-
(char *)(mca_btl_sm_component.sm_mpool->mpool_base(mca_btl_sm_component.sm_mpool)) );
mca_bmi_sm_component.sm_ctl_header->segment_header.
mca_btl_sm_component.sm_ctl_header->segment_header.
base_shared_mem_segment=( volatile char **)
( (char *)(mca_bmi_sm_component.sm_ctl_header->
( (char *)(mca_btl_sm_component.sm_ctl_header->
segment_header.base_shared_mem_segment) -
(char *)(mca_bmi_sm_component.sm_mpool->mpool_base(mca_bmi_sm_component.sm_mpool)) );
(char *)(mca_btl_sm_component.sm_mpool->mpool_base(mca_btl_sm_component.sm_mpool)) );
/* allow other procs to use this shared memory map */
mca_bmi_sm_component.mmap_file->map_seg->seg_inited=true;
mca_btl_sm_component.mmap_file->map_seg->seg_inited=true;
/* memory barrier to ensure this flag is set before other
* flags are set */
@ -405,27 +405,27 @@ int mca_bmi_sm_add_procs_same_base_addr(
/* Note: Need to make sure that proc 0 initializes control
* structures before any of the other procs can progress */
if( 0 != mca_bmi_sm_component.my_smp_rank )
if( 0 != mca_btl_sm_component.my_smp_rank )
{
/* spin unitl local proc 0 initializes the segment */
while(!mca_bmi_sm_component.mmap_file->map_seg->seg_inited)
while(!mca_btl_sm_component.mmap_file->map_seg->seg_inited)
{ ; }
}
/* set the base of the shared memory segment, and flag
* indicating that it is set */
tmp_ptr=(volatile char **)
( (char *)(mca_bmi_sm_component.sm_ctl_header->segment_header.
( (char *)(mca_btl_sm_component.sm_ctl_header->segment_header.
base_shared_mem_segment) +
(long )(mca_bmi_sm_component.sm_mpool->mpool_base(mca_bmi_sm_component.sm_mpool)) );
tmp_ptr[mca_bmi_sm_component.my_smp_rank]=
mca_bmi_sm_component.sm_mpool->mpool_base(mca_bmi_sm_component.sm_mpool);
(long )(mca_btl_sm_component.sm_mpool->mpool_base(mca_btl_sm_component.sm_mpool)) );
tmp_ptr[mca_btl_sm_component.my_smp_rank]=
mca_btl_sm_component.sm_mpool->mpool_base(mca_btl_sm_component.sm_mpool);
/* memory barrier to ensure this flag is set before other
* flags are set */
ompi_atomic_mb();
mca_bmi_sm_component.sm_ctl_header->segment_header.
base_shared_mem_flags[mca_bmi_sm_component.my_smp_rank]=1;
mca_btl_sm_component.sm_ctl_header->segment_header.
base_shared_mem_flags[mca_btl_sm_component.my_smp_rank]=1;
/*
* initialize the array of fifo's "owned" by this process
@ -435,8 +435,8 @@ int mca_bmi_sm_add_procs_same_base_addr(
* virtual address space.
*/
my_fifos=( ompi_fifo_t *)
mca_bmi_sm_component.sm_mpool->mpool_alloc
(mca_bmi_sm_component.sm_mpool, n_to_allocate*sizeof(ompi_fifo_t), CACHE_LINE_SIZE, NULL);
mca_btl_sm_component.sm_mpool->mpool_alloc
(mca_btl_sm_component.sm_mpool, n_to_allocate*sizeof(ompi_fifo_t), CACHE_LINE_SIZE, NULL);
if ( NULL == my_fifos ) {
return_code=OMPI_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
@ -449,119 +449,119 @@ int mca_bmi_sm_add_procs_same_base_addr(
ompi_atomic_unlock(&(my_fifos[j].tail_lock));
}
fifo_tmp=(ompi_fifo_t * volatile *)
( (char *)(mca_bmi_sm_component.sm_ctl_header->fifo) +
(long)(mca_bmi_sm_component.sm_mpool->mpool_base(mca_bmi_sm_component.sm_mpool)) );
( (char *)(mca_btl_sm_component.sm_ctl_header->fifo) +
(long)(mca_btl_sm_component.sm_mpool->mpool_base(mca_btl_sm_component.sm_mpool)) );
/* RLG : need memory barrier */
fifo_tmp[mca_bmi_sm_component.my_smp_rank]=my_fifos;
fifo_tmp[mca_btl_sm_component.my_smp_rank]=my_fifos;
/* cache the pointer to the 2d fifo array. These addresses
* are valid in the current process space */
mca_bmi_sm_component.fifo=(ompi_fifo_t **)
mca_btl_sm_component.fifo=(ompi_fifo_t **)
malloc(sizeof(ompi_fifo_t *)*n_to_allocate);
if( NULL == mca_bmi_sm_component.fifo ) {
if( NULL == mca_btl_sm_component.fifo ) {
return_code=OMPI_ERROR;
goto CLEANUP;
}
mca_bmi_sm_component.fifo[mca_bmi_sm_component.my_smp_rank]=my_fifos;
mca_btl_sm_component.fifo[mca_btl_sm_component.my_smp_rank]=my_fifos;
}
/* cache the pointers to the rest of the fifo arrays */
fifo_tmp=(ompi_fifo_t * volatile *)
( (char *)(mca_bmi_sm_component.sm_ctl_header->fifo) +
(long)(mca_bmi_sm_component.sm_mpool->mpool_base(mca_bmi_sm_component.sm_mpool)) );
for( j=mca_bmi_sm_component.num_smp_procs ; j <
mca_bmi_sm_component.num_smp_procs+n_local_procs ; j++ ) {
( (char *)(mca_btl_sm_component.sm_ctl_header->fifo) +
(long)(mca_btl_sm_component.sm_mpool->mpool_base(mca_btl_sm_component.sm_mpool)) );
for( j=mca_btl_sm_component.num_smp_procs ; j <
mca_btl_sm_component.num_smp_procs+n_local_procs ; j++ ) {
/* spin until this element is allocated */
while ( NULL == fifo_tmp[j] )
{ ; }
tmp_ptr=(volatile char **)
( (char *)mca_bmi_sm_component.sm_ctl_header->
( (char *)mca_btl_sm_component.sm_ctl_header->
segment_header.base_shared_mem_segment +
(long)mca_bmi_sm_component.sm_mpool->mpool_base(mca_bmi_sm_component.sm_mpool));
diff= tmp_ptr[mca_bmi_sm_component.my_smp_rank]-tmp_ptr[j];
mca_bmi_sm_component.fifo[j]=
(long)mca_btl_sm_component.sm_mpool->mpool_base(mca_btl_sm_component.sm_mpool));
diff= tmp_ptr[mca_btl_sm_component.my_smp_rank]-tmp_ptr[j];
mca_btl_sm_component.fifo[j]=
( ompi_fifo_t *)( (char *)fifo_tmp[j]+diff);
mca_bmi_sm_component.sm_offset[j]=tmp_ptr[j]-
tmp_ptr[mca_bmi_sm_component.my_smp_rank];
mca_btl_sm_component.sm_offset[j]=tmp_ptr[j]-
tmp_ptr[mca_btl_sm_component.my_smp_rank];
}
/* initialize some of the free-lists */
if( !mca_bmi_sm[0].bmi_inited ) {
if( !mca_btl_sm[0].btl_inited ) {
/* some initialization happens only the first time this routine
* is called, i.e. when bmi_inited is false */
* is called, i.e. when btl_inited is false */
/* initialize fragment descriptor free lists */
/* allocation will be for the fragment descriptor and payload buffer */
length=sizeof(mca_bmi_sm_frag_t) + mca_bmi_sm_component.eager_limit;
ompi_free_list_init(&mca_bmi_sm_component.sm_frags1, length,
OBJ_CLASS(mca_bmi_sm_frag1_t),
mca_bmi_sm_component.sm_free_list_num,
mca_bmi_sm_component.sm_free_list_max,
mca_bmi_sm_component.sm_free_list_inc,
mca_bmi_sm_component.sm_mpool); /* use shared-memory pool */
length=sizeof(mca_btl_sm_frag_t) + mca_btl_sm_component.eager_limit;
ompi_free_list_init(&mca_btl_sm_component.sm_frags1, length,
OBJ_CLASS(mca_btl_sm_frag1_t),
mca_btl_sm_component.sm_free_list_num,
mca_btl_sm_component.sm_free_list_max,
mca_btl_sm_component.sm_free_list_inc,
mca_btl_sm_component.sm_mpool); /* use shared-memory pool */
length=sizeof(mca_bmi_sm_frag_t) + mca_bmi_sm_component.max_frag_size;
ompi_free_list_init(&mca_bmi_sm_component.sm_frags2, length,
OBJ_CLASS(mca_bmi_sm_frag2_t),
mca_bmi_sm_component.sm_free_list_num,
mca_bmi_sm_component.sm_free_list_max,
mca_bmi_sm_component.sm_free_list_inc,
mca_bmi_sm_component.sm_mpool); /* use shared-memory pool */
length=sizeof(mca_btl_sm_frag_t) + mca_btl_sm_component.max_frag_size;
ompi_free_list_init(&mca_btl_sm_component.sm_frags2, length,
OBJ_CLASS(mca_btl_sm_frag2_t),
mca_btl_sm_component.sm_free_list_num,
mca_btl_sm_component.sm_free_list_max,
mca_btl_sm_component.sm_free_list_inc,
mca_btl_sm_component.sm_mpool); /* use shared-memory pool */
/* set up mca_bmi_sm_component.list_smp_procs_same_base_addr */
mca_bmi_sm_component.list_smp_procs_same_base_addr=(int *)
malloc(mca_bmi_sm_component.sm_max_procs*sizeof(int));
if( NULL == mca_bmi_sm_component.list_smp_procs_same_base_addr ){
/* set up mca_btl_sm_component.list_smp_procs_same_base_addr */
mca_btl_sm_component.list_smp_procs_same_base_addr=(int *)
malloc(mca_btl_sm_component.sm_max_procs*sizeof(int));
if( NULL == mca_btl_sm_component.list_smp_procs_same_base_addr ){
return_code=OMPI_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
/* set up mca_bmi_sm_component.list_smp_procs_different_base_addr */
mca_bmi_sm_component.list_smp_procs_different_base_addr=(int *)
malloc(mca_bmi_sm_component.sm_max_procs*sizeof(int));
if( NULL == mca_bmi_sm_component.list_smp_procs_different_base_addr ){
/* set up mca_btl_sm_component.list_smp_procs_different_base_addr */
mca_btl_sm_component.list_smp_procs_different_base_addr=(int *)
malloc(mca_btl_sm_component.sm_max_procs*sizeof(int));
if( NULL == mca_btl_sm_component.list_smp_procs_different_base_addr ){
return_code=OMPI_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
/* set flag indicating bmi has been inited */
bmi_sm->bmi_inited=true;
/* set flag indicating btl has been inited */
btl_sm->btl_inited=true;
}
/* set connectivity */
cnt=0;
for(proc = 0 ; proc < nprocs ; proc++ ) {
struct mca_bmi_base_endpoint_t* peer = peers[proc];
struct mca_btl_base_endpoint_t* peer = peers[proc];
if(peer == NULL)
continue;
tmp_ptr=(volatile char **)
( (char *)mca_bmi_sm_component.sm_ctl_header->
( (char *)mca_btl_sm_component.sm_ctl_header->
segment_header.base_shared_mem_segment +
(long)mca_bmi_sm_component.sm_mpool->mpool_base(mca_bmi_sm_component.sm_mpool));
(long)mca_btl_sm_component.sm_mpool->mpool_base(mca_btl_sm_component.sm_mpool));
same_sm_base=(tmp_ptr[peer->peer_smp_rank] ==
tmp_ptr[mca_bmi_sm_component.my_smp_rank]);
tmp_ptr[mca_btl_sm_component.my_smp_rank]);
if( SM_CONNECTED == mca_bmi_sm_component.sm_proc_connect[proc] ) {
if( SM_CONNECTED == mca_btl_sm_component.sm_proc_connect[proc] ) {
if( same_sm_base ){
/* don't count if same process */
if( (mca_bmi_sm_component.num_smp_procs+cnt ) ==
mca_bmi_sm_component.my_smp_rank) {
if( (mca_btl_sm_component.num_smp_procs+cnt ) ==
mca_btl_sm_component.my_smp_rank) {
cnt++;
continue;
}
/* set up the list of local processes with the same base
* shared memory virtual address as this process */
mca_bmi_sm_component.list_smp_procs_same_base_addr
[mca_bmi_sm_component.num_smp_procs_same_base_addr]=
mca_btl_sm_component.list_smp_procs_same_base_addr
[mca_btl_sm_component.num_smp_procs_same_base_addr]=
cnt;
mca_bmi_sm_component.num_smp_procs_same_base_addr++;
mca_btl_sm_component.num_smp_procs_same_base_addr++;
cnt++;
/* add this proc to shared memory accessability list */
return_code=ompi_bitmap_set_bit(reachability,proc);
@ -571,19 +571,19 @@ int mca_bmi_sm_add_procs_same_base_addr(
} else {
/* set up the list of local processes with the same base
* shared memory virtual address as this process */
mca_bmi_sm_component.list_smp_procs_different_base_addr
[mca_bmi_sm_component.num_smp_procs_different_base_addr]=
mca_btl_sm_component.list_smp_procs_different_base_addr
[mca_btl_sm_component.num_smp_procs_different_base_addr]=
cnt;
mca_bmi_sm_component.num_smp_procs_different_base_addr++;
mca_btl_sm_component.num_smp_procs_different_base_addr++;
cnt++;
mca_bmi_sm_component.sm_proc_connect[proc]=
mca_btl_sm_component.sm_proc_connect[proc]=
SM_CONNECTED_DIFFERENT_BASE_ADDR;
}
}
}
/* update the local smp process count */
mca_bmi_sm_component.num_smp_procs+=n_local_procs;
mca_btl_sm_component.num_smp_procs+=n_local_procs;
CLEANUP:
/* free local memory */
@ -602,14 +602,14 @@ CLEANUP:
return return_code;
}
/* Note:: this routine assumes that mca_bmi_sm_add_procs_same_base_addr
/* Note:: this routine assumes that mca_btl_sm_add_procs_same_base_addr
* has already been called to set up data structures needed by this
* routine */
int mca_bmi_sm_add_procs(
struct mca_bmi_base_module_t* bmi,
int mca_btl_sm_add_procs(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t **peers,
struct mca_btl_base_endpoint_t **peers,
ompi_bitmap_t* reachability)
{
int return_code = OMPI_SUCCESS, tmp_cnt;
@ -624,9 +624,9 @@ int mca_bmi_sm_add_procs(
tmp_cnt=0;
for(proc = 0 ; proc < nprocs ; proc++ ) {
if( (SM_CONNECTED_DIFFERENT_BASE_ADDR ==
mca_bmi_sm_component.sm_proc_connect[proc]) ||
mca_btl_sm_component.sm_proc_connect[proc]) ||
(SM_CONNECTED ==
mca_bmi_sm_component.sm_proc_connect[proc]) ) {
mca_btl_sm_component.sm_proc_connect[proc]) ) {
tmp_cnt++;
}
}
@ -634,14 +634,14 @@ int mca_bmi_sm_add_procs(
n_local_procs=0;
for(proc = 0 ; proc < nprocs ; proc++ ) {
if( (SM_CONNECTED_DIFFERENT_BASE_ADDR ==
mca_bmi_sm_component.sm_proc_connect[proc]) ||
mca_btl_sm_component.sm_proc_connect[proc]) ||
(SM_CONNECTED ==
mca_bmi_sm_component.sm_proc_connect[proc]) ) {
mca_btl_sm_component.sm_proc_connect[proc]) ) {
n_local_procs++;
}
if( (SM_CONNECTED_DIFFERENT_BASE_ADDR ==
mca_bmi_sm_component.sm_proc_connect[proc]) ) {
mca_btl_sm_component.sm_proc_connect[proc]) ) {
/* add this proc to shared memory accessability list */
return_code=ompi_bitmap_set_bit(reachability,proc);
@ -650,54 +650,54 @@ int mca_bmi_sm_add_procs(
}
/* initialize the peers information */
peers[proc]=malloc(sizeof(struct mca_bmi_base_endpoint_t));
peers[proc]=malloc(sizeof(struct mca_btl_base_endpoint_t));
if( NULL == peers[proc] ){
return_code=OMPI_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
peers[proc]->my_smp_rank=mca_bmi_sm_component.my_smp_rank;
/* subtract tmp_cnt, since mca_bmi_sm_add_procs_same_base_addr
peers[proc]->my_smp_rank=mca_btl_sm_component.my_smp_rank;
/* subtract tmp_cnt, since mca_btl_sm_add_procs_same_base_addr
* already added these into num_smp_procs */
peers[proc]->peer_smp_rank=n_local_procs+
mca_bmi_sm_component.num_smp_procs-tmp_cnt;
mca_btl_sm_component.num_smp_procs-tmp_cnt;
n_local_procs++;
}
}
CLEANUP:
/* free local memory */
if(mca_bmi_sm_component.sm_proc_connect){
free(mca_bmi_sm_component.sm_proc_connect);
mca_bmi_sm_component.sm_proc_connect=NULL;
if(mca_btl_sm_component.sm_proc_connect){
free(mca_btl_sm_component.sm_proc_connect);
mca_btl_sm_component.sm_proc_connect=NULL;
}
return return_code;
}
int mca_bmi_sm_del_procs(
struct mca_bmi_base_module_t* bmi,
int mca_btl_sm_del_procs(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t **peers)
struct mca_btl_base_endpoint_t **peers)
{
return OMPI_SUCCESS;
}
/**
* MCA->BMI Clean up any resources held by BMI module
* MCA->BTL Clean up any resources held by BTL module
* before the module is unloaded.
*
* @param bmi (IN) BMI module.
* @param btl (IN) BTL module.
*
* Prior to unloading a BMI module, the MCA framework will call
* the BMI finalize method of the module. Any resources held by
* the BMI should be released and if required the memory corresponding
* to the BMI module freed.
* Prior to unloading a BTL module, the MCA framework will call
* the BTL finalize method of the module. Any resources held by
* the BTL should be released and if required the memory corresponding
* to the BTL module freed.
*
*/
int mca_bmi_sm_finalize(struct mca_bmi_base_module_t* bmi)
int mca_btl_sm_finalize(struct mca_btl_base_module_t* btl)
{
return OMPI_SUCCESS;
}
@ -707,23 +707,23 @@ int mca_bmi_sm_finalize(struct mca_bmi_base_module_t* bmi)
* Register a callback function that is called on receipt
* of a fragment.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @return Status indicating if cleanup was successful
*
* When the process list changes, the PML notifies the BMI of the
* When the process list changes, the PML notifies the BTL of the
* change, to provide the opportunity to cleanup or release any
* resources associated with the peer.
*/
int mca_bmi_sm_register(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_tag_t tag,
mca_bmi_base_module_recv_cb_fn_t cbfunc,
int mca_btl_sm_register(
struct mca_btl_base_module_t* btl,
mca_btl_base_tag_t tag,
mca_btl_base_module_recv_cb_fn_t cbfunc,
void* cbdata)
{
mca_bmi_sm_t* sm_bmi = (mca_bmi_sm_t*)bmi;
sm_bmi->sm_reg[tag].cbfunc = cbfunc;
sm_bmi->sm_reg[tag].cbdata = cbdata;
mca_btl_sm_t* sm_btl = (mca_btl_sm_t*)btl;
sm_btl->sm_reg[tag].cbfunc = cbfunc;
sm_btl->sm_reg[tag].cbdata = cbdata;
return OMPI_SUCCESS;
}
@ -731,38 +731,38 @@ int mca_bmi_sm_register(
/**
* Allocate a segment.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @param size (IN) Request segment size.
*/
extern mca_bmi_base_descriptor_t* mca_bmi_sm_alloc(
struct mca_bmi_base_module_t* bmi,
extern mca_btl_base_descriptor_t* mca_btl_sm_alloc(
struct mca_btl_base_module_t* btl,
size_t size)
{
mca_bmi_sm_frag_t* frag;
mca_btl_sm_frag_t* frag;
int rc;
if(size <= mca_bmi_sm_component.eager_limit) {
MCA_BMI_SM_FRAG_ALLOC1(frag,rc);
if(size <= mca_btl_sm_component.eager_limit) {
MCA_BTL_SM_FRAG_ALLOC1(frag,rc);
} else {
MCA_BMI_SM_FRAG_ALLOC2(frag,rc);
MCA_BTL_SM_FRAG_ALLOC2(frag,rc);
}
return (mca_bmi_base_descriptor_t*)frag;
return (mca_btl_base_descriptor_t*)frag;
}
/**
* Return a segment allocated by this BMI.
* Return a segment allocated by this BTL.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @param segment (IN) Allocated segment.
*/
extern int mca_bmi_sm_free(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_descriptor_t* des)
extern int mca_btl_sm_free(
struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* des)
{
mca_bmi_sm_frag_t* frag = (mca_bmi_sm_frag_t*)des;
if(frag->size <= mca_bmi_sm_component.eager_limit) {
MCA_BMI_SM_FRAG_RETURN1(frag);
mca_btl_sm_frag_t* frag = (mca_btl_sm_frag_t*)des;
if(frag->size <= mca_btl_sm_component.eager_limit) {
MCA_BTL_SM_FRAG_RETURN1(frag);
} else {
MCA_BMI_SM_FRAG_RETURN2(frag);
MCA_BTL_SM_FRAG_RETURN2(frag);
}
return OMPI_SUCCESS;
}
@ -771,24 +771,24 @@ extern int mca_bmi_sm_free(
/**
* Pack data
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
*/
struct mca_bmi_base_descriptor_t* mca_bmi_sm_prepare_src(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_btl_base_descriptor_t* mca_btl_sm_prepare_src(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* endpoint,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size)
{
mca_bmi_sm_frag_t* frag;
mca_btl_sm_frag_t* frag;
struct iovec iov;
uint32_t iov_count = 1;
size_t max_data = *size;
int32_t free_after;
int rc;
MCA_BMI_SM_FRAG_ALLOC2(frag, rc);
MCA_BTL_SM_FRAG_ALLOC2(frag, rc);
if(NULL == frag) {
return NULL;
}
@ -801,7 +801,7 @@ struct mca_bmi_base_descriptor_t* mca_bmi_sm_prepare_src(
rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data, &free_after);
if(rc < 0) {
MCA_BMI_SM_FRAG_RETURN2(frag);
MCA_BTL_SM_FRAG_RETURN2(frag);
return NULL;
}
frag->segment.seg_len = reserve + max_data;
@ -813,28 +813,28 @@ struct mca_bmi_base_descriptor_t* mca_bmi_sm_prepare_src(
/**
* Initiate a send to the peer.
*
* @param bmi (IN) BMI module
* @param peer (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
int mca_bmi_sm_send(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_descriptor_t* descriptor,
mca_bmi_base_tag_t tag)
int mca_btl_sm_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)
{
mca_bmi_sm_frag_t* frag = (mca_bmi_sm_frag_t*)descriptor;
mca_btl_sm_frag_t* frag = (mca_btl_sm_frag_t*)descriptor;
int rc;
frag->tag = tag;
frag->type = MCA_BMI_SM_FRAG_SEND;
frag->type = MCA_BTL_SM_FRAG_SEND;
frag->rc = OMPI_SUCCESS;
/*
* post the descriptor in the queue - post with the relative
* address
*/
MCA_BMI_SM_FIFO_WRITE(endpoint->my_smp_rank,endpoint->peer_smp_rank, frag, rc);
MCA_BTL_SM_FIFO_WRITE(endpoint->my_smp_rank,endpoint->peer_smp_rank, frag, rc);
return rc;
}

Просмотреть файл

@ -17,8 +17,8 @@
/**
* @file
*/
#ifndef MCA_BMI_SM_H
#define MCA_BMI_SM_H
#ifndef MCA_BTL_SM_H
#define MCA_BTL_SM_H
#include <stdlib.h>
#include <sys/types.h>
@ -29,8 +29,8 @@
#include "class/ompi_fifo.h"
#include "event/event.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "mca/bmi/base/base.h"
#include "mca/btl/btl.h"
#include "mca/btl/base/base.h"
#include "mca/mpool/mpool.h"
#include "mca/common/sm/common_sm_mmap.h"
@ -43,7 +43,7 @@ extern "C" {
/*
* Shared Memory resource managment
*/
struct mca_bmi_sm_module_resource_t {
struct mca_btl_sm_module_resource_t {
/* base control structures */
mca_common_sm_file_header_t segment_header;
@ -51,8 +51,8 @@ struct mca_bmi_sm_module_resource_t {
* segment will be stored here */
volatile ompi_fifo_t **fifo;
};
typedef struct mca_bmi_sm_module_resource_t mca_bmi_sm_module_resource_t;
extern mca_bmi_sm_module_resource_t mca_bmi_sm_module_resource;
typedef struct mca_btl_sm_module_resource_t mca_btl_sm_module_resource_t;
extern mca_btl_sm_module_resource_t mca_btl_sm_module_resource;
#define SM_CONNECTED 1
#define SM_CONNECTED_SAME_BASE_ADDR 2
@ -63,14 +63,14 @@ extern mca_bmi_sm_module_resource_t mca_bmi_sm_module_resource;
#define DONE (char)1
#endif
typedef mca_bmi_base_recv_reg_t mca_bmi_sm_recv_reg_t;
typedef mca_btl_base_recv_reg_t mca_btl_sm_recv_reg_t;
/**
* Shared Memory (SM) BMI module.
* Shared Memory (SM) BTL module.
*/
struct mca_bmi_sm_component_t {
mca_bmi_base_component_1_0_0_t super; /**< base BMI component */
struct mca_btl_sm_component_t {
mca_btl_base_component_1_0_0_t super; /**< base BTL component */
int sm_free_list_num; /**< initial size of free lists */
int sm_free_list_max; /**< maximum size of free lists */
int sm_free_list_inc; /**< number of elements to alloc when growing free lists */
@ -85,7 +85,7 @@ struct mca_bmi_sm_component_t {
char* sm_resouce_ctl_file; /**< name of shared memory file used
to coordinate resource usage */
mca_common_sm_mmap_t *mmap_file; /**< description of mmap'ed file */
mca_bmi_sm_module_resource_t *sm_ctl_header; /* control header in
mca_btl_sm_module_resource_t *sm_ctl_header; /* control header in
shared memory */
ompi_fifo_t **fifo; /**< cached copy of the pointer to the 2D
fifo array. The address in the shared
@ -96,9 +96,9 @@ struct mca_bmi_sm_component_t {
size_t cb_lazy_free_freq; /**< frequency of lazy free */
ssize_t *sm_offset; /**< offset to be applied to shared memory
addresses, per local process value */
int *sm_proc_connect; /* scratch array used by the 0'th bmi to
int *sm_proc_connect; /* scratch array used by the 0'th btl to
* set indicate sm connectivty. Used by
* the 1'st bmi */
* the 1'st btl */
size_t num_smp_procs; /**< current number of smp procs on this
host */
int num_smp_procs_same_base_addr; /* number of procs with same
@ -121,7 +121,7 @@ struct mca_bmi_sm_component_t {
ompi_free_list_t sm_first_frags_to_progress; /**< list of first
fragments that are
awaiting resources */
struct mca_bmi_base_endpoint_t **sm_peers;
struct mca_btl_base_endpoint_t **sm_peers;
#if OMPI_ENABLE_PROGRESS_THREADS == 1
char sm_fifo_path[PATH_MAX]; /**< path to fifo used to signal this process */
@ -129,29 +129,29 @@ struct mca_bmi_sm_component_t {
ompi_thread_t sm_fifo_thread;
#endif
};
typedef struct mca_bmi_sm_component_t mca_bmi_sm_component_t;
extern mca_bmi_sm_component_t mca_bmi_sm_component;
typedef struct mca_btl_sm_component_t mca_btl_sm_component_t;
extern mca_btl_sm_component_t mca_btl_sm_component;
/**
* Register shared memory module parameters with the MCA framework
*/
extern int mca_bmi_sm_component_open(void);
extern int mca_btl_sm_component_open(void);
/**
* Any final cleanup before being unloaded.
*/
extern int mca_bmi_sm_component_close(void);
extern int mca_btl_sm_component_close(void);
/**
* SM module initialization.
*
* @param num_bmis (OUT) Number of BMIs returned in BMI array.
* @param enable_progress_threads (IN) Flag indicating whether BMI is allowed to have progress threads
* @param enable_mpi_threads (IN) Flag indicating whether BMI must support multilple simultaneous invocations from different threads
* @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
*
*/
extern mca_bmi_base_module_t** mca_bmi_sm_component_init(
int *num_bmis,
extern mca_btl_base_module_t** mca_btl_sm_component_init(
int *num_btls,
bool enable_progress_threads,
bool enable_mpi_threads
);
@ -159,93 +159,93 @@ extern mca_bmi_base_module_t** mca_bmi_sm_component_init(
/**
* shared memory component progress.
*/
extern int mca_bmi_sm_component_progress(void);
extern int mca_btl_sm_component_progress(void);
/**
* SM BMI Interface
* SM BTL Interface
*/
struct mca_bmi_sm_t {
mca_bmi_base_module_t super; /**< base BMI interface */
bool bmi_inited; /**< flag indicating if bmi has been inited */
mca_bmi_sm_recv_reg_t sm_reg[256];
struct mca_btl_sm_t {
mca_btl_base_module_t super; /**< base BTL interface */
bool btl_inited; /**< flag indicating if btl has been inited */
mca_btl_sm_recv_reg_t sm_reg[256];
};
typedef struct mca_bmi_sm_t mca_bmi_sm_t;
typedef struct mca_btl_sm_t mca_btl_sm_t;
extern mca_bmi_sm_t mca_bmi_sm[2];
extern mca_btl_sm_t mca_btl_sm[2];
/**
* Cleanup any resources held by the BMI.
* Cleanup any resources held by the BTL.
*
* @param bmi BMI instance.
* @param btl BTL instance.
* @return OMPI_SUCCESS or error status on failure.
*/
extern int mca_bmi_sm_finalize(
struct mca_bmi_base_module_t* bmi
extern int mca_btl_sm_finalize(
struct mca_btl_base_module_t* btl
);
/**
* PML->BMI notification of change in the process list.
* PML->BMI Notification that a receive fragment has been matched.
* PML->BTL notification of change in the process list.
* PML->BTL Notification that a receive fragment has been matched.
* Called for message that is send from process with the virtual
* address of the shared memory segment being different than that of
* the receiver.
*
* @param bmi (IN)
* @param btl (IN)
* @param proc (IN)
* @param peer (OUT)
* @return OMPI_SUCCESS or error status on failure.
*
*/
extern int mca_bmi_sm_add_procs(
struct mca_bmi_base_module_t* bmi,
extern int mca_btl_sm_add_procs(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t** peers,
struct mca_btl_base_endpoint_t** peers,
struct ompi_bitmap_t* reachability
);
/**
* PML->BMI notification of change in the process list.
* PML->BMI Notification that a receive fragment has been matched.
* PML->BTL notification of change in the process list.
* PML->BTL Notification that a receive fragment has been matched.
* 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.
*
* @param bmi (IN)
* @param btl (IN)
* @param proc (IN)
* @param peer (OUT)
* @return OMPI_SUCCESS or error status on failure.
*
*/
extern int mca_bmi_sm_add_procs_same_base_addr(
struct mca_bmi_base_module_t* bmi,
extern int mca_btl_sm_add_procs_same_base_addr(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t** peers,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachability
);
/**
* PML->BMI notification of change in the process list.
* PML->BTL notification of change in the process list.
*
* @param bmi (IN) BMI instance
* @param btl (IN) BTL instance
* @param proc (IN) Peer process
* @param peer (IN) Peer addressing information.
* @return Status indicating if cleanup was successful
*
*/
extern int mca_bmi_sm_del_procs(
struct mca_bmi_base_module_t* bmi,
extern int mca_btl_sm_del_procs(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t **peers
struct mca_btl_base_endpoint_t **peers
);
@ -253,18 +253,18 @@ extern int mca_bmi_sm_del_procs(
* Register a callback function that is called on receipt
* of a fragment.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @return Status indicating if cleanup was successful
*
* When the process list changes, the PML notifies the BMI of the
* When the process list changes, the PML notifies the BTL of the
* change, to provide the opportunity to cleanup or release any
* resources associated with the peer.
*/
extern int mca_bmi_sm_register(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_tag_t tag,
mca_bmi_base_module_recv_cb_fn_t cbfunc,
extern int mca_btl_sm_register(
struct mca_btl_base_module_t* btl,
mca_btl_base_tag_t tag,
mca_btl_base_module_recv_cb_fn_t cbfunc,
void* cbdata
);
@ -272,34 +272,34 @@ extern int mca_bmi_sm_register(
/**
* Allocate a segment.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @param size (IN) Request segment size.
*/
extern mca_bmi_base_descriptor_t* mca_bmi_sm_alloc(
struct mca_bmi_base_module_t* bmi,
extern mca_btl_base_descriptor_t* mca_btl_sm_alloc(
struct mca_btl_base_module_t* btl,
size_t size
);
/**
* Return a segment allocated by this BMI.
* Return a segment allocated by this BTL.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @param segment (IN) Allocated segment.
*/
extern int mca_bmi_sm_free(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_descriptor_t* segment
extern int mca_btl_sm_free(
struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* segment
);
/**
* Pack data
*
* @param bmi (IN) BMI module
* @param peer (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
struct mca_bmi_base_descriptor_t* mca_bmi_sm_prepare_src(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_btl_base_descriptor_t* mca_btl_sm_prepare_src(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* endpoint,
mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
@ -309,14 +309,14 @@ struct mca_bmi_base_descriptor_t* mca_bmi_sm_prepare_src(
/**
* Initiate a send to the peer.
*
* @param bmi (IN) BMI module
* @param peer (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
extern int mca_bmi_sm_send(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_descriptor_t* descriptor,
mca_bmi_base_tag_t tag
extern int mca_btl_sm_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
);
/**
@ -324,25 +324,25 @@ extern int mca_bmi_sm_send(
* all other procs at startup. !!!!! This is only temporary, until the
* registry is complete
*/
#define MCA_BMI_SM_MAX_HOSTNAME_LEN 128
typedef struct mca_bmi_sm_exchange{
char host_name[MCA_BMI_SM_MAX_HOSTNAME_LEN];
}mca_bmi_sm_exchange_t;
#define MCA_BTL_SM_MAX_HOSTNAME_LEN 128
typedef struct mca_btl_sm_exchange{
char host_name[MCA_BTL_SM_MAX_HOSTNAME_LEN];
}mca_btl_sm_exchange_t;
#if OMPI_ENABLE_PROGRESS_THREADS == 1
void mca_bmi_sm_component_event_thread(ompi_object_t*);
void mca_btl_sm_component_event_thread(ompi_object_t*);
#endif
#if OMPI_ENABLE_PROGRESS_THREADS == 1
#define MCA_BMI_SM_SIGNAL_PEER(peer) \
#define MCA_BTL_SM_SIGNAL_PEER(peer) \
{ \
unsigned char cmd = DATA; \
if(write(peer->fifo_fd, &cmd, sizeof(cmd)) != sizeof(cmd)) { \
ompi_output(0, "mca_bmi_sm_send: write fifo failed: errno=%d\n", errno); \
ompi_output(0, "mca_btl_sm_send: write fifo failed: errno=%d\n", errno); \
} \
}
#else
#define MCA_BMI_SM_SIGNAL_PEER(peer)
#define MCA_BTL_SM_SIGNAL_PEER(peer)
#endif

Просмотреть файл

@ -35,35 +35,35 @@
#include "mca/base/mca_base_module_exchange.h"
#include "mca/mpool/base/base.h"
#include "mca/common/sm/common_sm_mmap.h"
#include "bmi_sm.h"
#include "bmi_sm_frag.h"
#include "bmi_sm_fifo.h"
#include "btl_sm.h"
#include "btl_sm_frag.h"
#include "btl_sm_fifo.h"
/*
* Local utility functions.
*/
static int mca_bmi_sm_component_exchange(void);
static int mca_btl_sm_component_exchange(void);
/*
* Shared Memory (SM) component instance.
*/
mca_bmi_sm_component_t mca_bmi_sm_component = {
mca_btl_sm_component_t mca_btl_sm_component = {
{ /* super is being filled in */
/* First, the mca_base_component_t struct containing meta information
about the component itself */
{
/* Indicate that we are a pml v1.0.0 component (which also implies a
specific MCA version) */
MCA_BMI_BASE_VERSION_1_0_0,
MCA_BTL_BASE_VERSION_1_0_0,
"sm", /* MCA component name */
1, /* MCA component major version */
0, /* MCA component minor version */
0, /* MCA component release version */
mca_bmi_sm_component_open, /* component open */
mca_bmi_sm_component_close /* component close */
mca_btl_sm_component_open, /* component open */
mca_btl_sm_component_close /* component close */
},
/* Next the MCA v1.0.0 component meta data */
@ -72,8 +72,8 @@ mca_bmi_sm_component_t mca_bmi_sm_component = {
false
},
mca_bmi_sm_component_init,
mca_bmi_sm_component_progress,
mca_btl_sm_component_init,
mca_btl_sm_component_progress,
} /* end super */
};
@ -82,7 +82,7 @@ mca_bmi_sm_component_t mca_bmi_sm_component = {
* utility routines for parameter registration
*/
static inline char* mca_bmi_sm_param_register_string(
static inline char* mca_btl_sm_param_register_string(
const char* param_name,
const char* default_value)
{
@ -92,7 +92,7 @@ static inline char* mca_bmi_sm_param_register_string(
return param_value;
}
static inline int mca_bmi_sm_param_register_int(
static inline int mca_btl_sm_param_register_int(
const char* param_name,
int default_value)
{
@ -108,51 +108,51 @@ static inline int mca_bmi_sm_param_register_int(
* component parameters.
*/
int mca_bmi_sm_component_open(void)
int mca_btl_sm_component_open(void)
{
/* register SM component parameters */
mca_bmi_sm_component.sm_free_list_num =
mca_bmi_sm_param_register_int("free_list_num", 256);
mca_bmi_sm_component.sm_free_list_max =
mca_bmi_sm_param_register_int("free_list_max", -1);
mca_bmi_sm_component.sm_free_list_inc =
mca_bmi_sm_param_register_int("free_list_inc", 256);
mca_bmi_sm_component.sm_max_procs =
mca_bmi_sm_param_register_int("max_procs", -1);
mca_bmi_sm_component.sm_extra_procs =
mca_bmi_sm_param_register_int("sm_extra_procs", -1);
mca_bmi_sm_component.sm_mpool_name =
mca_bmi_sm_param_register_string("mpool", "sm");
mca_bmi_sm_component.eager_limit =
mca_bmi_sm_param_register_int("eager_limit", 1024);
mca_bmi_sm_component.max_frag_size =
mca_bmi_sm_param_register_int("max_frag_size", 8*1024);
mca_bmi_sm_component.size_of_cb_queue =
mca_bmi_sm_param_register_int("size_of_cb_queue", 128);
mca_bmi_sm_component.cb_lazy_free_freq =
mca_bmi_sm_param_register_int("cb_lazy_free_freq", 120);
mca_btl_sm_component.sm_free_list_num =
mca_btl_sm_param_register_int("free_list_num", 256);
mca_btl_sm_component.sm_free_list_max =
mca_btl_sm_param_register_int("free_list_max", -1);
mca_btl_sm_component.sm_free_list_inc =
mca_btl_sm_param_register_int("free_list_inc", 256);
mca_btl_sm_component.sm_max_procs =
mca_btl_sm_param_register_int("max_procs", -1);
mca_btl_sm_component.sm_extra_procs =
mca_btl_sm_param_register_int("sm_extra_procs", -1);
mca_btl_sm_component.sm_mpool_name =
mca_btl_sm_param_register_string("mpool", "sm");
mca_btl_sm_component.eager_limit =
mca_btl_sm_param_register_int("eager_limit", 1024);
mca_btl_sm_component.max_frag_size =
mca_btl_sm_param_register_int("max_frag_size", 8*1024);
mca_btl_sm_component.size_of_cb_queue =
mca_btl_sm_param_register_int("size_of_cb_queue", 128);
mca_btl_sm_component.cb_lazy_free_freq =
mca_btl_sm_param_register_int("cb_lazy_free_freq", 120);
/* make sure that queue size and lazy free frequency are consistent -
* want to make sure that slots are freed at a rate they can be
* reused, w/o allocating extra new circular buffer fifo arrays */
if( (float)(mca_bmi_sm_component.cb_lazy_free_freq) >=
0.95*(float)(mca_bmi_sm_component.size_of_cb_queue) ) {
if( (float)(mca_btl_sm_component.cb_lazy_free_freq) >=
0.95*(float)(mca_btl_sm_component.size_of_cb_queue) ) {
/* upper limit */
mca_bmi_sm_component.cb_lazy_free_freq=
(int)(0.95*(float)(mca_bmi_sm_component.size_of_cb_queue));
mca_btl_sm_component.cb_lazy_free_freq=
(int)(0.95*(float)(mca_btl_sm_component.size_of_cb_queue));
/* lower limit */
if( 0>= mca_bmi_sm_component.cb_lazy_free_freq ) {
mca_bmi_sm_component.cb_lazy_free_freq=1;
if( 0>= mca_btl_sm_component.cb_lazy_free_freq ) {
mca_btl_sm_component.cb_lazy_free_freq=1;
}
}
/* default number of extra procs to allow for future growth */
mca_bmi_sm_component.sm_extra_procs =
mca_bmi_sm_param_register_int("sm_extra_procs", 2);
mca_btl_sm_component.sm_extra_procs =
mca_btl_sm_param_register_int("sm_extra_procs", 2);
/* initialize objects */
OBJ_CONSTRUCT(&mca_bmi_sm_component.sm_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&mca_bmi_sm_component.sm_frags1, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_bmi_sm_component.sm_frags2, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_sm_component.sm_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&mca_btl_sm_component.sm_frags1, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_sm_component.sm_frags2, ompi_free_list_t);
return OMPI_SUCCESS;
}
@ -161,22 +161,22 @@ int mca_bmi_sm_component_open(void)
* component cleanup - sanity checking of queue lengths
*/
int mca_bmi_sm_component_close(void)
int mca_btl_sm_component_close(void)
{
int return_value=OMPI_SUCCESS;
OBJ_DESTRUCT(&mca_bmi_sm_component.sm_lock);
OBJ_DESTRUCT(&mca_bmi_sm_component.sm_frags1);
OBJ_DESTRUCT(&mca_bmi_sm_component.sm_frags2);
OBJ_DESTRUCT(&mca_btl_sm_component.sm_lock);
OBJ_DESTRUCT(&mca_btl_sm_component.sm_frags1);
OBJ_DESTRUCT(&mca_btl_sm_component.sm_frags2);
/* unmap the shared memory control structure */
if(mca_bmi_sm_component.mmap_file != NULL) {
return_value=munmap(mca_bmi_sm_component.mmap_file->map_addr,
mca_bmi_sm_component.mmap_file->map_size);
if(mca_btl_sm_component.mmap_file != NULL) {
return_value=munmap(mca_btl_sm_component.mmap_file->map_addr,
mca_btl_sm_component.mmap_file->map_size);
if(-1 == return_value) {
return_value=OMPI_ERROR;
ompi_output(0," munmap failed :: file - %s :: errno - %d \n",
mca_bmi_sm_component.mmap_file->map_addr,
mca_btl_sm_component.mmap_file->map_addr,
errno);
goto CLEANUP;
}
@ -185,22 +185,22 @@ int mca_bmi_sm_component_close(void)
* to it are gone - no error checking, since we want all procs
* to call this, so that in an abnormal termination scanario,
* this file will still get cleaned up */
unlink(mca_bmi_sm_component.mmap_file->map_path);
unlink(mca_btl_sm_component.mmap_file->map_path);
}
#if OMPI_ENABLE_PROGRESS_THREADS == 1
/* close/cleanup fifo create for event notification */
if(mca_bmi_sm_component.sm_fifo_fd > 0) {
if(mca_btl_sm_component.sm_fifo_fd > 0) {
/* write a done message down the pipe */
unsigned char cmd = DONE;
if( write(mca_bmi_sm_component.sm_fifo_fd,&cmd,sizeof(cmd)) !=
if( write(mca_btl_sm_component.sm_fifo_fd,&cmd,sizeof(cmd)) !=
sizeof(cmd)){
ompi_output(0, "mca_bmi_sm_component_close: write fifo failed: errno=%d\n",
ompi_output(0, "mca_btl_sm_component_close: write fifo failed: errno=%d\n",
errno);
}
ompi_thread_join(&mca_bmi_sm_component.sm_fifo_thread, NULL);
close(mca_bmi_sm_component.sm_fifo_fd);
unlink(mca_bmi_sm_component.sm_fifo_path);
ompi_thread_join(&mca_btl_sm_component.sm_fifo_thread, NULL);
close(mca_btl_sm_component.sm_fifo_fd);
unlink(mca_btl_sm_component.sm_fifo_path);
}
#endif
@ -215,77 +215,77 @@ CLEANUP:
/*
* SM component initialization
*/
mca_bmi_base_module_t** mca_bmi_sm_component_init(
mca_btl_base_module_t** mca_btl_sm_component_init(
int *num_ptls,
bool enable_progress_threads,
bool enable_mpi_threads)
{
mca_bmi_base_module_t **ptls = NULL;
mca_btl_base_module_t **ptls = NULL;
int i;
*num_ptls = 0;
/* lookup/create shared memory pool only when used */
mca_bmi_sm_component.sm_mpool = NULL;
mca_bmi_sm_component.sm_mpool_base = NULL;
mca_btl_sm_component.sm_mpool = NULL;
mca_btl_sm_component.sm_mpool_base = NULL;
/* publish shared memory parameters with the MCA framework */
if (OMPI_SUCCESS != mca_bmi_sm_component_exchange()) {
if (OMPI_SUCCESS != mca_btl_sm_component_exchange()) {
return NULL;
}
#if OMPI_ENABLE_PROGRESS_THREADS == 1
/* create a named pipe to receive events */
sprintf(mca_bmi_sm_component.sm_fifo_path,
sprintf(mca_btl_sm_component.sm_fifo_path,
"%s/sm_fifo.%d", orte_process_info.job_session_dir,
orte_process_info.my_name->vpid);
if(mkfifo(mca_bmi_sm_component.sm_fifo_path, 0660) < 0) {
ompi_output(0, "mca_bmi_sm_component_init: mkfifo failed with errno=%d\n",errno);
if(mkfifo(mca_btl_sm_component.sm_fifo_path, 0660) < 0) {
ompi_output(0, "mca_btl_sm_component_init: mkfifo failed with errno=%d\n",errno);
return NULL;
}
mca_bmi_sm_component.sm_fifo_fd = open(mca_bmi_sm_component.sm_fifo_path, O_RDWR);
if(mca_bmi_sm_component.sm_fifo_fd < 0) {
ompi_output(0, "mca_bmi_sm_component_init: open(%s) failed with errno=%d\n",
mca_bmi_sm_component.sm_fifo_path, errno);
mca_btl_sm_component.sm_fifo_fd = open(mca_btl_sm_component.sm_fifo_path, O_RDWR);
if(mca_btl_sm_component.sm_fifo_fd < 0) {
ompi_output(0, "mca_btl_sm_component_init: open(%s) failed with errno=%d\n",
mca_btl_sm_component.sm_fifo_path, errno);
return NULL;
}
OBJ_CONSTRUCT(&mca_bmi_sm_component.sm_fifo_thread, ompi_thread_t);
mca_bmi_sm_component.sm_fifo_thread.t_run = (ompi_thread_fn_t) mca_bmi_sm_component_event_thread;
ompi_thread_start(&mca_bmi_sm_component.sm_fifo_thread);
OBJ_CONSTRUCT(&mca_btl_sm_component.sm_fifo_thread, ompi_thread_t);
mca_btl_sm_component.sm_fifo_thread.t_run = (ompi_thread_fn_t) mca_btl_sm_component_event_thread;
ompi_thread_start(&mca_btl_sm_component.sm_fifo_thread);
#endif
/* allocate the Shared Memory PTL */
*num_ptls = 2;
ptls = malloc((*num_ptls)*sizeof(mca_bmi_base_module_t*));
ptls = malloc((*num_ptls)*sizeof(mca_btl_base_module_t*));
if (NULL == ptls) {
return NULL;
}
/* get pointer to the ptls */
ptls[0] = (mca_bmi_base_module_t *)(&(mca_bmi_sm[0]));
ptls[1] = (mca_bmi_base_module_t *)(&(mca_bmi_sm[1]));
ptls[0] = (mca_btl_base_module_t *)(&(mca_btl_sm[0]));
ptls[1] = (mca_btl_base_module_t *)(&(mca_btl_sm[1]));
/* set scheduling parameters */
for( i=0 ; i < 2 ; i++ ) {
mca_bmi_sm[i].super.bmi_eager_limit=mca_bmi_sm_component.eager_limit;
mca_bmi_sm[i].super.bmi_min_send_size=mca_bmi_sm_component.max_frag_size;
mca_bmi_sm[i].super.bmi_max_send_size=mca_bmi_sm_component.max_frag_size;
mca_bmi_sm[i].super.bmi_min_rdma_size=mca_bmi_sm_component.max_frag_size;
mca_bmi_sm[i].super.bmi_max_rdma_size=mca_bmi_sm_component.max_frag_size;
mca_bmi_sm[i].super.bmi_exclusivity=100; /* always use this ptl */
mca_bmi_sm[i].super.bmi_latency=100; /* lowest latency */
mca_bmi_sm[i].super.bmi_bandwidth=900; /* not really used now since exclusivity is set to 100 */
mca_btl_sm[i].super.btl_eager_limit=mca_btl_sm_component.eager_limit;
mca_btl_sm[i].super.btl_min_send_size=mca_btl_sm_component.max_frag_size;
mca_btl_sm[i].super.btl_max_send_size=mca_btl_sm_component.max_frag_size;
mca_btl_sm[i].super.btl_min_rdma_size=mca_btl_sm_component.max_frag_size;
mca_btl_sm[i].super.btl_max_rdma_size=mca_btl_sm_component.max_frag_size;
mca_btl_sm[i].super.btl_exclusivity=100; /* always use this ptl */
mca_btl_sm[i].super.btl_latency=100; /* lowest latency */
mca_btl_sm[i].super.btl_bandwidth=900; /* not really used now since exclusivity is set to 100 */
}
/* initialize some PTL data */
/* start with no SM procs */
mca_bmi_sm_component.num_smp_procs = 0;
mca_bmi_sm_component.my_smp_rank = 0xFFFFFFFF; /* not defined */
mca_btl_sm_component.num_smp_procs = 0;
mca_btl_sm_component.my_smp_rank = 0xFFFFFFFF; /* not defined */
/* set flag indicating ptl not inited */
mca_bmi_sm[0].bmi_inited=false;
mca_bmi_sm[1].bmi_inited=false;
mca_btl_sm[0].btl_inited=false;
mca_btl_sm[1].btl_inited=false;
return ptls;
}
@ -296,11 +296,11 @@ mca_bmi_base_module_t** mca_bmi_sm_component_init(
*/
#if OMPI_ENABLE_PROGRESS_THREADS == 1
void mca_bmi_sm_component_event_thread(ompi_object_t* thread)
void mca_btl_sm_component_event_thread(ompi_object_t* thread)
{
while(1) {
unsigned char cmd;
if(read(mca_bmi_sm_component.sm_fifo_fd, &cmd, sizeof(cmd)) != sizeof(cmd)) {
if(read(mca_btl_sm_component.sm_fifo_fd, &cmd, sizeof(cmd)) != sizeof(cmd)) {
/* error condition */
return;
}
@ -308,19 +308,19 @@ void mca_bmi_sm_component_event_thread(ompi_object_t* thread)
/* return when done message received */
return;
}
mca_bmi_sm_component_progress(0);
mca_btl_sm_component_progress(0);
}
}
#endif
int mca_bmi_sm_component_progress(void)
int mca_btl_sm_component_progress(void)
{
/* local variables */
unsigned int peer_smp_rank ;
mca_bmi_sm_frag_t *frag;
mca_btl_sm_frag_t *frag;
ompi_fifo_t *fifo = NULL;
int my_smp_rank=mca_bmi_sm_component.my_smp_rank;
int my_smp_rank=mca_btl_sm_component.my_smp_rank;
int proc;
int rc = 0;
@ -334,11 +334,11 @@ int mca_bmi_sm_component_progress(void)
/* loop over fifo's - procs with same base shared memory
* virtual address as this process */
for( proc=0 ; proc < mca_bmi_sm_component.num_smp_procs_same_base_addr
for( proc=0 ; proc < mca_btl_sm_component.num_smp_procs_same_base_addr
; proc++ )
{
peer_smp_rank= mca_bmi_sm_component.list_smp_procs_same_base_addr[proc];
fifo=&(mca_bmi_sm_component.fifo[peer_smp_rank][my_smp_rank]);
peer_smp_rank= mca_btl_sm_component.list_smp_procs_same_base_addr[proc];
fifo=&(mca_btl_sm_component.fifo[peer_smp_rank][my_smp_rank]);
/* if fifo is not yet setup - continue - not data has been sent*/
if(OMPI_CB_FREE == fifo->tail){
@ -352,7 +352,7 @@ int mca_bmi_sm_component_progress(void)
/* get pointer - pass in offset to change queue pointer
* addressing from that of the sender */
frag = (mca_bmi_sm_frag_t *)
frag = (mca_btl_sm_frag_t *)
ompi_fifo_read_from_tail_same_base_addr( fifo );
if( OMPI_CB_FREE == frag ) {
/* release thread lock */
@ -369,27 +369,27 @@ int mca_bmi_sm_component_progress(void)
/* dispatch fragment by type */
switch(frag->type) {
case MCA_BMI_SM_FRAG_ACK:
case MCA_BTL_SM_FRAG_ACK:
{
/* completion callback */
frag->base.des_src = frag->base.des_dst;
frag->base.des_src_cnt = frag->base.des_dst_cnt;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->base.des_cbfunc(&mca_bmi_sm[0].super, frag->endpoint, &frag->base, frag->rc);
frag->base.des_cbfunc(&mca_btl_sm[0].super, frag->endpoint, &frag->base, frag->rc);
break;
}
case MCA_BMI_SM_FRAG_SEND:
case MCA_BTL_SM_FRAG_SEND:
{
/* recv upcall */
mca_bmi_sm_recv_reg_t* reg = mca_bmi_sm[0].sm_reg + frag->tag;
mca_btl_sm_recv_reg_t* reg = mca_btl_sm[0].sm_reg + frag->tag;
frag->base.des_dst = frag->base.des_src;
frag->base.des_dst_cnt = frag->base.des_src_cnt;
frag->base.des_src = NULL;
frag->base.des_src_cnt = 0;
reg->cbfunc(&mca_bmi_sm[0].super,frag->tag,&frag->base,reg->cbdata);
frag->type = MCA_BMI_SM_FRAG_ACK;
MCA_BMI_SM_FIFO_WRITE(my_smp_rank,peer_smp_rank,frag,rc);
reg->cbfunc(&mca_btl_sm[0].super,frag->tag,&frag->base,reg->cbdata);
frag->type = MCA_BTL_SM_FRAG_ACK;
MCA_BTL_SM_FIFO_WRITE(my_smp_rank,peer_smp_rank,frag,rc);
if(OMPI_SUCCESS != rc)
return rc;
break;
@ -398,8 +398,8 @@ int mca_bmi_sm_component_progress(void)
{
/* unknown */
frag->rc = OMPI_ERROR;
frag->type = MCA_BMI_SM_FRAG_ACK;
MCA_BMI_SM_FIFO_WRITE(my_smp_rank,peer_smp_rank,frag,rc);
frag->type = MCA_BTL_SM_FRAG_ACK;
MCA_BTL_SM_FIFO_WRITE(my_smp_rank,peer_smp_rank,frag,rc);
if(OMPI_SUCCESS != rc)
return rc;
break;
@ -411,11 +411,11 @@ int mca_bmi_sm_component_progress(void)
/* loop over fifo's - procs with different base shared memory
* virtual address as this process */
for( proc=0 ; proc < mca_bmi_sm_component.num_smp_procs_different_base_addr
for( proc=0 ; proc < mca_btl_sm_component.num_smp_procs_different_base_addr
; proc++ )
{
peer_smp_rank= mca_bmi_sm_component.list_smp_procs_different_base_addr[proc];
fifo=&(mca_bmi_sm_component.fifo[peer_smp_rank][my_smp_rank]);
peer_smp_rank= mca_btl_sm_component.list_smp_procs_different_base_addr[proc];
fifo=&(mca_btl_sm_component.fifo[peer_smp_rank][my_smp_rank]);
/* if fifo is not yet setup - continue - not data has been sent*/
if(OMPI_CB_FREE == fifo->tail){
@ -429,8 +429,8 @@ int mca_bmi_sm_component_progress(void)
/* get pointer - pass in offset to change queue pointer
* addressing from that of the sender */
frag=(mca_bmi_sm_frag_t *)ompi_fifo_read_from_tail( fifo,
mca_bmi_sm_component.sm_offset[peer_smp_rank]);
frag=(mca_btl_sm_frag_t *)ompi_fifo_read_from_tail( fifo,
mca_btl_sm_component.sm_offset[peer_smp_rank]);
if( OMPI_CB_FREE == frag ) {
/* release thread lock */
if( ompi_using_threads() ) {
@ -446,40 +446,40 @@ int mca_bmi_sm_component_progress(void)
/* change the address from address relative to the shared
* memory address, to a true virtual address */
frag = (mca_bmi_sm_frag_t *)( (char *)frag+
mca_bmi_sm_component.sm_offset[peer_smp_rank]);
frag = (mca_btl_sm_frag_t *)( (char *)frag+
mca_btl_sm_component.sm_offset[peer_smp_rank]);
/* dispatch fragment by type */
switch(frag->type) {
case MCA_BMI_SM_FRAG_ACK:
case MCA_BTL_SM_FRAG_ACK:
{
/* completion callback */
frag->base.des_src =
( mca_bmi_base_segment_t* )((unsigned char*)frag->base.des_dst - mca_bmi_sm_component.sm_offset[peer_smp_rank]);
( mca_btl_base_segment_t* )((unsigned char*)frag->base.des_dst - mca_btl_sm_component.sm_offset[peer_smp_rank]);
frag->base.des_src->seg_addr.pval =
((unsigned char*)frag->base.des_src->seg_addr.pval -
mca_bmi_sm_component.sm_offset[peer_smp_rank]);
mca_btl_sm_component.sm_offset[peer_smp_rank]);
frag->base.des_src_cnt = frag->base.des_dst_cnt;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->base.des_cbfunc(&mca_bmi_sm[0].super, frag->endpoint, &frag->base, frag->rc);
frag->base.des_cbfunc(&mca_btl_sm[0].super, frag->endpoint, &frag->base, frag->rc);
break;
}
case MCA_BMI_SM_FRAG_SEND:
case MCA_BTL_SM_FRAG_SEND:
{
/* recv upcall */
mca_bmi_sm_recv_reg_t* reg = mca_bmi_sm[0].sm_reg + frag->tag;
frag->base.des_dst = (mca_bmi_base_segment_t*)
((unsigned char*)frag->base.des_src + mca_bmi_sm_component.sm_offset[peer_smp_rank]);
mca_btl_sm_recv_reg_t* reg = mca_btl_sm[0].sm_reg + frag->tag;
frag->base.des_dst = (mca_btl_base_segment_t*)
((unsigned char*)frag->base.des_src + mca_btl_sm_component.sm_offset[peer_smp_rank]);
frag->base.des_dst->seg_addr.pval =
((unsigned char*)frag->base.des_dst->seg_addr.pval +
mca_bmi_sm_component.sm_offset[peer_smp_rank]);
mca_btl_sm_component.sm_offset[peer_smp_rank]);
frag->base.des_dst_cnt = frag->base.des_src_cnt;
frag->base.des_src = NULL;
frag->base.des_src_cnt = 0;
reg->cbfunc(&mca_bmi_sm[0].super,frag->tag,&frag->base,reg->cbdata);
frag->type = MCA_BMI_SM_FRAG_ACK;
MCA_BMI_SM_FIFO_WRITE(my_smp_rank,peer_smp_rank,frag,rc);
reg->cbfunc(&mca_btl_sm[0].super,frag->tag,&frag->base,reg->cbdata);
frag->type = MCA_BTL_SM_FRAG_ACK;
MCA_BTL_SM_FIFO_WRITE(my_smp_rank,peer_smp_rank,frag,rc);
if(OMPI_SUCCESS != rc)
return rc;
break;
@ -488,8 +488,8 @@ int mca_bmi_sm_component_progress(void)
{
/* unknown */
frag->rc = OMPI_ERROR;
frag->type = MCA_BMI_SM_FRAG_ACK;
MCA_BMI_SM_FIFO_WRITE(my_smp_rank,peer_smp_rank,frag,rc);
frag->type = MCA_BTL_SM_FRAG_ACK;
MCA_BTL_SM_FIFO_WRITE(my_smp_rank,peer_smp_rank,frag,rc);
if(OMPI_SUCCESS != rc)
return rc;
break;
@ -505,9 +505,9 @@ int mca_bmi_sm_component_progress(void)
*
*/
static int mca_bmi_sm_component_exchange()
static int mca_btl_sm_component_exchange()
{
mca_bmi_sm_exchange_t mca_bmi_sm_setup_info;
mca_btl_sm_exchange_t mca_btl_sm_setup_info;
size_t len,size;
char *ptr;
int rc;
@ -519,24 +519,24 @@ static int mca_bmi_sm_component_exchange()
return OMPI_ERROR;
}
/* check if string is too long */
if( MCA_BMI_SM_MAX_HOSTNAME_LEN < (len+1) ){
if( MCA_BTL_SM_MAX_HOSTNAME_LEN < (len+1) ){
return OMPI_ERROR;
}
/* copy string into structure that will be used to send data around */
ptr=NULL;
ptr=strncpy(&(mca_bmi_sm_setup_info.host_name[0]),
ptr=strncpy(&(mca_btl_sm_setup_info.host_name[0]),
orte_system_info.nodename, len);
if( NULL == ptr ) {
return OMPI_ERROR;
}
mca_bmi_sm_setup_info.host_name[len]='\0';
mca_btl_sm_setup_info.host_name[len]='\0';
/* exchange setup information */
size=sizeof(mca_bmi_sm_exchange_t);
rc = mca_base_modex_send(&mca_bmi_sm_component.super.bmi_version,
&mca_bmi_sm_setup_info, size);
size=sizeof(mca_btl_sm_exchange_t);
rc = mca_base_modex_send(&mca_btl_sm_component.super.btl_version,
&mca_btl_sm_setup_info, size);
return OMPI_SUCCESS;
}

Просмотреть файл

@ -16,8 +16,8 @@
/**
* @file
*/
#ifndef MCA_BMI_SM_ENDPOINT_H
#define MCA_BMI_SM_ENDPOINT_H
#ifndef MCA_BTL_SM_ENDPOINT_H
#define MCA_BTL_SM_ENDPOINT_H
#if OMPI_ENABLE_PROGRESS_THREADS == 1
#include "event/event.h"
@ -26,10 +26,10 @@
/**
* An abstraction that represents a connection to a endpoint process.
* An instance of mca_ptl_base_endpoint_t is associated w/ each process
* and BMI pair at startup.
* and BTL pair at startup.
*/
struct mca_bmi_base_endpoint_t {
struct mca_btl_base_endpoint_t {
int my_smp_rank; /**< My SMP process rank. Used for accessing
* SMP specfic data structures. */
int peer_smp_rank; /**< My peer's SMP process rank. Used for accessing

Просмотреть файл

@ -1,14 +1,14 @@
#ifndef MCA_BMI_SM_FIFO_H
#define MCA_BMI_SM_FIFO_H
#ifndef MCA_BTL_SM_FIFO_H
#define MCA_BTL_SM_FIFO_H
#include "bmi_sm.h"
#include "btl_sm.h"
#define MCA_BMI_SM_FIFO_WRITE(my_smp_rank,peer_smp_rank,frag,rc) \
#define MCA_BTL_SM_FIFO_WRITE(my_smp_rank,peer_smp_rank,frag,rc) \
do { \
ompi_fifo_t* fifo; \
fifo=&(mca_bmi_sm_component.fifo[my_smp_rank][peer_smp_rank]); \
fifo=&(mca_btl_sm_component.fifo[my_smp_rank][peer_smp_rank]); \
\
/* thread lock */ \
if(ompi_using_threads()) \
@ -16,12 +16,12 @@ do { \
if(OMPI_CB_FREE == fifo->head) { \
/* no queues have been allocated - allocate now */ \
rc=ompi_fifo_init_same_base_addr( \
mca_bmi_sm_component.size_of_cb_queue, \
mca_bmi_sm_component.cb_lazy_free_freq, \
mca_btl_sm_component.size_of_cb_queue, \
mca_btl_sm_component.cb_lazy_free_freq, \
/* at this stage we are not doing anything with memory \
* locality */ \
0,0,0, \
fifo, mca_bmi_sm_component.sm_mpool); \
fifo, mca_btl_sm_component.sm_mpool); \
if( rc != OMPI_SUCCESS ) { \
if(ompi_using_threads()) \
ompi_atomic_unlock(&(fifo->head_lock)); \
@ -31,9 +31,9 @@ do { \
\
/* post fragment */ \
rc=ompi_fifo_write_to_head_same_base_addr(frag, fifo, \
mca_bmi_sm_component.sm_mpool); \
mca_btl_sm_component.sm_mpool); \
if( 0 <= rc ) { \
MCA_BMI_SM_SIGNAL_PEER(bmi_peer); \
MCA_BTL_SM_SIGNAL_PEER(btl_peer); \
rc=OMPI_SUCCESS; \
} \
if(ompi_using_threads()) \

49
src/mca/btl/sm/btl_sm_frag.c Обычный файл
Просмотреть файл

@ -0,0 +1,49 @@
#include "btl_sm_frag.h"
static inline void mca_btl_sm_frag_constructor(mca_btl_sm_frag_t* frag)
{
frag->segment.seg_addr.pval = frag+1;
frag->segment.seg_len = frag->size;
frag->base.des_src = &frag->segment;
frag->base.des_src_cnt = 1;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
frag->base.des_flags = 0;
}
static void mca_btl_sm_frag1_constructor(mca_btl_sm_frag_t* frag)
{
frag->size = mca_btl_sm_component.eager_limit;
mca_btl_sm_frag_constructor(frag);
}
static void mca_btl_sm_frag2_constructor(mca_btl_sm_frag_t* frag)
{
frag->size = mca_btl_sm_component.max_frag_size;
mca_btl_sm_frag_constructor(frag);
}
static void mca_btl_sm_frag_destructor(mca_btl_sm_frag_t* frag)
{
}
OBJ_CLASS_INSTANCE(
mca_btl_sm_frag_t,
mca_btl_base_descriptor_t,
mca_btl_sm_frag_constructor,
mca_btl_sm_frag_destructor);
OBJ_CLASS_INSTANCE(
mca_btl_sm_frag1_t,
mca_btl_base_descriptor_t,
mca_btl_sm_frag1_constructor,
mca_btl_sm_frag_destructor);
OBJ_CLASS_INSTANCE(
mca_btl_sm_frag2_t,
mca_btl_base_descriptor_t,
mca_btl_sm_frag2_constructor,
mca_btl_sm_frag_destructor);

Просмотреть файл

@ -16,66 +16,66 @@
/**
* @file
*/
#ifndef MCA_BMI_SM_SEND_FRAG_H
#define MCA_BMI_SM_SEND_FRAG_H
#ifndef MCA_BTL_SM_SEND_FRAG_H
#define MCA_BTL_SM_SEND_FRAG_H
#include <sys/types.h>
#include "ompi_config.h"
#include "class/ompi_free_list.h"
#include "bmi_sm.h"
#include "btl_sm.h"
typedef enum {
MCA_BMI_SM_FRAG_SEND,
MCA_BMI_SM_FRAG_PUT,
MCA_BMI_SM_FRAG_GET,
MCA_BMI_SM_FRAG_ACK
} mca_bmi_sm_frag_type_t;
MCA_BTL_SM_FRAG_SEND,
MCA_BTL_SM_FRAG_PUT,
MCA_BTL_SM_FRAG_GET,
MCA_BTL_SM_FRAG_ACK
} mca_btl_sm_frag_type_t;
/**
* shared memory send fragment derived type.
*/
struct mca_bmi_sm_frag_t {
mca_bmi_base_descriptor_t base;
mca_bmi_base_segment_t segment;
struct mca_bmi_base_endpoint_t *endpoint;
mca_bmi_sm_frag_type_t type;
mca_bmi_base_tag_t tag;
struct mca_btl_sm_frag_t {
mca_btl_base_descriptor_t base;
mca_btl_base_segment_t segment;
struct mca_btl_base_endpoint_t *endpoint;
mca_btl_sm_frag_type_t type;
mca_btl_base_tag_t tag;
size_t size;
int rc;
};
typedef struct mca_bmi_sm_frag_t mca_bmi_sm_frag_t;
typedef struct mca_bmi_sm_frag_t mca_bmi_sm_frag1_t;
typedef struct mca_bmi_sm_frag_t mca_bmi_sm_frag2_t;
typedef struct mca_btl_sm_frag_t mca_btl_sm_frag_t;
typedef struct mca_btl_sm_frag_t mca_btl_sm_frag1_t;
typedef struct mca_btl_sm_frag_t mca_btl_sm_frag2_t;
OBJ_CLASS_DECLARATION(mca_bmi_sm_frag_t);
OBJ_CLASS_DECLARATION(mca_bmi_sm_frag1_t);
OBJ_CLASS_DECLARATION(mca_bmi_sm_frag2_t);
OBJ_CLASS_DECLARATION(mca_btl_sm_frag_t);
OBJ_CLASS_DECLARATION(mca_btl_sm_frag1_t);
OBJ_CLASS_DECLARATION(mca_btl_sm_frag2_t);
#define MCA_BMI_SM_FRAG_ALLOC1(frag, rc) \
#define MCA_BTL_SM_FRAG_ALLOC1(frag, rc) \
{ \
ompi_list_item_t* item; \
OMPI_FREE_LIST_WAIT(&mca_bmi_sm_component.sm_frags1, item, rc); \
frag = (mca_bmi_sm_frag_t*)item; \
OMPI_FREE_LIST_WAIT(&mca_btl_sm_component.sm_frags1, item, rc); \
frag = (mca_btl_sm_frag_t*)item; \
}
#define MCA_BMI_SM_FRAG_ALLOC2(frag, rc) \
#define MCA_BTL_SM_FRAG_ALLOC2(frag, rc) \
{ \
ompi_list_item_t* item; \
OMPI_FREE_LIST_WAIT(&mca_bmi_sm_component.sm_frags2, item, rc); \
frag = (mca_bmi_sm_frag_t*)item; \
OMPI_FREE_LIST_WAIT(&mca_btl_sm_component.sm_frags2, item, rc); \
frag = (mca_btl_sm_frag_t*)item; \
}
#define MCA_BMI_SM_FRAG_RETURN1(frag) \
#define MCA_BTL_SM_FRAG_RETURN1(frag) \
{ \
OMPI_FREE_LIST_RETURN(&mca_bmi_sm_component.sm_frags1, (ompi_list_item_t*)(frag)); \
OMPI_FREE_LIST_RETURN(&mca_btl_sm_component.sm_frags1, (ompi_list_item_t*)(frag)); \
}
#define MCA_BMI_SM_FRAG_RETURN2(frag) \
#define MCA_BTL_SM_FRAG_RETURN2(frag) \
{ \
OMPI_FREE_LIST_RETURN(&mca_bmi_sm_component.sm_frags2, (ompi_list_item_t*)(frag)); \
OMPI_FREE_LIST_RETURN(&mca_btl_sm_component.sm_frags2, (ompi_list_item_t*)(frag)); \
}
#endif

Просмотреть файл

@ -17,6 +17,6 @@
# Specific to this module
PARAM_INIT_FILE=bmi_sm.c
PARAM_INIT_FILE=btl_sm.c
PARAM_CONFIG_HEADER_FILE="sm_config.h"
PARAM_CONFIG_FILES="Makefile"

Просмотреть файл

@ -19,38 +19,38 @@
include $(top_ompi_srcdir)/config/Makefile.options
sources = \
bmi_template.c \
bmi_template.h \
bmi_template_component.c \
bmi_template_endpoint.c \
bmi_template_endpoint.h \
bmi_template_frag.c \
bmi_template_frag.h \
bmi_template_proc.c \
bmi_template_proc.h \
bmi_template_error.h
btl_template.c \
btl_template.h \
btl_template_component.c \
btl_template_endpoint.c \
btl_template_endpoint.h \
btl_template_frag.c \
btl_template_frag.h \
btl_template_proc.c \
btl_template_proc.h \
btl_template_error.h
# Make the output lgmrary in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or lgmmca_<type>_<name>.la
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if OMPI_BUILD_bmi_template_DSO
lgm =
lgm_sources =
component = mca_bmi_template.la
if OMPI_BUILD_btl_template_DSO
lib =
lib_sources =
component = mca_btl_template.la
component_sources = $(sources)
else
lgm = lgmmca_bmi_template.la
lgm_sources = $(sources)
lib = libmca_btl_template.la
lib_sources = $(sources)
component =
component_sources =
endif
mcacomponentdir = $(lgmdir)/openmpi
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component)
mca_bmi_template_la_SOURCES = $(component_sources)
mca_bmi_template_la_LDFLAGS = -module -avoid-version
mca_btl_template_la_SOURCES = $(component_sources)
mca_btl_template_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(lgm)
lgmmca_bmi_template_la_SOURCES = $(lgm_sources)
lgmmca_bmi_template_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(lib)
libmca_btl_template_la_SOURCES = $(lib_sources)
libmca_btl_template_la_LDFLAGS = -module -avoid-version

Просмотреть файл

@ -1,58 +0,0 @@
#include "bmi_template_frag.h"
static void mca_bmi_template_frag_common_constructor(mca_bmi_template_frag_t* frag)
{
mca_bmi_template_frag_common_constructor(frag);
frag->base.des_src = NULL;
frag->base.des_src_cnt = 0;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
}
static void mca_bmi_template_frag_eager_constructor(mca_bmi_template_frag_t* frag)
{
frag->registration = NULL;
frag->size = mca_bmi_template_module.super.bmi_eager_limit;
mca_bmi_template_frag_common_constructor(frag);
}
static void mca_bmi_template_frag_max_constructor(mca_bmi_template_frag_t* frag)
{
frag->registration = NULL;
frag->size = mca_bmi_template_module.super.bmi_max_send_size;
mca_bmi_template_frag_common_constructor(frag);
}
static void mca_bmi_template_frag_user_constructor(mca_bmi_template_frag_t* frag)
{
frag->size = 0;
mca_bmi_template_frag_common_constructor(frag);
}
OBJ_CLASS_INSTANCE(
mca_bmi_template_frag_t,
mca_bmi_base_descriptor_t,
NULL,
NULL);
OBJ_CLASS_INSTANCE(
mca_bmi_template_frag_eager_t,
mca_bmi_base_descriptor_t,
mca_bmi_template_frag_eager_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_bmi_template_frag_max_t,
mca_bmi_base_descriptor_t,
mca_bmi_template_frag_max_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_bmi_template_frag_user_t,
mca_bmi_base_descriptor_t,
mca_bmi_template_frag_user_constructor,
NULL);

Просмотреть файл

@ -19,20 +19,20 @@
#include "util/output.h"
#include "util/if.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "mca/btl/btl.h"
#include "bmi_template.h"
#include "bmi_template_frag.h"
#include "bmi_template_proc.h"
#include "bmi_template_endpoint.h"
#include "btl_template.h"
#include "btl_template_frag.h"
#include "btl_template_proc.h"
#include "btl_template_endpoint.h"
#include "datatype/convertor.h"
#include "mca/mpool/base/base.h"
#include "mca/mpool/mpool.h"
mca_bmi_template_module_t mca_bmi_template_module = {
mca_btl_template_module_t mca_btl_template_module = {
{
&mca_bmi_template_component.super,
&mca_btl_template_component.super,
0, /* max size of first fragment */
0, /* min send fragment size */
0, /* max send fragment size */
@ -42,16 +42,16 @@ mca_bmi_template_module_t mca_bmi_template_module = {
0, /* latency */
0, /* bandwidth */
0, /* flags */
mca_bmi_template_add_procs,
mca_bmi_template_del_procs,
mca_bmi_template_register,
mca_bmi_template_finalize,
mca_bmi_template_alloc,
mca_bmi_template_free,
mca_bmi_template_prepare_src,
mca_bmi_template_prepare_dst,
mca_bmi_template_send,
mca_bmi_template_put,
mca_btl_template_add_procs,
mca_btl_template_del_procs,
mca_btl_template_register,
mca_btl_template_finalize,
mca_btl_template_alloc,
mca_btl_template_free,
mca_btl_template_prepare_src,
mca_btl_template_prepare_dst,
mca_btl_template_send,
mca_btl_template_put,
NULL /* get */
}
};
@ -60,23 +60,23 @@ mca_bmi_template_module_t mca_bmi_template_module = {
*
*/
int mca_bmi_template_add_procs(
struct mca_bmi_base_module_t* bmi,
int mca_btl_template_add_procs(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **ompi_procs,
struct mca_bmi_base_endpoint_t** peers,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable)
{
mca_bmi_template_module_t* template_bmi = (mca_bmi_template_module_t*)bmi;
mca_btl_template_module_t* template_btl = (mca_btl_template_module_t*)btl;
int i, rc;
for(i = 0; i < (int) nprocs; i++) {
struct ompi_proc_t* ompi_proc = ompi_procs[i];
mca_bmi_template_proc_t* template_proc;
mca_bmi_base_endpoint_t* template_endpoint;
mca_btl_template_proc_t* template_proc;
mca_btl_base_endpoint_t* template_endpoint;
if(NULL == (template_proc = mca_bmi_template_proc_create(ompi_proc))) {
if(NULL == (template_proc = mca_btl_template_proc_create(ompi_proc))) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
@ -88,18 +88,18 @@ int mca_bmi_template_add_procs(
OMPI_THREAD_LOCK(&template_proc->proc_lock);
/* The bmi_proc datastructure is shared by all TEMPLATE PTL
/* The btl_proc datastructure is shared by all TEMPLATE PTL
* instances that are trying to reach this destination.
* Cache the peer instance on the bmi_proc.
* Cache the peer instance on the btl_proc.
*/
template_endpoint = OBJ_NEW(mca_bmi_template_endpoint_t);
template_endpoint = OBJ_NEW(mca_btl_template_endpoint_t);
if(NULL == template_endpoint) {
OMPI_THREAD_UNLOCK(&module_proc->proc_lock);
return OMPI_ERR_OUT_OF_RESOURCE;
}
template_endpoint->endpoint_bmi = template_bmi;
rc = mca_bmi_template_proc_insert(template_proc, template_endpoint);
template_endpoint->endpoint_btl = template_btl;
rc = mca_btl_template_proc_insert(template_proc, template_endpoint);
if(rc != OMPI_SUCCESS) {
OBJ_RELEASE(template_endpoint);
OMPI_THREAD_UNLOCK(&module_proc->proc_lock);
@ -114,10 +114,10 @@ int mca_bmi_template_add_procs(
return OMPI_SUCCESS;
}
int mca_bmi_template_del_procs(struct mca_bmi_base_module_t* bmi,
int mca_btl_template_del_procs(struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t ** peers)
struct mca_btl_base_endpoint_t ** peers)
{
/* TODO */
return OMPI_SUCCESS;
@ -128,15 +128,15 @@ int mca_bmi_template_del_procs(struct mca_bmi_base_module_t* bmi,
* Register callback function to support send/recv semantics
*/
int mca_bmi_template_register(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_tag_t tag,
mca_bmi_base_module_recv_cb_fn_t cbfunc,
int mca_btl_template_register(
struct mca_btl_base_module_t* btl,
mca_btl_base_tag_t tag,
mca_btl_base_module_recv_cb_fn_t cbfunc,
void* cbdata)
{
mca_bmi_template_module_t* template_bmi = (mca_bmi_template_module_t*) bmi;
template_bmi->template_reg[tag].cbfunc = cbfunc;
template_bmi->template_reg[tag].cbdata = cbdata;
mca_btl_template_module_t* template_btl = (mca_btl_template_module_t*) btl;
template_btl->template_reg[tag].cbfunc = cbfunc;
template_btl->template_reg[tag].cbdata = cbdata;
return OMPI_SUCCESS;
}
@ -144,32 +144,32 @@ int mca_bmi_template_register(
/**
* Allocate a segment.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @param size (IN) Request segment size.
*/
mca_bmi_base_descriptor_t* mca_bmi_template_alloc(
struct mca_bmi_base_module_t* bmi,
mca_btl_base_descriptor_t* mca_btl_template_alloc(
struct mca_btl_base_module_t* btl,
size_t size)
{
mca_bmi_template_module_t* template_bmi = (mca_bmi_template_module_t*) bmi;
mca_bmi_template_frag_t* frag;
mca_btl_template_module_t* template_btl = (mca_btl_template_module_t*) btl;
mca_btl_template_frag_t* frag;
int rc;
if(size <= bmi->bmi_eager_limit){
MCA_BMI_TEMPLATE_FRAG_ALLOC_EAGER(template_bmi, frag, rc);
if(size <= btl->btl_eager_limit){
MCA_BTL_TEMPLATE_FRAG_ALLOC_EAGER(template_btl, frag, rc);
frag->segment.seg_len =
size <= bmi->bmi_eager_limit ?
size : bmi->bmi_eager_limit ;
size <= btl->btl_eager_limit ?
size : btl->btl_eager_limit ;
} else {
MCA_BMI_TEMPLATE_FRAG_ALLOC_MAX(template_bmi, frag, rc);
MCA_BTL_TEMPLATE_FRAG_ALLOC_MAX(template_btl, frag, rc);
frag->segment.seg_len =
size <= bmi->bmi_max_send_size ?
size : bmi->bmi_max_send_size ;
size <= btl->btl_max_send_size ?
size : btl->btl_max_send_size ;
}
frag->base.des_flags = 0;
return (mca_bmi_base_descriptor_t*)frag;
return (mca_btl_base_descriptor_t*)frag;
}
@ -177,20 +177,20 @@ mca_bmi_base_descriptor_t* mca_bmi_template_alloc(
* Return a segment
*/
int mca_bmi_template_free(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_descriptor_t* des)
int mca_btl_template_free(
struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* des)
{
mca_bmi_template_frag_t* frag = (mca_bmi_template_frag_t*)des;
mca_btl_template_frag_t* frag = (mca_btl_template_frag_t*)des;
if(frag->size == 0) {
#if MCA_BMI_HAS_MPOOL
#if MCA_BTL_HAS_MPOOL
OBJ_RELEASE(frag->registration);
#endif
MCA_BMI_TEMPLATE_FRAG_RETURN_USER(bmi, frag);
} else if(frag->size == bmi->bmi_eager_limit){
MCA_BMI_TEMPLATE_FRAG_RETURN_EAGER(bmi, frag);
} else if(frag->size == bmi->bmi_max_send_size) {
MCA_BMI_TEMPLATE_FRAG_RETURN_EAGER(bmi, frag);
MCA_BTL_TEMPLATE_FRAG_RETURN_USER(btl, frag);
} else if(frag->size == btl->btl_eager_limit){
MCA_BTL_TEMPLATE_FRAG_RETURN_EAGER(btl, frag);
} else if(frag->size == btl->btl_max_send_size) {
MCA_BTL_TEMPLATE_FRAG_RETURN_EAGER(btl, frag);
} else {
return OMPI_ERR_BAD_PARAM;
}
@ -201,27 +201,27 @@ int mca_bmi_template_free(
* Pack data and return a descriptor that can be
* used for send/put.
*
* @param bmi (IN) BMI module
* @param peer (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param peer (IN) BTL peer addressing
*/
mca_bmi_base_descriptor_t* mca_bmi_template_prepare_src(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
mca_btl_base_descriptor_t* mca_btl_template_prepare_src(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* endpoint,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size
)
{
mca_bmi_template_module_t* template_bmi = (mca_bmi_template_module_t*)bmi;
mca_bmi_template_frag_t* frag;
mca_btl_template_module_t* template_btl = (mca_btl_template_module_t*)btl;
mca_btl_template_frag_t* frag;
struct iovec iov;
uint32_t iov_count = 1;
size_t max_data = *size;
int32_t free_after;
int rc;
#if MCA_BMI_HAS_MPOOL
#if MCA_BTL_HAS_MPOOL
/*
* If the data has already been pinned and is contigous than we can
* use it in place.
@ -229,7 +229,7 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_src(
if (NULL != registration && 0 == ompi_convertor_need_buffers(convertor)) {
size_t reg_len;
MCA_BMI_TEMPLATE_FRAG_ALLOC_USER(template_bmi, frag, rc);
MCA_BTL_TEMPLATE_FRAG_ALLOC_USER(template_btl, frag, rc);
if(NULL == frag){
return NULL;
}
@ -244,8 +244,9 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_src(
reg_len = (unsigned char*)registration->bound - (unsigned char*)iov.iov_base + 1;
if(frag->segment.seg_len > reg_len) {
mca_mpool_base_module_t* mpool = template_bmi->template_mpool;
size_t new_len = (unsigned char*)iov.iov_base - registration->base + max_data;
mca_mpool_base_module_t* mpool = template_btl->template_mpool;
size_t new_len = (unsigned char*)iov.iov_base -
(unsigned char *) registration->base + max_data;
void* base_addr = registration->base;
/* remove old registration from tree and decrement reference count */
@ -259,7 +260,7 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_src(
new_len,
&registration);
if(rc != OMPI_SUCCESS) {
MCA_BMI_TEMPLATE_FRAG_RETURN_USER(bmi,frag);
MCA_BTL_TEMPLATE_FRAG_RETURN_USER(btl,frag);
return NULL;
}
@ -268,10 +269,10 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_src(
base_addr,
new_len,
mpool,
bmi,
btl,
registration);
if(rc != OMPI_SUCCESS) {
MCA_BMI_TEMPLATE_FRAG_RETURN_USER(bmi,frag);
MCA_BTL_TEMPLATE_FRAG_RETURN_USER(btl,frag);
OBJ_RELEASE(registration);
return NULL;
}
@ -288,12 +289,12 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_src(
* then go ahead and pin contigous data. however, if a reserve is required
* then we must allocated a fragment w/ buffer space
*/
} else if ((mca_bmi_template_component.leave_pinned || max_data > bmi->bmi_max_send_size) &&
} else if ((mca_btl_template_component.leave_pinned || max_data > btl->btl_max_send_size) &&
ompi_convertor_need_buffers(convertor) == 0 &&
reserve == 0) {
mca_mpool_base_module_t* mpool = template_bmi->template_mpool;
MCA_BMI_TEMPLATE_FRAG_ALLOC_USER(template_bmi, frag, rc);
mca_mpool_base_module_t* mpool = template_btl->template_mpool;
MCA_BTL_TEMPLATE_FRAG_ALLOC_USER(template_btl, frag, rc);
if(NULL == frag){
return NULL;
}
@ -311,11 +312,11 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_src(
max_data,
&registration);
if(rc != OMPI_SUCCESS) {
MCA_BMI_TEMPLATE_FRAG_RETURN_USER(bmi,frag);
MCA_BTL_TEMPLATE_FRAG_RETURN_USER(btl,frag);
return NULL;
}
if(mca_bmi_template_component.leave_pinned) {
if(mca_btl_template_component.leave_pinned) {
/*
* insert the registration into the tree and bump the reference
* count so that it doesn't go away on completion.
@ -324,10 +325,10 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_src(
iov.iov_base,
iov.iov_len,
mpool,
bmi,
btl,
registration);
if(rc != OMPI_SUCCESS) {
MCA_BMI_TEMPLATE_FRAG_RETURN_USER(bmi,frag);
MCA_BTL_TEMPLATE_FRAG_RETURN_USER(btl,frag);
OBJ_RELEASE(registration);
return NULL;
}
@ -342,9 +343,9 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_src(
* if we aren't pinning the data and the requested size is less
* than the eager limit pack into a fragment from the eager pool
*/
if (max_data+reserve <= bmi->bmi_eager_limit) {
if (max_data+reserve <= btl->btl_eager_limit) {
MCA_BMI_TEMPLATE_FRAG_ALLOC_EAGER(bmi, frag, rc);
MCA_BTL_TEMPLATE_FRAG_ALLOC_EAGER(btl, frag, rc);
if(NULL == frag) {
return NULL;
}
@ -355,7 +356,7 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_src(
rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data, &free_after);
*size = max_data;
if( rc < 0 ) {
MCA_BMI_TEMPLATE_FRAG_RETURN_EAGER(bmi, frag);
MCA_BTL_TEMPLATE_FRAG_RETURN_EAGER(btl, frag);
return NULL;
}
frag->segment.seg_len = max_data + reserve;
@ -367,7 +368,7 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_src(
*/
else {
MCA_BMI_TEMPLATE_FRAG_ALLOC_MAX(bmi, frag, rc);
MCA_BTL_TEMPLATE_FRAG_ALLOC_MAX(btl, frag, rc);
if(NULL == frag) {
return NULL;
}
@ -381,7 +382,7 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_src(
*size = max_data;
if( rc < 0 ) {
MCA_BMI_TEMPLATE_FRAG_RETURN_MAX(bmi, frag);
MCA_BTL_TEMPLATE_FRAG_RETURN_MAX(btl, frag);
return NULL;
}
frag->segment.seg_len = max_data + reserve;
@ -403,26 +404,26 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_src(
* this routine is responsible for allocating buffer space and
* packing if required.
*
* @param bmi (IN) BMI module
* @param endpoint (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param endpoint (IN) BTL peer addressing
* @param convertor (IN) Data type convertor
* @param reserve (IN) Additional bytes requested by upper layer to precede user data
* @param size (IN/OUT) Number of bytes to prepare (IN), number of bytes actually prepared (OUT)
*/
mca_bmi_base_descriptor_t* mca_bmi_template_prepare_dst(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
mca_btl_base_descriptor_t* mca_btl_template_prepare_dst(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* endpoint,
struct mca_mpool_base_registration_t* registration,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size)
{
mca_bmi_template_module_t* template_bmi = (mca_bmi_template_module_t*) bmi;
mca_bmi_template_frag_t* frag;
mca_btl_template_module_t* template_btl = (mca_btl_template_module_t*) btl;
mca_btl_template_frag_t* frag;
int rc;
MCA_BMI_TEMPLATE_FRAG_ALLOC_USER(bmi, frag, rc);
MCA_BTL_TEMPLATE_FRAG_ALLOC_USER(btl, frag, rc);
if(NULL == frag) {
return NULL;
}
@ -436,12 +437,14 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_dst(
frag->base.des_dst_cnt = 1;
frag->base.des_flags = 0;
#if MCA_BMI_HAS_MPOOL
#if MCA_BTL_HAS_MPOOL
if(NULL != registration) {
size_t reg_len = (unsigned char*)registration->bound - (unsigned char*)frag->segment.seg_addr.pval + 1;
if(frag->segment.seg_len > reg_len) {
mca_mpool_base_module_t* mpool = template_bmi->template_mpool;
size_t new_len = (unsigned char*)frag->segment.seg_addr.pval - registration->base + frag->segment.seg_len;
mca_mpool_base_module_t* mpool = template_btl->template_mpool;
size_t new_len = (unsigned char*)frag->segment.seg_addr.pval -
(unsigned char*) registration->base +
frag->segment.seg_len;
void* base_addr = registration->base;
/* remove old registration from tree and decrement reference count */
@ -455,7 +458,7 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_dst(
new_len,
&registration);
if(rc != OMPI_SUCCESS) {
MCA_BMI_TEMPLATE_FRAG_RETURN_USER(bmi,frag);
MCA_BTL_TEMPLATE_FRAG_RETURN_USER(btl,frag);
return NULL;
}
@ -464,10 +467,10 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_dst(
base_addr,
new_len,
mpool,
bmi,
btl,
registration);
if(rc != OMPI_SUCCESS) {
MCA_BMI_TEMPLATE_FRAG_RETURN_USER(bmi,frag);
MCA_BTL_TEMPLATE_FRAG_RETURN_USER(btl,frag);
OBJ_RELEASE(registration);
return NULL;
}
@ -481,18 +484,18 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_dst(
} else {
mca_mpool_base_module_t* mpool = template_bmi->template_mpool;
mca_mpool_base_module_t* mpool = template_btl->template_mpool;
rc = mpool->mpool_register(
mpool,
frag->segment.seg_addr.pval,
frag->segment.seg_len,
&registration);
if(rc != OMPI_SUCCESS) {
MCA_BMI_TEMPLATE_FRAG_RETURN_USER(bmi,frag);
MCA_BTL_TEMPLATE_FRAG_RETURN_USER(btl,frag);
return NULL;
}
if(mca_bmi_template_component.leave_pinned) {
if(mca_btl_template_component.leave_pinned) {
/*
* insert the registration into the tree and bump the reference
* count so that it doesn't go away on completion.
@ -501,10 +504,10 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_dst(
frag->segment.seg_addr.pval,
frag->segment.seg_len,
mpool,
bmi,
btl,
registration);
if(rc != OMPI_SUCCESS) {
MCA_BMI_TEMPLATE_FRAG_RETURN_USER(bmi,frag);
MCA_BTL_TEMPLATE_FRAG_RETURN_USER(btl,frag);
OBJ_RELEASE(registration);
return NULL;
}
@ -520,21 +523,21 @@ mca_bmi_base_descriptor_t* mca_bmi_template_prepare_dst(
/**
* Initiate an asynchronous send.
*
* @param bmi (IN) BMI module
* @param endpoint (IN) BMI addressing information
* @param btl (IN) BTL module
* @param endpoint (IN) BTL addressing information
* @param descriptor (IN) Description of the data to be transfered
* @param tag (IN) The tag value used to notify the peer.
*/
int mca_bmi_template_send(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* endpoint,
struct mca_bmi_base_descriptor_t* descriptor,
mca_bmi_base_tag_t tag)
int mca_btl_template_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)
{
/* mca_bmi_template_module_t* template_bmi = (mca_bmi_template_module_t*) bmi; */
mca_bmi_template_frag_t* frag = (mca_bmi_template_frag_t*)descriptor;
/* mca_btl_template_module_t* template_btl = (mca_btl_template_module_t*) btl; */
mca_btl_template_frag_t* frag = (mca_btl_template_frag_t*)descriptor;
frag->endpoint = endpoint;
/* TODO */
return OMPI_ERR_NOT_IMPLEMENTED;
@ -544,18 +547,18 @@ int mca_bmi_template_send(
/**
* Initiate an asynchronous put.
*
* @param bmi (IN) BMI module
* @param endpoint (IN) BMI addressing information
* @param btl (IN) BTL module
* @param endpoint (IN) BTL addressing information
* @param descriptor (IN) Description of the data to be transferred
*/
int mca_bmi_template_put(
mca_bmi_base_module_t* bmi,
mca_bmi_base_endpoint_t* endpoint,
mca_bmi_base_descriptor_t* descriptor)
int mca_btl_template_put(
mca_btl_base_module_t* btl,
mca_btl_base_endpoint_t* endpoint,
mca_btl_base_descriptor_t* descriptor)
{
/* mca_bmi_template_module_t* template_bmi = (mca_bmi_template_module_t*) bmi; */
mca_bmi_template_frag_t* frag = (mca_bmi_template_frag_t*) descriptor;
/* mca_btl_template_module_t* template_btl = (mca_btl_template_module_t*) btl; */
mca_btl_template_frag_t* frag = (mca_btl_template_frag_t*) descriptor;
frag->endpoint = endpoint;
/* TODO */
return OMPI_ERR_NOT_IMPLEMENTED;
@ -565,19 +568,19 @@ int mca_bmi_template_put(
/**
* Initiate an asynchronous get.
*
* @param bmi (IN) BMI module
* @param endpoint (IN) BMI addressing information
* @param btl (IN) BTL module
* @param endpoint (IN) BTL addressing information
* @param descriptor (IN) Description of the data to be transferred
*
*/
int mca_bmi_template_get(
mca_bmi_base_module_t* bmi,
mca_bmi_base_endpoint_t* endpoint,
mca_bmi_base_descriptor_t* descriptor)
int mca_btl_template_get(
mca_btl_base_module_t* btl,
mca_btl_base_endpoint_t* endpoint,
mca_btl_base_descriptor_t* descriptor)
{
/* mca_bmi_template_module_t* template_bmi = (mca_bmi_template_module_t*) bmi; */
mca_bmi_template_frag_t* frag = (mca_bmi_template_frag_t*) descriptor;
/* mca_btl_template_module_t* template_btl = (mca_btl_template_module_t*) btl; */
mca_btl_template_frag_t* frag = (mca_btl_template_frag_t*) descriptor;
frag->endpoint = endpoint;
/* TODO */
return OMPI_ERR_NOT_IMPLEMENTED;
@ -588,34 +591,34 @@ int mca_bmi_template_get(
* Cleanup/release module resources.
*/
int mca_bmi_template_finalize(struct mca_bmi_base_module_t* bmi)
int mca_btl_template_finalize(struct mca_btl_base_module_t* btl)
{
mca_bmi_template_module_t* template_bmi = (mca_bmi_template_module_t*) bmi;
mca_btl_template_module_t* template_btl = (mca_btl_template_module_t*) btl;
if(template_bmi->template_frag_eager.fl_num_allocated !=
template_bmi->template_frag_eager.super.ompi_list_length){
ompi_output(0, "bmi template_frag_eager: %d allocated %d returned \n",
template_bmi->template_frag_eager.fl_num_allocated,
template_bmi->template_frag_eager.super.ompi_list_length);
if(template_btl->template_frag_eager.fl_num_allocated !=
template_btl->template_frag_eager.super.ompi_list_length){
ompi_output(0, "btl template_frag_eager: %d allocated %d returned \n",
template_btl->template_frag_eager.fl_num_allocated,
template_btl->template_frag_eager.super.ompi_list_length);
}
if(template_bmi->template_frag_max.fl_num_allocated !=
template_bmi->template_frag_max.super.ompi_list_length) {
ompi_output(0, "bmi template_frag_max: %d allocated %d returned \n",
template_bmi->template_frag_max.fl_num_allocated,
template_bmi->template_frag_max.super.ompi_list_length);
if(template_btl->template_frag_max.fl_num_allocated !=
template_btl->template_frag_max.super.ompi_list_length) {
ompi_output(0, "btl template_frag_max: %d allocated %d returned \n",
template_btl->template_frag_max.fl_num_allocated,
template_btl->template_frag_max.super.ompi_list_length);
}
if(template_bmi->template_frag_user.fl_num_allocated !=
template_bmi->template_frag_user.super.ompi_list_length){
ompi_output(0, "bmi template_frag_user: %d allocated %d returned \n",
template_bmi->template_frag_user.fl_num_allocated,
template_bmi->template_frag_user.super.ompi_list_length);
if(template_btl->template_frag_user.fl_num_allocated !=
template_btl->template_frag_user.super.ompi_list_length){
ompi_output(0, "btl template_frag_user: %d allocated %d returned \n",
template_btl->template_frag_user.fl_num_allocated,
template_btl->template_frag_user.super.ompi_list_length);
}
OBJ_DESTRUCT(&template_bmi->template_lock);
OBJ_DESTRUCT(&template_bmi->template_frag_eager);
OBJ_DESTRUCT(&template_bmi->template_frag_max);
OBJ_DESTRUCT(&template_bmi->template_frag_user);
free(template_bmi);
OBJ_DESTRUCT(&template_btl->template_lock);
OBJ_DESTRUCT(&template_btl->template_frag_eager);
OBJ_DESTRUCT(&template_btl->template_frag_max);
OBJ_DESTRUCT(&template_btl->template_frag_user);
free(template_btl);
return OMPI_SUCCESS;
}

Просмотреть файл

@ -29,30 +29,30 @@
#include "class/ompi_bitmap.h"
#include "event/event.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "mca/bmi/base/base.h"
#include "mca/btl/btl.h"
#include "mca/btl/base/base.h"
#include "util/output.h"
#include "mca/mpool/mpool.h"
#include "mca/bmi/bmi.h"
#include "mca/btl/btl.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
#define MCA_BMI_HAS_MPOOL 1
#define MCA_BTL_HAS_MPOOL 1
/**
* Infiniband (TEMPLATE) BMI component.
* Infiniband (TEMPLATE) BTL component.
*/
struct mca_bmi_template_component_t {
mca_bmi_base_component_1_0_0_t super; /**< base BMI component */
struct mca_btl_template_component_t {
mca_btl_base_component_1_0_0_t super; /**< base BTL component */
uint32_t template_num_bmis;
uint32_t template_num_btls;
/**< number of hcas available to the TEMPLATE component */
struct mca_bmi_template_module_t *template_bmis;
/**< array of available BMI modules */
struct mca_btl_template_module_t *template_btls;
/**< array of available BTL modules */
int template_free_list_num;
/**< initial size of free lists */
@ -75,18 +75,18 @@ struct mca_bmi_template_component_t {
bool leave_pinned;
/**< pin memory on first use and leave pinned */
};
typedef struct mca_bmi_template_component_t mca_bmi_template_component_t;
typedef struct mca_btl_template_component_t mca_btl_template_component_t;
extern mca_bmi_template_component_t mca_bmi_template_component;
extern mca_btl_template_component_t mca_btl_template_component;
/**
* BMI Module Interface
* BTL Module Interface
*/
struct mca_bmi_template_module_t {
mca_bmi_base_module_t super; /**< base BMI interface */
mca_bmi_base_recv_reg_t template_reg[256];
struct mca_btl_template_module_t {
mca_btl_base_module_t super; /**< base BTL interface */
mca_btl_base_recv_reg_t template_reg[256];
/* free list of fragment descriptors */
ompi_free_list_t template_frag_eager;
@ -96,33 +96,33 @@ struct mca_bmi_template_module_t {
/* lock for accessing module state */
ompi_mutex_t template_lock;
#if MCA_BMI_HAS_MPOOL
#if MCA_BTL_HAS_MPOOL
struct mca_mpool_base_module_t* template_mpool;
#endif
};
typedef struct mca_bmi_template_module_t mca_bmi_template_module_t;
extern mca_bmi_template_module_t mca_bmi_template_module;
typedef struct mca_btl_template_module_t mca_btl_template_module_t;
extern mca_btl_template_module_t mca_btl_template_module;
/**
* Register TEMPLATE component parameters with the MCA framework
*/
extern int mca_bmi_template_component_open(void);
extern int mca_btl_template_component_open(void);
/**
* Any final cleanup before being unloaded.
*/
extern int mca_bmi_template_component_close(void);
extern int mca_btl_template_component_close(void);
/**
* TEMPLATE component initialization.
*
* @param num_bmi_modules (OUT) Number of BMIs returned in BMI array.
* @param allow_multi_user_threads (OUT) Flag indicating wether BMI supports user threads (TRUE)
* @param have_hidden_threads (OUT) Flag indicating wether BMI uses threads (TRUE)
* @param num_btl_modules (OUT) Number of BTLs returned in BTL array.
* @param allow_multi_user_threads (OUT) Flag indicating wether BTL supports user threads (TRUE)
* @param have_hidden_threads (OUT) Flag indicating wether BTL uses threads (TRUE)
*/
extern mca_bmi_base_module_t** mca_bmi_template_component_init(
int *num_bmi_modules,
extern mca_btl_base_module_t** mca_btl_template_component_init(
int *num_btl_modules,
bool allow_multi_user_threads,
bool have_hidden_threads
);
@ -131,46 +131,46 @@ extern mca_bmi_base_module_t** mca_bmi_template_component_init(
/**
* TEMPLATE component progress.
*/
extern int mca_bmi_template_component_progress(void);
extern int mca_btl_template_component_progress(void);
/**
* Cleanup any resources held by the BMI.
* Cleanup any resources held by the BTL.
*
* @param bmi BMI instance.
* @param btl BTL instance.
* @return OMPI_SUCCESS or error status on failure.
*/
extern int mca_bmi_template_finalize(
struct mca_bmi_base_module_t* bmi
extern int mca_btl_template_finalize(
struct mca_btl_base_module_t* btl
);
/**
* PML->BMI notification of change in the process list.
* PML->BTL notification of change in the process list.
*
* @param bmi (IN)
* @param btl (IN)
* @param nprocs (IN) Number of processes
* @param procs (IN) Set of processes
* @param peers (OUT) Set of (optional) peer addressing info.
* @param peers (IN/OUT) Set of processes that are reachable via this BMI.
* @param peers (IN/OUT) Set of processes that are reachable via this BTL.
* @return OMPI_SUCCESS or error status on failure.
*
*/
extern int mca_bmi_template_add_procs(
struct mca_bmi_base_module_t* bmi,
extern int mca_btl_template_add_procs(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t** peers,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable
);
/**
* PML->BMI notification of change in the process list.
* PML->BTL notification of change in the process list.
*
* @param bmi (IN) BMI instance
* @param btl (IN) BTL instance
* @param nproc (IN) Number of processes.
* @param procs (IN) Set of processes.
* @param peers (IN) Set of peer data structures.
@ -178,99 +178,99 @@ extern int mca_bmi_template_add_procs(
*
*/
extern int mca_bmi_template_del_procs(
struct mca_bmi_base_module_t* bmi,
extern int mca_btl_template_del_procs(
struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_bmi_base_endpoint_t** peers
struct mca_btl_base_endpoint_t** peers
);
/**
* Initiate an asynchronous send.
*
* @param bmi (IN) BMI module
* @param endpoint (IN) BMI addressing information
* @param btl (IN) BTL module
* @param endpoint (IN) BTL addressing information
* @param descriptor (IN) Description of the data to be transfered
* @param tag (IN) The tag value used to notify the peer.
*/
extern int mca_bmi_template_send(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* bmi_peer,
struct mca_bmi_base_descriptor_t* descriptor,
mca_bmi_base_tag_t tag
extern int mca_btl_template_send(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* btl_peer,
struct mca_btl_base_descriptor_t* descriptor,
mca_btl_base_tag_t tag
);
/**
* Initiate an asynchronous put.
*
* @param bmi (IN) BMI module
* @param endpoint (IN) BMI addressing information
* @param btl (IN) BTL module
* @param endpoint (IN) BTL addressing information
* @param descriptor (IN) Description of the data to be transferred
*/
extern int mca_bmi_template_put(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* bmi_peer,
struct mca_bmi_base_descriptor_t* decriptor
extern int mca_btl_template_put(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* btl_peer,
struct mca_btl_base_descriptor_t* decriptor
);
/**
* Initiate an asynchronous get.
*
* @param bmi (IN) BMI module
* @param endpoint (IN) BMI addressing information
* @param btl (IN) BTL module
* @param endpoint (IN) BTL addressing information
* @param descriptor (IN) Description of the data to be transferred
*/
extern int mca_bmi_template_get(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* bmi_peer,
struct mca_bmi_base_descriptor_t* decriptor
extern int mca_btl_template_get(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* btl_peer,
struct mca_btl_base_descriptor_t* decriptor
);
/**
* Register a callback function that is called on receipt
* of a fragment.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @return Status indicating if registration was successful
*
*/
extern int mca_bmi_template_register(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_tag_t tag,
mca_bmi_base_module_recv_cb_fn_t cbfunc,
extern int mca_btl_template_register(
struct mca_btl_base_module_t* btl,
mca_btl_base_tag_t tag,
mca_btl_base_module_recv_cb_fn_t cbfunc,
void* cbdata);
/**
* Allocate a descriptor with a segment of the requested size.
* Note that the BMI layer may choose to return a smaller size
* Note that the BTL layer may choose to return a smaller size
* if it cannot support the request.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @param size (IN) Request segment size.
*/
extern mca_bmi_base_descriptor_t* mca_bmi_template_alloc(
struct mca_bmi_base_module_t* bmi,
extern mca_btl_base_descriptor_t* mca_btl_template_alloc(
struct mca_btl_base_module_t* btl,
size_t size);
/**
* Return a segment allocated by this BMI.
* Return a segment allocated by this BTL.
*
* @param bmi (IN) BMI module
* @param btl (IN) BTL module
* @param descriptor (IN) Allocated descriptor.
*/
extern int mca_bmi_template_free(
struct mca_bmi_base_module_t* bmi,
mca_bmi_base_descriptor_t* des);
extern int mca_btl_template_free(
struct mca_btl_base_module_t* btl,
mca_btl_base_descriptor_t* des);
/**
@ -280,25 +280,25 @@ extern int mca_bmi_template_free(
* this routine is responsible for allocating buffer space and
* packing if required.
*
* @param bmi (IN) BMI module
* @param endpoint (IN) BMI peer addressing
* @param btl (IN) BTL module
* @param endpoint (IN) BTL peer addressing
* @param convertor (IN) Data type convertor
* @param reserve (IN) Additional bytes requested by upper layer to precede user data
* @param size (IN/OUT) Number of bytes to prepare (IN), number of bytes actually prepared (OUT)
*/
mca_bmi_base_descriptor_t* mca_bmi_template_prepare_src(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* peer,
mca_btl_base_descriptor_t* mca_btl_template_prepare_src(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* peer,
struct mca_mpool_base_registration_t*,
struct ompi_convertor_t* convertor,
size_t reserve,
size_t* size
);
extern mca_bmi_base_descriptor_t* mca_bmi_template_prepare_dst(
struct mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* peer,
extern mca_btl_base_descriptor_t* mca_btl_template_prepare_dst(
struct mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* peer,
struct mca_mpool_base_registration_t*,
struct ompi_convertor_t* convertor,
size_t reserve,

Просмотреть файл

@ -22,18 +22,18 @@
#include "util/argv.h"
#include "util/output.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "mca/btl/btl.h"
#include "mca/base/mca_base_param.h"
#include "mca/base/mca_base_module_exchange.h"
#include "mca/errmgr/errmgr.h"
#include "mca/mpool/base/base.h"
#include "bmi_template.h"
#include "bmi_template_frag.h"
#include "bmi_template_endpoint.h"
#include "mca/bmi/base/base.h"
#include "btl_template.h"
#include "btl_template_frag.h"
#include "btl_template_endpoint.h"
#include "mca/btl/base/base.h"
#include "datatype/convertor.h"
mca_bmi_template_component_t mca_bmi_template_component = {
mca_btl_template_component_t mca_btl_template_component = {
{
/* First, the mca_base_component_t struct containing meta information
about the component itself */
@ -42,14 +42,14 @@ mca_bmi_template_component_t mca_bmi_template_component = {
/* Indicate that we are a pml v1.0.0 component (which also implies a
specific MCA version) */
MCA_BMI_BASE_VERSION_1_0_0,
MCA_BTL_BASE_VERSION_1_0_0,
"ib", /* MCA component name */
1, /* MCA component major version */
0, /* MCA component minor version */
0, /* MCA component release version */
mca_bmi_template_component_open, /* component open */
mca_bmi_template_component_close /* component close */
mca_btl_template_component_open, /* component open */
mca_btl_template_component_close /* component close */
},
/* Next the MCA v1.0.0 component meta data */
@ -60,8 +60,8 @@ mca_bmi_template_component_t mca_bmi_template_component = {
false
},
mca_bmi_template_component_init,
mca_bmi_template_component_progress,
mca_btl_template_component_init,
mca_btl_template_component_progress,
}
};
@ -70,21 +70,21 @@ mca_bmi_template_component_t mca_bmi_template_component = {
* utility routines for parameter registration
*/
static inline char* mca_bmi_template_param_register_string(
static inline char* mca_btl_template_param_register_string(
const char* param_name,
const char* default_value)
{
char *param_value;
int id = mca_base_param_register_string("bmi","ib",param_name,NULL,default_value);
int id = mca_base_param_register_string("btl","ib",param_name,NULL,default_value);
mca_base_param_lookup_string(id, &param_value);
return param_value;
}
static inline int mca_bmi_template_param_register_int(
static inline int mca_btl_template_param_register_int(
const char* param_name,
int default_value)
{
int id = mca_base_param_register_int("bmi","ib",param_name,NULL,default_value);
int id = mca_base_param_register_int("btl","ib",param_name,NULL,default_value);
int param_value = default_value;
mca_base_param_lookup_int(id,&param_value);
return param_value;
@ -95,40 +95,40 @@ static inline int mca_bmi_template_param_register_int(
* component parameters.
*/
int mca_bmi_template_component_open(void)
int mca_btl_template_component_open(void)
{
/* initialize state */
mca_bmi_template_component.template_num_bmis=0;
mca_bmi_template_component.template_bmis=NULL;
mca_btl_template_component.template_num_btls=0;
mca_btl_template_component.template_btls=NULL;
/* initialize objects */
OBJ_CONSTRUCT(&mca_bmi_template_component.template_procs, ompi_list_t);
OBJ_CONSTRUCT(&mca_btl_template_component.template_procs, ompi_list_t);
/* register TEMPLATE component parameters */
mca_bmi_template_component.template_free_list_num =
mca_bmi_template_param_register_int ("free_list_num", 8);
mca_bmi_template_component.template_free_list_max =
mca_bmi_template_param_register_int ("free_list_max", 1024);
mca_bmi_template_component.template_free_list_inc =
mca_bmi_template_param_register_int ("free_list_inc", 32);
mca_bmi_template_component.template_mpool_name =
mca_bmi_template_param_register_string("mpool", "ib");
mca_bmi_template_module.super.bmi_exclusivity =
mca_bmi_template_param_register_int ("exclusivity", 0);
mca_bmi_template_module.super.bmi_eager_limit =
mca_bmi_template_param_register_int ("first_frag_size", 64*1024) - sizeof(mca_bmi_base_header_t);
mca_bmi_template_module.super.bmi_min_send_size =
mca_bmi_template_param_register_int ("min_send_size", 64*1024) - sizeof(mca_bmi_base_header_t);
mca_bmi_template_module.super.bmi_max_send_size =
mca_bmi_template_param_register_int ("max_send_size", 128*1024) - sizeof(mca_bmi_base_header_t);
mca_bmi_template_module.super.bmi_min_rdma_size =
mca_bmi_template_param_register_int("min_rdma_size", 1024*1024);
mca_bmi_template_module.super.bmi_max_rdma_size =
mca_bmi_template_param_register_int("max_rdma_size", 1024*1024);
mca_bmi_template_module.super.bmi_flags =
mca_bmi_template_param_register_int("flags", MCA_BMI_FLAGS_RDMA);
mca_btl_template_component.template_free_list_num =
mca_btl_template_param_register_int ("free_list_num", 8);
mca_btl_template_component.template_free_list_max =
mca_btl_template_param_register_int ("free_list_max", 1024);
mca_btl_template_component.template_free_list_inc =
mca_btl_template_param_register_int ("free_list_inc", 32);
mca_btl_template_component.template_mpool_name =
mca_btl_template_param_register_string("mpool", "ib");
mca_btl_template_module.super.btl_exclusivity =
mca_btl_template_param_register_int ("exclusivity", 0);
mca_btl_template_module.super.btl_eager_limit =
mca_btl_template_param_register_int ("first_frag_size", 64*1024) - sizeof(mca_btl_base_header_t);
mca_btl_template_module.super.btl_min_send_size =
mca_btl_template_param_register_int ("min_send_size", 64*1024) - sizeof(mca_btl_base_header_t);
mca_btl_template_module.super.btl_max_send_size =
mca_btl_template_param_register_int ("max_send_size", 128*1024) - sizeof(mca_btl_base_header_t);
mca_btl_template_module.super.btl_min_rdma_size =
mca_btl_template_param_register_int("min_rdma_size", 1024*1024);
mca_btl_template_module.super.btl_max_rdma_size =
mca_btl_template_param_register_int("max_rdma_size", 1024*1024);
mca_btl_template_module.super.btl_flags =
mca_btl_template_param_register_int("flags", MCA_BTL_FLAGS_RDMA);
return OMPI_SUCCESS;
}
@ -136,7 +136,7 @@ int mca_bmi_template_component_open(void)
* component cleanup - sanity checking of queue lengths
*/
int mca_bmi_template_component_close(void)
int mca_btl_template_component_close(void)
{
return OMPI_SUCCESS;
}
@ -144,12 +144,12 @@ int mca_bmi_template_component_close(void)
/*
* TEMPLATE component initialization:
* (1) read interface list from kernel and compare against component parameters
* then create a BMI instance for selected interfaces
* then create a BTL instance for selected interfaces
* (2) setup TEMPLATE listen socket for incoming connection attempts
* (3) register BMI parameters with the MCA
* (3) register BTL parameters with the MCA
*/
mca_bmi_base_module_t** mca_bmi_template_component_init(int *num_bmi_modules,
mca_btl_base_module_t** mca_btl_template_component_init(int *num_btl_modules,
bool enable_progress_threads,
bool enable_mpi_threads)
{
@ -161,7 +161,7 @@ mca_bmi_base_module_t** mca_bmi_template_component_init(int *num_bmi_modules,
*/
int mca_bmi_template_component_progress()
int mca_btl_template_component_progress()
{
return 0;
}

Просмотреть файл

@ -24,10 +24,10 @@
#include "mca/rml/rml.h"
#include "mca/errmgr/errmgr.h"
#include "dps/dps.h"
#include "bmi_template.h"
#include "bmi_template_endpoint.h"
#include "bmi_template_proc.h"
#include "bmi_template_frag.h"
#include "btl_template.h"
#include "btl_template_endpoint.h"
#include "btl_template_proc.h"
#include "btl_template_frag.h"
/*
@ -35,9 +35,9 @@
*
*/
static void mca_bmi_template_endpoint_construct(mca_bmi_base_endpoint_t* endpoint)
static void mca_btl_template_endpoint_construct(mca_btl_base_endpoint_t* endpoint)
{
endpoint->endpoint_bmi = 0;
endpoint->endpoint_btl = 0;
endpoint->endpoint_proc = 0;
}
@ -46,14 +46,14 @@ static void mca_bmi_template_endpoint_construct(mca_bmi_base_endpoint_t* endpoin
*
*/
static void mca_bmi_template_endpoint_destruct(mca_bmi_base_endpoint_t* endpoint)
static void mca_btl_template_endpoint_destruct(mca_btl_base_endpoint_t* endpoint)
{
}
OBJ_CLASS_INSTANCE(
mca_bmi_template_endpoint_t,
mca_btl_template_endpoint_t,
ompi_list_item_t,
mca_bmi_template_endpoint_construct,
mca_bmi_template_endpoint_destruct);
mca_btl_template_endpoint_construct,
mca_btl_template_endpoint_destruct);

Просмотреть файл

@ -14,40 +14,40 @@
* $HEADER$
*/
#ifndef MCA_BMI_TEMPLATE_ENDPOINT_H
#define MCA_BMI_TEMPLATE_ENDPOINT_H
#ifndef MCA_BTL_TEMPLATE_ENDPOINT_H
#define MCA_BTL_TEMPLATE_ENDPOINT_H
#include "class/ompi_list.h"
#include "event/event.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "bmi_template_frag.h"
#include "bmi_template.h"
#include "mca/btl/btl.h"
#include "btl_template_frag.h"
#include "btl_template.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
OBJ_CLASS_DECLARATION(mca_bmi_template_endpoint_t);
OBJ_CLASS_DECLARATION(mca_btl_template_endpoint_t);
/**
* An abstraction that represents a connection to a endpoint process.
* An instance of mca_bmi_base_endpoint_t is associated w/ each process
* and BMI pair at startup. However, connections to the endpoint
* An instance of mca_btl_base_endpoint_t is associated w/ each process
* and BTL pair at startup. However, connections to the endpoint
* are established dynamically on an as-needed basis:
*/
struct mca_bmi_base_endpoint_t {
struct mca_btl_base_endpoint_t {
ompi_list_item_t super;
struct mca_bmi_template_module_t* endpoint_bmi;
/**< BMI instance that created this connection */
struct mca_btl_template_module_t* endpoint_btl;
/**< BTL instance that created this connection */
struct mca_bmi_template_proc_t* endpoint_proc;
struct mca_btl_template_proc_t* endpoint_proc;
/**< proc structure corresponding to endpoint */
};
typedef struct mca_bmi_base_endpoint_t mca_bmi_base_endpoint_t;
typedef mca_bmi_base_endpoint_t mca_bmi_template_endpoint_t;
typedef struct mca_btl_base_endpoint_t mca_btl_base_endpoint_t;
typedef mca_btl_base_endpoint_t mca_btl_template_endpoint_t;
#if defined(c_plusplus) || defined(__cplusplus)

58
src/mca/btl/template/btl_template_frag.c Обычный файл
Просмотреть файл

@ -0,0 +1,58 @@
#include "btl_template_frag.h"
static void mca_btl_template_frag_common_constructor(mca_btl_template_frag_t* frag)
{
mca_btl_template_frag_common_constructor(frag);
frag->base.des_src = NULL;
frag->base.des_src_cnt = 0;
frag->base.des_dst = NULL;
frag->base.des_dst_cnt = 0;
}
static void mca_btl_template_frag_eager_constructor(mca_btl_template_frag_t* frag)
{
frag->registration = NULL;
frag->size = mca_btl_template_module.super.btl_eager_limit;
mca_btl_template_frag_common_constructor(frag);
}
static void mca_btl_template_frag_max_constructor(mca_btl_template_frag_t* frag)
{
frag->registration = NULL;
frag->size = mca_btl_template_module.super.btl_max_send_size;
mca_btl_template_frag_common_constructor(frag);
}
static void mca_btl_template_frag_user_constructor(mca_btl_template_frag_t* frag)
{
frag->size = 0;
mca_btl_template_frag_common_constructor(frag);
}
OBJ_CLASS_INSTANCE(
mca_btl_template_frag_t,
mca_btl_base_descriptor_t,
NULL,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_template_frag_eager_t,
mca_btl_base_descriptor_t,
mca_btl_template_frag_eager_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_template_frag_max_t,
mca_btl_base_descriptor_t,
mca_btl_template_frag_max_constructor,
NULL);
OBJ_CLASS_INSTANCE(
mca_btl_template_frag_user_t,
mca_btl_base_descriptor_t,
mca_btl_template_frag_user_constructor,
NULL);

Просмотреть файл

@ -14,49 +14,49 @@
* $HEADER$
*/
#ifndef MCA_BMI_TEMPLATE_FRAG_H
#define MCA_BMI_TEMPLATE_FRAG_H
#ifndef MCA_BTL_TEMPLATE_FRAG_H
#define MCA_BTL_TEMPLATE_FRAG_H
#define MCA_BMI_TEMPLATE_FRAG_ALIGN (8)
#define MCA_BTL_TEMPLATE_FRAG_ALIGN (8)
#include "ompi_config.h"
#include "bmi_template.h"
#include "btl_template.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_bmi_template_frag_t);
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_btl_template_frag_t);
/**
* TEMPLATE send fratemplateent derived type.
*/
struct mca_bmi_template_frag_t {
mca_bmi_base_descriptor_t base;
mca_bmi_base_segment_t segment;
struct mca_bmi_base_endpoint_t *endpoint;
mca_bmi_base_header_t *hdr;
struct mca_btl_template_frag_t {
mca_btl_base_descriptor_t base;
mca_btl_base_segment_t segment;
struct mca_btl_base_endpoint_t *endpoint;
mca_btl_base_header_t *hdr;
size_t size;
#if MCA_BMI_HAS_MPOOL
#if MCA_BTL_HAS_MPOOL
struct mca_mpool_base_registration_t* registration;
#endif
};
typedef struct mca_bmi_template_frag_t mca_bmi_template_frag_t;
OBJ_CLASS_DECLARATION(mca_bmi_template_frag_t);
typedef struct mca_btl_template_frag_t mca_btl_template_frag_t;
OBJ_CLASS_DECLARATION(mca_btl_template_frag_t);
typedef struct mca_bmi_template_frag_t mca_bmi_template_frag_eager_t;
typedef struct mca_btl_template_frag_t mca_btl_template_frag_eager_t;
OBJ_CLASS_DECLARATION(mca_bmi_template_frag_eager_t);
OBJ_CLASS_DECLARATION(mca_btl_template_frag_eager_t);
typedef struct mca_bmi_template_frag_t mca_bmi_template_frag_max_t;
typedef struct mca_btl_template_frag_t mca_btl_template_frag_max_t;
OBJ_CLASS_DECLARATION(mca_bmi_template_frag_max_t);
OBJ_CLASS_DECLARATION(mca_btl_template_frag_max_t);
typedef struct mca_bmi_template_frag_t mca_bmi_template_frag_user_t;
typedef struct mca_btl_template_frag_t mca_btl_template_frag_user_t;
OBJ_CLASS_DECLARATION(mca_bmi_template_frag_user_t);
OBJ_CLASS_DECLARATION(mca_btl_template_frag_user_t);
/*
@ -64,45 +64,45 @@ OBJ_CLASS_DECLARATION(mca_bmi_template_frag_user_t);
* free list(s).
*/
#define MCA_BMI_TEMPLATE_FRAG_ALLOC_EAGER(bmi, frag, rc) \
#define MCA_BTL_TEMPLATE_FRAG_ALLOC_EAGER(btl, frag, rc) \
{ \
\
ompi_list_item_t *item; \
OMPI_FREE_LIST_WAIT(&((mca_bmi_template_module_t*)bmi)->template_frag_eager, item, rc); \
frag = (mca_bmi_template_frag_t*) item; \
OMPI_FREE_LIST_WAIT(&((mca_btl_template_module_t*)btl)->template_frag_eager, item, rc); \
frag = (mca_btl_template_frag_t*) item; \
}
#define MCA_BMI_TEMPLATE_FRAG_RETURN_EAGER(bmi, frag) \
#define MCA_BTL_TEMPLATE_FRAG_RETURN_EAGER(btl, frag) \
{ \
OMPI_FREE_LIST_RETURN(&((mca_bmi_template_module_t*)bmi)->template_frag_eager, \
OMPI_FREE_LIST_RETURN(&((mca_btl_template_module_t*)btl)->template_frag_eager, \
(ompi_list_item_t*)(frag)); \
}
#define MCA_BMI_TEMPLATE_FRAG_ALLOC_MAX(bmi, frag, rc) \
#define MCA_BTL_TEMPLATE_FRAG_ALLOC_MAX(btl, frag, rc) \
{ \
\
ompi_list_item_t *item; \
OMPI_FREE_LIST_WAIT(&((mca_bmi_template_module_t*)bmi)->template_frag_max, item, rc); \
frag = (mca_bmi_template_frag_t*) item; \
OMPI_FREE_LIST_WAIT(&((mca_btl_template_module_t*)btl)->template_frag_max, item, rc); \
frag = (mca_btl_template_frag_t*) item; \
}
#define MCA_BMI_TEMPLATE_FRAG_RETURN_MAX(bmi, frag) \
#define MCA_BTL_TEMPLATE_FRAG_RETURN_MAX(btl, frag) \
{ \
OMPI_FREE_LIST_RETURN(&((mca_bmi_template_module_t*)bmi)->template_frag_max, \
OMPI_FREE_LIST_RETURN(&((mca_btl_template_module_t*)btl)->template_frag_max, \
(ompi_list_item_t*)(frag)); \
}
#define MCA_BMI_TEMPLATE_FRAG_ALLOC_USER(bmi, frag, rc) \
#define MCA_BTL_TEMPLATE_FRAG_ALLOC_USER(btl, frag, rc) \
{ \
ompi_list_item_t *item; \
OMPI_FREE_LIST_WAIT(&((mca_bmi_template_module_t*)bmi)->template_frag_user, item, rc); \
frag = (mca_bmi_template_frag_t*) item; \
OMPI_FREE_LIST_WAIT(&((mca_btl_template_module_t*)btl)->template_frag_user, item, rc); \
frag = (mca_btl_template_frag_t*) item; \
}
#define MCA_BMI_TEMPLATE_FRAG_RETURN_USER(bmi, frag) \
#define MCA_BTL_TEMPLATE_FRAG_RETURN_USER(btl, frag) \
{ \
OMPI_FREE_LIST_RETURN(&((mca_bmi_template_module_t*)bmi)->template_frag_user, \
OMPI_FREE_LIST_RETURN(&((mca_btl_template_module_t*)btl)->template_frag_user, \
(ompi_list_item_t*)(frag)); \
}

Просмотреть файл

@ -19,17 +19,17 @@
#include "class/ompi_hash_table.h"
#include "mca/base/mca_base_module_exchange.h"
#include "bmi_template.h"
#include "bmi_template_proc.h"
#include "btl_template.h"
#include "btl_template_proc.h"
static void mca_bmi_template_proc_construct(mca_bmi_template_proc_t* proc);
static void mca_bmi_template_proc_destruct(mca_bmi_template_proc_t* proc);
static void mca_btl_template_proc_construct(mca_btl_template_proc_t* proc);
static void mca_btl_template_proc_destruct(mca_btl_template_proc_t* proc);
OBJ_CLASS_INSTANCE(mca_bmi_template_proc_t,
ompi_list_item_t, mca_bmi_template_proc_construct,
mca_bmi_template_proc_destruct);
OBJ_CLASS_INSTANCE(mca_btl_template_proc_t,
ompi_list_item_t, mca_btl_template_proc_construct,
mca_btl_template_proc_destruct);
void mca_bmi_template_proc_construct(mca_bmi_template_proc_t* proc)
void mca_btl_template_proc_construct(mca_btl_template_proc_t* proc)
{
proc->proc_ompi = 0;
proc->proc_addr_count = 0;
@ -37,21 +37,21 @@ void mca_bmi_template_proc_construct(mca_bmi_template_proc_t* proc)
proc->proc_endpoint_count = 0;
OBJ_CONSTRUCT(&proc->proc_lock, ompi_mutex_t);
/* add to list of all proc instance */
OMPI_THREAD_LOCK(&mca_bmi_template_component.template_lock);
ompi_list_append(&mca_bmi_template_component.template_procs, &proc->super);
OMPI_THREAD_UNLOCK(&mca_bmi_template_component.template_lock);
OMPI_THREAD_LOCK(&mca_btl_template_component.template_lock);
ompi_list_append(&mca_btl_template_component.template_procs, &proc->super);
OMPI_THREAD_UNLOCK(&mca_btl_template_component.template_lock);
}
/*
* Cleanup ib proc instance
*/
void mca_bmi_template_proc_destruct(mca_bmi_template_proc_t* proc)
void mca_btl_template_proc_destruct(mca_btl_template_proc_t* proc)
{
/* remove from list of all proc instances */
OMPI_THREAD_LOCK(&mca_bmi_template_component.template_lock);
ompi_list_remove_item(&mca_bmi_template_component.template_procs, &proc->super);
OMPI_THREAD_UNLOCK(&mca_bmi_template_component.template_lock);
OMPI_THREAD_LOCK(&mca_btl_template_component.template_lock);
ompi_list_remove_item(&mca_btl_template_component.template_procs, &proc->super);
OMPI_THREAD_UNLOCK(&mca_btl_template_component.template_lock);
/* release resources */
if(NULL != proc->proc_endpoints) {
@ -64,45 +64,45 @@ void mca_bmi_template_proc_destruct(mca_bmi_template_proc_t* proc)
* Look for an existing TEMPLATE process instances based on the associated
* ompi_proc_t instance.
*/
static mca_bmi_template_proc_t* mca_bmi_template_proc_lookup_ompi(ompi_proc_t* ompi_proc)
static mca_btl_template_proc_t* mca_btl_template_proc_lookup_ompi(ompi_proc_t* ompi_proc)
{
mca_bmi_template_proc_t* template_proc;
mca_btl_template_proc_t* template_proc;
OMPI_THREAD_LOCK(&mca_bmi_template_component.template_lock);
OMPI_THREAD_LOCK(&mca_btl_template_component.template_lock);
for(template_proc = (mca_bmi_template_proc_t*)
ompi_list_get_first(&mca_bmi_template_component.template_procs);
template_proc != (mca_bmi_template_proc_t*)
ompi_list_get_end(&mca_bmi_template_component.template_procs);
template_proc = (mca_bmi_template_proc_t*)ompi_list_get_next(template_proc)) {
for(template_proc = (mca_btl_template_proc_t*)
ompi_list_get_first(&mca_btl_template_component.template_procs);
template_proc != (mca_btl_template_proc_t*)
ompi_list_get_end(&mca_btl_template_component.template_procs);
template_proc = (mca_btl_template_proc_t*)ompi_list_get_next(template_proc)) {
if(template_proc->proc_ompi == ompi_proc) {
OMPI_THREAD_UNLOCK(&mca_bmi_template_component.template_lock);
OMPI_THREAD_UNLOCK(&mca_btl_template_component.template_lock);
return template_proc;
}
}
OMPI_THREAD_UNLOCK(&mca_bmi_template_component.template_lock);
OMPI_THREAD_UNLOCK(&mca_btl_template_component.template_lock);
return NULL;
}
/*
* Create a TEMPLATE process structure. There is a one-to-one correspondence
* between a ompi_proc_t and a mca_bmi_template_proc_t instance. We cache
* additional data (specifically the list of mca_bmi_template_endpoint_t instances,
* between a ompi_proc_t and a mca_btl_template_proc_t instance. We cache
* additional data (specifically the list of mca_btl_template_endpoint_t instances,
* and published addresses) associated w/ a given destination on this
* datastructure.
*/
mca_bmi_template_proc_t* mca_bmi_template_proc_create(ompi_proc_t* ompi_proc)
mca_btl_template_proc_t* mca_btl_template_proc_create(ompi_proc_t* ompi_proc)
{
mca_bmi_template_proc_t* module_proc = NULL;
mca_btl_template_proc_t* module_proc = NULL;
/* Check if we have already created a TEMPLATE proc
* structure for this ompi process */
module_proc = mca_bmi_template_proc_lookup_ompi(ompi_proc);
module_proc = mca_btl_template_proc_lookup_ompi(ompi_proc);
if(module_proc != NULL) {
@ -113,7 +113,7 @@ mca_bmi_template_proc_t* mca_bmi_template_proc_create(ompi_proc_t* ompi_proc)
/* Oops! First time, gotta create a new TEMPLATE proc
* out of the ompi_proc ... */
module_proc = OBJ_NEW(mca_bmi_template_proc_t);
module_proc = OBJ_NEW(mca_btl_template_proc_t);
/* Initialize number of peer */
module_proc->proc_endpoint_count = 0;
@ -130,11 +130,11 @@ mca_bmi_template_proc_t* mca_bmi_template_proc_create(ompi_proc_t* ompi_proc)
/* XXX: Right now, there can be only 1 peer associated
* with a proc. Needs a little bit change in
* mca_bmi_template_proc_t to allow on demand increasing of
* mca_btl_template_proc_t to allow on demand increasing of
* number of endpoints for this proc */
module_proc->proc_endpoints = (mca_bmi_base_endpoint_t**)
malloc(module_proc->proc_addr_count * sizeof(mca_bmi_base_endpoint_t*));
module_proc->proc_endpoints = (mca_btl_base_endpoint_t**)
malloc(module_proc->proc_addr_count * sizeof(mca_btl_base_endpoint_t*));
if(NULL == module_proc->proc_endpoints) {
OBJ_RELEASE(module_proc);
@ -146,11 +146,11 @@ mca_bmi_template_proc_t* mca_bmi_template_proc_create(ompi_proc_t* ompi_proc)
/*
* Note that this routine must be called with the lock on the process
* already held. Insert a bmi instance into the proc array and assign
* already held. Insert a btl instance into the proc array and assign
* it an address.
*/
int mca_bmi_template_proc_insert(mca_bmi_template_proc_t* module_proc,
mca_bmi_base_endpoint_t* module_endpoint)
int mca_btl_template_proc_insert(mca_btl_template_proc_t* module_proc,
mca_btl_base_endpoint_t* module_endpoint)
{
/* insert into endpoint array */
module_endpoint->endpoint_proc = module_proc;

Просмотреть файл

@ -14,27 +14,27 @@
* $HEADER$
*/
#ifndef MCA_BMI_TEMPLATE_PROC_H
#define MCA_BMI_TEMPLATE_PROC_H
#ifndef MCA_BTL_TEMPLATE_PROC_H
#define MCA_BTL_TEMPLATE_PROC_H
#include "mca/ns/ns.h"
#include "class/ompi_object.h"
#include "proc/proc.h"
#include "bmi_template.h"
#include "bmi_template_endpoint.h"
#include "btl_template.h"
#include "btl_template_endpoint.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
OBJ_CLASS_DECLARATION(mca_bmi_template_proc_t);
OBJ_CLASS_DECLARATION(mca_btl_template_proc_t);
/**
* Represents the state of a remote process and the set of addresses
* that it exports. Also cache an instance of mca_bmi_base_endpoint_t for
* that it exports. Also cache an instance of mca_btl_base_endpoint_t for
* each
* BMI instance that attempts to open a connection to the process.
* BTL instance that attempts to open a connection to the process.
*/
struct mca_bmi_template_proc_t {
struct mca_btl_template_proc_t {
ompi_list_item_t super;
/**< allow proc to be placed on a list */
@ -47,7 +47,7 @@ struct mca_bmi_template_proc_t {
size_t proc_addr_count;
/**< number of addresses published by endpoint */
struct mca_bmi_base_endpoint_t **proc_endpoints;
struct mca_btl_base_endpoint_t **proc_endpoints;
/**< array of endpoints that have been created to access this proc */
size_t proc_endpoint_count;
@ -56,10 +56,10 @@ struct mca_bmi_template_proc_t {
ompi_mutex_t proc_lock;
/**< lock to protect against concurrent access to proc state */
};
typedef struct mca_bmi_template_proc_t mca_bmi_template_proc_t;
typedef struct mca_btl_template_proc_t mca_btl_template_proc_t;
mca_bmi_template_proc_t* mca_bmi_template_proc_create(ompi_proc_t* ompi_proc);
int mca_bmi_template_proc_insert(mca_bmi_template_proc_t*, mca_bmi_base_endpoint_t*);
mca_btl_template_proc_t* mca_btl_template_proc_create(ompi_proc_t* ompi_proc);
int mca_btl_template_proc_insert(mca_btl_template_proc_t*, mca_btl_base_endpoint_t*);
#if defined(c_plusplus) || defined(__cplusplus)
}

Просмотреть файл

@ -17,6 +17,6 @@
# Specific to this module
PARAM_INIT_FILE=bmi_template.c
PARAM_INIT_FILE=btl_template.c
PARAM_CONFIG_HEADER_FILE="template_config.h"
PARAM_CONFIG_FILES="Makefile"

Просмотреть файл

@ -29,6 +29,8 @@ struct mca_mpool_base_resources_t;
struct mca_mpool_base_registration_t{
ompi_list_item_t super;
struct mca_mpool_base_module_t *mpool;
void* base;
void* bound;
};
typedef struct mca_mpool_base_registration_t mca_mpool_base_registration_t;

Просмотреть файл

@ -17,6 +17,6 @@
# Specific to this module
PARAM_INIT_FILE=mpool_sm.c
PARAM_INIT_FILE=mpool_sm_component.c
PARAM_CONFIG_HEADER_FILE="sm_config.h"
PARAM_CONFIG_FILES="Makefile"

Просмотреть файл

@ -17,16 +17,6 @@
# Specific to this module
PARAM_INIT_FILE=mpool_vapi_module.c
PARAM_INIT_FILE=mpool_vapi_component.c
PARAM_CONFIG_HEADER_FILE="vapi_config.h"
PARAM_CONFIG_FILES="Makefile"

Просмотреть файл

@ -4,8 +4,6 @@
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004 The Ohio State University.
# 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.
@ -25,29 +23,29 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
# Additional --with flags that can be specified
AC_ARG_WITH(bmi-ib,
AC_HELP_STRING([--with-bmi-ib=IBDIR],
AC_ARG_WITH(btl-mvapi,
AC_HELP_STRING([--with-btl-mvapi=IBDIR],
[Specify the installation directory of IB (should enable the correct automatic determination of using the 32 or 64 bit library, if both are present under IBDIR/lib and IBDIR/lib64)]))
AC_ARG_WITH(bmi-ib-libdir,
AC_HELP_STRING([--with-bmi-ib-libdir=IBLIBDIR],
AC_ARG_WITH(btl-mvapi-libdir,
AC_HELP_STRING([--with-btl-mvapi-libdir=IBLIBDIR],
[directory where the IB library can be found, if it is not in $IBDIR/lib or $IBDIR/lib64]))
# Quick sanity check
if test "$with_bmi_ib" = "no"; then
AC_MSG_WARN([*** --without-bmi-ib specified -- aborting])
if test "$with_btl_mvapi" = "no"; then
AC_MSG_WARN([*** --without-btl-mvapi specified -- aborting])
AC_MSG_ERROR([Will not continue])
fi
# Find the right IBDIR
if test "$with_bmi_ib" != "" -a "$with_bmi_ib" != "yes" ; then
IBDIR="$with_bmi_ib"
IBLIBDIR="$with_bmi_ib"
if test "$with_btl_mvapi" != "" -a "$with_btl_mvapi" != "yes" ; then
IBDIR="$with_btl_mvapi"
IBLIBDIR="$with_btl_mvapi"
fi
if test "$with_bmi_ib_libdir" != "" -a "$with_bmi_ib_libdir" != "yes" -a \
"$with_bmi_ib_libdir" != "no"; then
IBLIBDIR="$with_bmi_ib_libdir"
if test "$with_btl_mvapi_libdir" != "" -a "$with_btl_mvapi_libdir" != "yes" -a \
"$with_btl_mvapi_libdir" != "no"; then
IBLIBDIR="$with_btl_mvapi_libdir"
fi
# Add to CPPFLAGS if necessary
@ -58,13 +56,13 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
EXTRA_CPPFLAGS="-I$IBDIR/include"
else
AC_MSG_WARN([*** Warning: cannot find $IBDIR/include])
AC_MSG_WARN([*** Will still try to configure ib bmi anyway...])
AC_MSG_WARN([*** Will still try to configure ib btl anyway...])
fi
if test "$IBDIR" != "" -a -d "$IBDIR/wrap"; then
EXTRA_CPPFLAGS="-I$IBDIR/wrap $EXTRA_CPPFLAGS"
else
AC_MSG_WARN([*** Warning: cannot find $IBDIR/wrap])
AC_MSG_WARN([*** Will still try to configure ib bmi anyway...])
AC_MSG_WARN([*** Will still try to configure ib btl anyway...])
fi
fi
@ -94,7 +92,7 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
mca_bmi_ib_try_find_libvapi() {
mca_btl_mvapi_try_find_libvapi() {
func1=[$]1
func2=[$]2
@ -125,7 +123,7 @@ mca_bmi_ib_try_find_libvapi() {
if test -d "$IBLIBDIR/lib"; then
EXTRA_LDFLAGS="-L$IBLIBDIR/lib"
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
mca_bmi_ib_try_find_libvapi VAPI_open_hca VAPI_query_hca_cap
mca_btl_mvapi_try_find_libvapi VAPI_open_hca VAPI_query_hca_cap
if test "$LIBS" != "$LIBS_orig"; then
echo "--> found libvapi in $IBLIBDIR/lib"
fi
@ -134,7 +132,7 @@ mca_bmi_ib_try_find_libvapi() {
if test "$LIBS" = "$LIBS_orig" -a -d "$IBLIBDIR/lib64"; then
EXTRA_LDFLAGS="-L$IBLIBDIR/lib64"
LDFLAGS="$LDFLAGS_save $EXTRA_LDFLAGS"
mca_bmi_ib_try_find_libvapi EVAPI_list_hcas EVAPI_open_hca
mca_btl_mvapi_try_find_libvapi EVAPI_list_hcas EVAPI_open_hca
if test "$LIBS" != "$LIBS_orig"; then
echo "--> found libvapi in $IBLIBDIR/lib64"
fi

Просмотреть файл

@ -81,8 +81,6 @@ struct mca_mpool_vapi_registration_t {
VAPI_rkey_t r_key;
/* Remote key to registered memory, need to send this
* to remote processes for incoming RDMA ops */
void * base;
void * bound;
bool is_leave_pinned;
};

Просмотреть файл

@ -73,12 +73,12 @@ static void mca_mpool_vapi_registration_destructor( mca_mpool_vapi_registration_
mca_mpool_base_remove((void*) registration);
registration->base_reg.mpool->mpool_deregister(
registration->base_reg.mpool,
registration->base,
registration->base_reg.base,
0,
(mca_mpool_base_registration_t*) registration);
registration->base = NULL;
registration->bound = NULL;
registration->base_reg.base = NULL;
registration->base_reg.bound = NULL;
registration->is_leave_pinned=false;
}

Просмотреть файл

@ -100,8 +100,8 @@ int mca_mpool_vapi_register(mca_mpool_base_module_t* mpool,
vapi_reg->l_key = mr_out.l_key;
vapi_reg->r_key = mr_out.r_key;
vapi_reg->base = addr;
vapi_reg->bound = (void*) ((char*) addr + size - 1);
vapi_reg->base_reg.base = addr;
vapi_reg->base_reg.bound = (void*) ((char*) addr + size - 1);
return OMPI_SUCCESS;
}

Просмотреть файл

@ -21,8 +21,8 @@
#include "class/ompi_bitmap.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "mca/bmi/base/base.h"
#include "mca/btl/btl.h"
#include "mca/btl/base/base.h"
#include "pml_ob1.h"
#include "pml_ob1_component.h"
#include "pml_ob1_comm.h"
@ -89,13 +89,13 @@ int mca_pml_ob1_del_comm(ompi_communicator_t* comm)
return OMPI_SUCCESS;
}
static int bmi_exclusivity_compare(const void* arg1, const void* arg2)
static int btl_exclusivity_compare(const void* arg1, const void* arg2)
{
mca_bmi_base_module_t* bmi1 = *(struct mca_bmi_base_module_t**)arg1;
mca_bmi_base_module_t* bmi2 = *(struct mca_bmi_base_module_t**)arg2;
if( bmi1->bmi_exclusivity > bmi2->bmi_exclusivity ) {
mca_btl_base_module_t* btl1 = *(struct mca_btl_base_module_t**)arg1;
mca_btl_base_module_t* btl2 = *(struct mca_btl_base_module_t**)arg2;
if( btl1->btl_exclusivity > btl2->btl_exclusivity ) {
return -1;
} else if (bmi1->bmi_exclusivity == bmi2->bmi_exclusivity ) {
} else if (btl1->btl_exclusivity == btl2->btl_exclusivity ) {
return 0;
} else {
return 1;
@ -103,52 +103,52 @@ static int bmi_exclusivity_compare(const void* arg1, const void* arg2)
}
int mca_pml_ob1_add_bmis()
int mca_pml_ob1_add_btls()
{
/* build an array of ob1s and ob1 modules */
ompi_list_t* bmis = &mca_bmi_base_modules_initialized;
mca_bmi_base_selected_module_t* selected_bmi;
size_t num_bmis = ompi_list_get_size(bmis);
ompi_list_t* btls = &mca_btl_base_modules_initialized;
mca_btl_base_selected_module_t* selected_btl;
size_t num_btls = ompi_list_get_size(btls);
mca_pml_ob1.num_bmi_modules = 0;
mca_pml_ob1.num_bmi_progress = 0;
mca_pml_ob1.num_bmi_components = 0;
mca_pml_ob1.bmi_modules = (mca_bmi_base_module_t **)malloc(sizeof(mca_bmi_base_module_t*) * num_bmis);
mca_pml_ob1.bmi_progress = (mca_bmi_base_component_progress_fn_t*)malloc(sizeof(mca_bmi_base_component_progress_fn_t) * num_bmis);
mca_pml_ob1.bmi_components = (mca_bmi_base_component_t **)malloc(sizeof(mca_bmi_base_component_t*) * num_bmis);
mca_pml_ob1.num_btl_modules = 0;
mca_pml_ob1.num_btl_progress = 0;
mca_pml_ob1.num_btl_components = 0;
mca_pml_ob1.btl_modules = (mca_btl_base_module_t **)malloc(sizeof(mca_btl_base_module_t*) * num_btls);
mca_pml_ob1.btl_progress = (mca_btl_base_component_progress_fn_t*)malloc(sizeof(mca_btl_base_component_progress_fn_t) * num_btls);
mca_pml_ob1.btl_components = (mca_btl_base_component_t **)malloc(sizeof(mca_btl_base_component_t*) * num_btls);
if (NULL == mca_pml_ob1.bmi_modules ||
NULL == mca_pml_ob1.bmi_progress ||
NULL == mca_pml_ob1.bmi_components) {
if (NULL == mca_pml_ob1.btl_modules ||
NULL == mca_pml_ob1.btl_progress ||
NULL == mca_pml_ob1.btl_components) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
for(selected_bmi = (mca_bmi_base_selected_module_t*)ompi_list_get_first(bmis);
selected_bmi != (mca_bmi_base_selected_module_t*)ompi_list_get_end(bmis);
selected_bmi = (mca_bmi_base_selected_module_t*)ompi_list_get_next(selected_bmi)) {
mca_bmi_base_module_t *bmi = selected_bmi->bmi_module;
for(selected_btl = (mca_btl_base_selected_module_t*)ompi_list_get_first(btls);
selected_btl != (mca_btl_base_selected_module_t*)ompi_list_get_end(btls);
selected_btl = (mca_btl_base_selected_module_t*)ompi_list_get_next(selected_btl)) {
mca_btl_base_module_t *btl = selected_btl->btl_module;
size_t i;
int rc;
mca_pml_ob1.bmi_modules[mca_pml_ob1.num_bmi_modules++] = bmi;
for(i=0; i<mca_pml_ob1.num_bmi_components; i++) {
if(mca_pml_ob1.bmi_components[i] == bmi->bmi_component) {
mca_pml_ob1.btl_modules[mca_pml_ob1.num_btl_modules++] = btl;
for(i=0; i<mca_pml_ob1.num_btl_components; i++) {
if(mca_pml_ob1.btl_components[i] == btl->btl_component) {
break;
}
}
/* override eager limit larger than our max */
if(bmi->bmi_eager_limit > mca_pml_ob1.eager_limit) {
bmi->bmi_eager_limit = mca_pml_ob1.eager_limit;
if(btl->btl_eager_limit > mca_pml_ob1.eager_limit) {
btl->btl_eager_limit = mca_pml_ob1.eager_limit;
}
/* setup callback for receive */
rc = bmi->bmi_register(bmi, MCA_BMI_TAG_PML, mca_pml_ob1_recv_frag_callback, NULL);
rc = btl->btl_register(btl, MCA_BTL_TAG_PML, mca_pml_ob1_recv_frag_callback, NULL);
if(OMPI_SUCCESS != rc)
return rc;
if(i == mca_pml_ob1.num_bmi_components) {
mca_pml_ob1.bmi_components[mca_pml_ob1.num_bmi_components++] = bmi->bmi_component;
if(i == mca_pml_ob1.num_btl_components) {
mca_pml_ob1.btl_components[mca_pml_ob1.num_btl_components++] = btl->btl_component;
}
}
@ -163,10 +163,10 @@ int mca_pml_ob1_add_bmis()
NULL);
/* sort ob1 list by exclusivity */
qsort(mca_pml_ob1.bmi_modules,
mca_pml_ob1.num_bmi_modules,
sizeof(struct mca_bmi_base_module_t*),
bmi_exclusivity_compare);
qsort(mca_pml_ob1.btl_modules,
mca_pml_ob1.num_btl_modules,
sizeof(struct mca_btl_base_module_t*),
btl_exclusivity_compare);
return OMPI_SUCCESS;
}
@ -181,7 +181,7 @@ int mca_pml_ob1_add_procs(ompi_proc_t** procs, size_t nprocs)
{
size_t p;
ompi_bitmap_t reachable;
struct mca_bmi_base_endpoint_t** bmi_endpoints = NULL;
struct mca_btl_base_endpoint_t** btl_endpoints = NULL;
int rc;
size_t p_index;
@ -208,10 +208,10 @@ int mca_pml_ob1_add_procs(ompi_proc_t** procs, size_t nprocs)
}
/* attempt to add all procs to each ob1 */
bmi_endpoints = (struct mca_bmi_base_endpoint_t **)malloc(nprocs * sizeof(struct mca_bmi_base_endpoint_t*));
for(p_index = 0; p_index < mca_pml_ob1.num_bmi_modules; p_index++) {
mca_bmi_base_module_t* bmi = mca_pml_ob1.bmi_modules[p_index];
int bmi_inuse = 0;
btl_endpoints = (struct mca_btl_base_endpoint_t **)malloc(nprocs * sizeof(struct mca_btl_base_endpoint_t*));
for(p_index = 0; p_index < mca_pml_ob1.num_btl_modules; p_index++) {
mca_btl_base_module_t* btl = mca_pml_ob1.btl_modules[p_index];
int btl_inuse = 0;
/* if the ob1 can reach the destination proc it sets the
* corresponding bit (proc index) in the reachable bitmap
@ -219,10 +219,10 @@ int mca_pml_ob1_add_procs(ompi_proc_t** procs, size_t nprocs)
* that is passed back to the ob1 on data transfer calls
*/
ompi_bitmap_clear_all_bits(&reachable);
memset(bmi_endpoints, 0, nprocs * sizeof(struct mca_ob1_base_endpoint_t*));
rc = bmi->bmi_add_procs(bmi, nprocs, procs, bmi_endpoints, &reachable);
memset(btl_endpoints, 0, nprocs * sizeof(struct mca_ob1_base_endpoint_t*));
rc = btl->btl_add_procs(btl, nprocs, procs, btl_endpoints, &reachable);
if(OMPI_SUCCESS != rc) {
free(bmi_endpoints);
free(btl_endpoints);
return rc;
}
@ -234,8 +234,8 @@ int mca_pml_ob1_add_procs(ompi_proc_t** procs, size_t nprocs)
mca_pml_ob1_endpoint_t* endpoint;
size_t size;
/* this bmi can be used */
bmi_inuse++;
/* this btl can be used */
btl_inuse++;
/* initialize each proc */
if(NULL == proc_pml) {
@ -244,68 +244,68 @@ int mca_pml_ob1_add_procs(ompi_proc_t** procs, size_t nprocs)
proc_pml = OBJ_NEW(mca_pml_ob1_proc_t);
if (NULL == proc_pml) {
ompi_output(0, "mca_pml_ob1_add_procs: unable to allocate resources");
free(bmi_endpoints);
free(btl_endpoints);
return OMPI_ERR_OUT_OF_RESOURCE;
}
/* preallocate space in array for max number of ob1s */
mca_pml_ob1_ep_array_reserve(&proc_pml->bmi_eager, mca_pml_ob1.num_bmi_modules);
mca_pml_ob1_ep_array_reserve(&proc_pml->bmi_send, mca_pml_ob1.num_bmi_modules);
mca_pml_ob1_ep_array_reserve(&proc_pml->bmi_rdma, mca_pml_ob1.num_bmi_modules);
mca_pml_ob1_ep_array_reserve(&proc_pml->btl_eager, mca_pml_ob1.num_btl_modules);
mca_pml_ob1_ep_array_reserve(&proc_pml->btl_send, mca_pml_ob1.num_btl_modules);
mca_pml_ob1_ep_array_reserve(&proc_pml->btl_rdma, mca_pml_ob1.num_btl_modules);
proc_pml->proc_ompi = proc;
proc->proc_pml = proc_pml;
}
/* dont allow an additional PTL with a lower exclusivity ranking */
size = mca_pml_ob1_ep_array_get_size(&proc_pml->bmi_send);
size = mca_pml_ob1_ep_array_get_size(&proc_pml->btl_send);
if(size > 0) {
endpoint = mca_pml_ob1_ep_array_get_index(&proc_pml->bmi_send, size-1);
/* skip this bmi if the exclusivity is less than the previous */
if(endpoint->bmi->bmi_exclusivity > bmi->bmi_exclusivity) {
if(bmi_endpoints[p] != NULL) {
bmi->bmi_del_procs(bmi, 1, &proc, &bmi_endpoints[p]);
endpoint = mca_pml_ob1_ep_array_get_index(&proc_pml->btl_send, size-1);
/* skip this btl if the exclusivity is less than the previous */
if(endpoint->btl->btl_exclusivity > btl->btl_exclusivity) {
if(btl_endpoints[p] != NULL) {
btl->btl_del_procs(btl, 1, &proc, &btl_endpoints[p]);
}
continue;
}
}
/* cache the endpoint on the proc */
endpoint = mca_pml_ob1_ep_array_insert(&proc_pml->bmi_send);
endpoint->bmi = bmi;
endpoint->bmi_eager_limit = bmi->bmi_eager_limit;
endpoint->bmi_min_send_size = bmi->bmi_min_send_size;
endpoint->bmi_max_send_size = bmi->bmi_max_send_size;
endpoint->bmi_min_rdma_size = bmi->bmi_min_rdma_size;
endpoint->bmi_max_rdma_size = bmi->bmi_max_rdma_size;
endpoint->bmi_cache = NULL;
endpoint->bmi_endpoint = bmi_endpoints[p];
endpoint->bmi_weight = 0;
endpoint->bmi_alloc = bmi->bmi_alloc;
endpoint->bmi_free = bmi->bmi_free;
endpoint->bmi_prepare_src = bmi->bmi_prepare_src;
endpoint->bmi_prepare_dst = bmi->bmi_prepare_dst;
endpoint->bmi_send = bmi->bmi_send;
endpoint->bmi_put = bmi->bmi_put;
endpoint->bmi_get = bmi->bmi_get;
endpoint = mca_pml_ob1_ep_array_insert(&proc_pml->btl_send);
endpoint->btl = btl;
endpoint->btl_eager_limit = btl->btl_eager_limit;
endpoint->btl_min_send_size = btl->btl_min_send_size;
endpoint->btl_max_send_size = btl->btl_max_send_size;
endpoint->btl_min_rdma_size = btl->btl_min_rdma_size;
endpoint->btl_max_rdma_size = btl->btl_max_rdma_size;
endpoint->btl_cache = NULL;
endpoint->btl_endpoint = btl_endpoints[p];
endpoint->btl_weight = 0;
endpoint->btl_alloc = btl->btl_alloc;
endpoint->btl_free = btl->btl_free;
endpoint->btl_prepare_src = btl->btl_prepare_src;
endpoint->btl_prepare_dst = btl->btl_prepare_dst;
endpoint->btl_send = btl->btl_send;
endpoint->btl_put = btl->btl_put;
endpoint->btl_get = btl->btl_get;
}
}
if(bmi_inuse > 0 && NULL != bmi->bmi_component->bmi_progress) {
if(btl_inuse > 0 && NULL != btl->btl_component->btl_progress) {
size_t p;
bool found = false;
for(p=0; p<mca_pml_ob1.num_bmi_progress; p++) {
if(mca_pml_ob1.bmi_progress[p] == bmi->bmi_component->bmi_progress) {
for(p=0; p<mca_pml_ob1.num_btl_progress; p++) {
if(mca_pml_ob1.btl_progress[p] == btl->btl_component->btl_progress) {
found = true;
break;
}
}
if(found == false) {
mca_pml_ob1.bmi_progress[mca_pml_ob1.num_bmi_progress] =
bmi->bmi_component->bmi_progress;
mca_pml_ob1.num_bmi_progress++;
mca_pml_ob1.btl_progress[mca_pml_ob1.num_btl_progress] =
btl->btl_component->btl_progress;
mca_pml_ob1.num_btl_progress++;
}
}
}
free(bmi_endpoints);
free(btl_endpoints);
/* iterate back through procs and compute metrics for registered ob1s */
for(p=0; p<nprocs; p++) {
@ -324,14 +324,14 @@ int mca_pml_ob1_add_procs(ompi_proc_t** procs, size_t nprocs)
* note that we need to do this here, as we may already have ob1s configured
* (2) determine the highest priority ranking for latency
*/
n_size = mca_pml_ob1_ep_array_get_size(&proc_pml->bmi_send);
n_size = mca_pml_ob1_ep_array_get_size(&proc_pml->btl_send);
for(n_index = 0; n_index < n_size; n_index++) {
mca_pml_ob1_endpoint_t* endpoint =
mca_pml_ob1_ep_array_get_index(&proc_pml->bmi_send, n_index);
mca_bmi_base_module_t* ob1 = endpoint->bmi;
total_bandwidth += endpoint->bmi->bmi_bandwidth;
if(ob1->bmi_latency > latency)
latency = ob1->bmi_latency;
mca_pml_ob1_ep_array_get_index(&proc_pml->btl_send, n_index);
mca_btl_base_module_t* ob1 = endpoint->btl;
total_bandwidth += endpoint->btl->btl_bandwidth;
if(ob1->btl_latency > latency)
latency = ob1->btl_latency;
}
/* (1) set the weight of each ob1 as a percentage of overall bandwidth
@ -341,30 +341,30 @@ int mca_pml_ob1_add_procs(ompi_proc_t** procs, size_t nprocs)
for(n_index = 0; n_index < n_size; n_index++) {
mca_pml_ob1_endpoint_t* endpoint =
mca_pml_ob1_ep_array_get_index(&proc_pml->bmi_send, n_index);
mca_bmi_base_module_t *ob1 = endpoint->bmi;
mca_pml_ob1_ep_array_get_index(&proc_pml->btl_send, n_index);
mca_btl_base_module_t *ob1 = endpoint->btl;
double weight;
/* compute weighting factor for this ob1 */
if(ob1->bmi_bandwidth)
weight = endpoint->bmi->bmi_bandwidth / total_bandwidth;
if(ob1->btl_bandwidth)
weight = endpoint->btl->btl_bandwidth / total_bandwidth;
else
weight = 1.0 / n_size;
endpoint->bmi_weight = (int)(weight * 100);
endpoint->btl_weight = (int)(weight * 100);
/* check to see if this ob1 is already in the array of ob1s
* used for first fragments - if not add it.
*/
if(ob1->bmi_latency == latency) {
if(ob1->btl_latency == latency) {
mca_pml_ob1_endpoint_t* ep_new =
mca_pml_ob1_ep_array_insert(&proc_pml->bmi_eager);
mca_pml_ob1_ep_array_insert(&proc_pml->btl_eager);
*ep_new = *endpoint;
}
/* check flags - is rdma prefered */
if(endpoint->bmi->bmi_flags & MCA_BMI_FLAGS_RDMA &&
if(endpoint->btl->btl_flags & MCA_BTL_FLAGS_RDMA &&
proc->proc_arch == ompi_proc_local_proc->proc_arch) {
mca_pml_ob1_endpoint_t* rdma_ep = mca_pml_ob1_ep_array_insert(&proc_pml->bmi_rdma);
mca_pml_ob1_endpoint_t* rdma_ep = mca_pml_ob1_ep_array_insert(&proc_pml->btl_rdma);
*rdma_ep = *endpoint;
}
}
@ -388,12 +388,12 @@ int mca_pml_ob1_del_procs(ompi_proc_t** procs, size_t nprocs)
size_t n_index, n_size;
/* notify each ob1 that the proc is going away */
f_size = mca_pml_ob1_ep_array_get_size(&proc_pml->bmi_eager);
f_size = mca_pml_ob1_ep_array_get_size(&proc_pml->btl_eager);
for(f_index = 0; f_index < f_size; f_index++) {
mca_pml_ob1_endpoint_t* endpoint = mca_pml_ob1_ep_array_get_index(&proc_pml->bmi_eager, f_index);
mca_bmi_base_module_t* ob1 = endpoint->bmi;
mca_pml_ob1_endpoint_t* endpoint = mca_pml_ob1_ep_array_get_index(&proc_pml->btl_eager, f_index);
mca_btl_base_module_t* ob1 = endpoint->btl;
rc = ob1->bmi_del_procs(ob1,1,&proc,&endpoint->bmi_endpoint);
rc = ob1->btl_del_procs(ob1,1,&proc,&endpoint->btl_endpoint);
if(OMPI_SUCCESS != rc) {
return rc;
}
@ -401,10 +401,10 @@ int mca_pml_ob1_del_procs(ompi_proc_t** procs, size_t nprocs)
/* remove this from next array so that we dont call it twice w/
* the same address pointer
*/
n_size = mca_pml_ob1_ep_array_get_size(&proc_pml->bmi_eager);
n_size = mca_pml_ob1_ep_array_get_size(&proc_pml->btl_eager);
for(n_index = 0; n_index < n_size; n_index++) {
mca_pml_ob1_endpoint_t* endpoint = mca_pml_ob1_ep_array_get_index(&proc_pml->bmi_send, n_index);
if(endpoint->bmi == ob1) {
mca_pml_ob1_endpoint_t* endpoint = mca_pml_ob1_ep_array_get_index(&proc_pml->btl_send, n_index);
if(endpoint->btl == ob1) {
memset(endpoint, 0, sizeof(mca_pml_ob1_endpoint_t));
break;
}
@ -412,12 +412,12 @@ int mca_pml_ob1_del_procs(ompi_proc_t** procs, size_t nprocs)
}
/* notify each ob1 that was not in the array of ob1s for first fragments */
n_size = mca_pml_ob1_ep_array_get_size(&proc_pml->bmi_send);
n_size = mca_pml_ob1_ep_array_get_size(&proc_pml->btl_send);
for(n_index = 0; n_index < n_size; n_index++) {
mca_pml_ob1_endpoint_t* endpoint = mca_pml_ob1_ep_array_get_index(&proc_pml->bmi_eager, n_index);
mca_bmi_base_module_t* ob1 = endpoint->bmi;
mca_pml_ob1_endpoint_t* endpoint = mca_pml_ob1_ep_array_get_index(&proc_pml->btl_eager, n_index);
mca_btl_base_module_t* ob1 = endpoint->btl;
if (ob1 != 0) {
rc = ob1->bmi_del_procs(ob1,1,&proc,&endpoint->bmi_endpoint);
rc = ob1->btl_del_procs(ob1,1,&proc,&endpoint->btl_endpoint);
if(OMPI_SUCCESS != rc)
return rc;
}

Просмотреть файл

@ -30,7 +30,7 @@
#include "mca/pml/base/pml_base_request.h"
#include "mca/pml/base/pml_base_bsend.h"
#include "mca/pml/base/pml_base_sendreq.h"
#include "mca/bmi/bmi.h"
#include "mca/btl/btl.h"
#if defined(c_plusplus) || defined(__cplusplus)
@ -43,20 +43,20 @@ extern "C" {
struct mca_pml_ob1_t {
mca_pml_base_module_t super;
mca_bmi_base_component_t **bmi_components;
size_t num_bmi_components;
mca_btl_base_component_t **btl_components;
size_t num_btl_components;
mca_bmi_base_module_t** bmi_modules;
size_t num_bmi_modules;
mca_btl_base_module_t** btl_modules;
size_t num_btl_modules;
mca_bmi_base_component_progress_fn_t* bmi_progress;
size_t num_bmi_progress;
mca_btl_base_component_progress_fn_t* btl_progress;
size_t num_btl_progress;
int priority;
int free_list_num; /* initial size of free list */
int free_list_max; /* maximum size of free list */
int free_list_inc; /* number of elements to grow free list */
size_t eager_limit; /* maximum eager limit size - overrides bmi setting */
size_t eager_limit; /* maximum eager limit size - overrides btl setting */
size_t rdma_offset; /* offset at which we attempt to initiate rdma */
size_t send_pipeline_depth;
size_t recv_pipeline_depth;
@ -123,7 +123,7 @@ extern int mca_pml_ob1_del_procs(
size_t nprocs
);
extern int mca_pml_ob1_add_bmis(void);
extern int mca_pml_ob1_add_btls(void);
extern int mca_pml_ob1_enable(
bool enable

Просмотреть файл

@ -19,8 +19,8 @@
#include "event/event.h"
#include "mpi.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "mca/bmi/base/base.h"
#include "mca/btl/btl.h"
#include "mca/btl/base/base.h"
#include "mca/base/mca_base_param.h"
#include "mca/pml/base/pml_base_bsend.h"
#include "pml_ob1.h"
@ -94,12 +94,12 @@ int mca_pml_ob1_component_open(void)
OBJ_CONSTRUCT(&mca_pml_ob1.recv_pending, ompi_list_t);
OBJ_CONSTRUCT(&mca_pml_ob1.acks_pending, ompi_list_t);
mca_pml_ob1.bmi_components = NULL;
mca_pml_ob1.num_bmi_components = 0;
mca_pml_ob1.bmi_modules = NULL;
mca_pml_ob1.num_bmi_modules = 0;
mca_pml_ob1.bmi_progress = NULL;
mca_pml_ob1.num_bmi_progress = 0;
mca_pml_ob1.btl_components = NULL;
mca_pml_ob1.num_btl_components = 0;
mca_pml_ob1.btl_modules = NULL;
mca_pml_ob1.num_btl_modules = 0;
mca_pml_ob1.btl_progress = NULL;
mca_pml_ob1.num_btl_progress = 0;
mca_pml_ob1.free_list_num =
mca_pml_ob1_param_register_int("free_list_num", 256);
@ -123,14 +123,14 @@ int mca_pml_ob1_component_open(void)
mca_base_param_lookup_int(param, &value);
mca_pml_ob1.leave_pinned = value;
return mca_bmi_base_open();
return mca_btl_base_open();
}
int mca_pml_ob1_component_close(void)
{
int rc;
if(OMPI_SUCCESS != (rc = mca_bmi_base_close()))
if(OMPI_SUCCESS != (rc = mca_btl_base_close()))
return rc;
#if OMPI_ENABLE_DEBUG
@ -148,14 +148,14 @@ int mca_pml_ob1_component_close(void)
}
#endif
if(NULL != mca_pml_ob1.bmi_components) {
free(mca_pml_ob1.bmi_components);
if(NULL != mca_pml_ob1.btl_components) {
free(mca_pml_ob1.btl_components);
}
if(NULL != mca_pml_ob1.bmi_modules) {
free(mca_pml_ob1.bmi_modules);
if(NULL != mca_pml_ob1.btl_modules) {
free(mca_pml_ob1.btl_modules);
}
if(NULL != mca_pml_ob1.bmi_progress) {
free(mca_pml_ob1.bmi_progress);
if(NULL != mca_pml_ob1.btl_progress) {
free(mca_pml_ob1.btl_progress);
}
OBJ_DESTRUCT(&mca_pml_ob1.acks_pending);
OBJ_DESTRUCT(&mca_pml_ob1.send_pending);
@ -230,9 +230,9 @@ mca_pml_base_module_t* mca_pml_ob1_component_init(int* priority,
return NULL;
/* initialize NTLs */
if(OMPI_SUCCESS != mca_bmi_base_select(enable_progress_threads,enable_mpi_threads))
if(OMPI_SUCCESS != mca_btl_base_select(enable_progress_threads,enable_mpi_threads))
return NULL;
if(OMPI_SUCCESS != mca_pml_ob1_add_bmis())
if(OMPI_SUCCESS != mca_pml_ob1_add_btls())
return NULL;
return &mca_pml_ob1.super;

Просмотреть файл

@ -20,37 +20,37 @@
#define MCA_PML_OB1_ENDPOINT_H
#include "util/output.h"
#include "mca/bmi/bmi.h"
#include "mca/btl/btl.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/**
* A data structure associated with a ompi_proc_t that caches
* addressing/scheduling attributes for a specific BMI instance
* addressing/scheduling attributes for a specific BTL instance
* that can be used to reach the process.
*/
struct mca_pml_ob1_endpoint_t {
int bmi_weight; /**< BMI weight for scheduling */
int bmi_flags; /**< support for put/get? */
size_t bmi_eager_limit; /**< BMI eager limit */
size_t bmi_min_send_size; /**< BMI min send size */
size_t bmi_max_send_size; /**< BMI max send size */
size_t bmi_min_rdma_size; /**< BMI min rdma size */
size_t bmi_max_rdma_size; /**< BMI max rdma size */
struct mca_bmi_base_module_t *bmi; /**< BMI module */
struct mca_bmi_base_endpoint_t* bmi_endpoint; /**< BMI addressing info */
struct mca_bmi_base_descriptor_t* bmi_cache;
int btl_weight; /**< BTL weight for scheduling */
int btl_flags; /**< support for put/get? */
size_t btl_eager_limit; /**< BTL eager limit */
size_t btl_min_send_size; /**< BTL min send size */
size_t btl_max_send_size; /**< BTL max send size */
size_t btl_min_rdma_size; /**< BTL min rdma size */
size_t btl_max_rdma_size; /**< BTL max rdma size */
struct mca_btl_base_module_t *btl; /**< BTL module */
struct mca_btl_base_endpoint_t* btl_endpoint; /**< BTL addressing info */
struct mca_btl_base_descriptor_t* btl_cache;
/* BMI function table */
mca_bmi_base_module_alloc_fn_t bmi_alloc;
mca_bmi_base_module_free_fn_t bmi_free;
mca_bmi_base_module_send_fn_t bmi_send;
mca_bmi_base_module_prepare_fn_t bmi_prepare_src;
mca_bmi_base_module_prepare_fn_t bmi_prepare_dst;
mca_bmi_base_module_put_fn_t bmi_put;
mca_bmi_base_module_get_fn_t bmi_get;
/* BTL function table */
mca_btl_base_module_alloc_fn_t btl_alloc;
mca_btl_base_module_free_fn_t btl_free;
mca_btl_base_module_send_fn_t btl_send;
mca_btl_base_module_prepare_fn_t btl_prepare_src;
mca_btl_base_module_prepare_fn_t btl_prepare_dst;
mca_btl_base_module_put_fn_t btl_put;
mca_btl_base_module_get_fn_t btl_get;
};
typedef struct mca_pml_ob1_endpoint_t mca_pml_ob1_endpoint_t;
@ -62,9 +62,9 @@ typedef struct mca_pml_ob1_endpoint_t mca_pml_ob1_endpoint_t;
struct mca_pml_ob1_ep_array_t {
ompi_object_t super;
size_t arr_size; /**< number available */
size_t arr_reserve; /**< size of allocated bmi_proc array */
size_t arr_reserve; /**< size of allocated btl_proc array */
size_t arr_index; /**< last used index*/
mca_pml_ob1_endpoint_t* arr_endpoints; /**< array of bmi endpoints */
mca_pml_ob1_endpoint_t* arr_endpoints; /**< array of btl endpoints */
};
typedef struct mca_pml_ob1_ep_array_t mca_pml_ob1_ep_array_t;
@ -162,11 +162,11 @@ static inline mca_pml_ob1_endpoint_t* mca_pml_ob1_ep_array_get_next(mca_pml_ob1_
* @param index (IN)
*/
static inline mca_pml_ob1_endpoint_t* mca_pml_ob1_ep_array_find(
mca_pml_ob1_ep_array_t* array, struct mca_bmi_base_module_t* bmi)
mca_pml_ob1_ep_array_t* array, struct mca_btl_base_module_t* btl)
{
size_t i=0;
for(i=0; i<array->arr_size; i++) {
if(array->arr_endpoints[i].bmi == bmi) {
if(array->arr_endpoints[i].btl == btl) {
return &array->arr_endpoints[i];
}
}
@ -180,28 +180,28 @@ static inline mca_pml_ob1_endpoint_t* mca_pml_ob1_ep_array_find(
#if OMPI_HAVE_THREAD_SUPPORT
#define MCA_PML_OB1_ENDPOINT_DES_ALLOC(endpoint, descriptor, size) \
do { \
if(NULL != (descriptor = endpoint->bmi_cache)) { \
if(NULL != (descriptor = endpoint->btl_cache)) { \
/* atomically acquire the cached descriptor */ \
if(ompi_atomic_cmpset_ptr(&endpoint->bmi_cache, descriptor, NULL) == 0) { \
endpoint->bmi_cache = NULL; \
if(ompi_atomic_cmpset_ptr(&endpoint->btl_cache, descriptor, NULL) == 0) { \
endpoint->btl_cache = NULL; \
} else { \
descriptor = endpoint->bmi_alloc(endpoint->bmi, sizeof(mca_pml_ob1_hdr_t) + \
MCA_BMI_DES_MAX_SEGMENTS * sizeof(mca_bmi_base_segment_t)); \
descriptor = endpoint->btl_alloc(endpoint->btl, sizeof(mca_pml_ob1_hdr_t) + \
MCA_BTL_DES_MAX_SEGMENTS * sizeof(mca_btl_base_segment_t)); \
} \
} else { \
descriptor = endpoint->bmi_alloc(endpoint->bmi, sizeof(mca_pml_ob1_hdr_t) + \
MCA_BMI_DES_MAX_SEGMENTS * sizeof(mca_bmi_base_segment_t)); \
descriptor = endpoint->btl_alloc(endpoint->btl, sizeof(mca_pml_ob1_hdr_t) + \
MCA_BTL_DES_MAX_SEGMENTS * sizeof(mca_btl_base_segment_t)); \
} \
descriptor->des_src->seg_len = size; \
} while(0)
#else
#define MCA_PML_OB1_ENDPOINT_DES_ALLOC(endpoint, descriptor, size) \
do { \
if(NULL != (descriptor = endpoint->bmi_cache)) { \
endpoint->bmi_cache = NULL; \
if(NULL != (descriptor = endpoint->btl_cache)) { \
endpoint->btl_cache = NULL; \
} else { \
descriptor = endpoint->bmi_alloc(endpoint->bmi, sizeof(mca_pml_ob1_hdr_t) + \
MCA_BMI_DES_MAX_SEGMENTS * sizeof(mca_bmi_base_segment_t)); \
descriptor = endpoint->btl_alloc(endpoint->btl, sizeof(mca_pml_ob1_hdr_t) + \
MCA_BTL_DES_MAX_SEGMENTS * sizeof(mca_btl_base_segment_t)); \
} \
descriptor->des_src->seg_len = size; \
} while(0)
@ -214,21 +214,21 @@ do {
#if OMPI_HAVE_THREAD_SUPPORT
#define MCA_PML_OB1_ENDPOINT_DES_RETURN(endpoint, descriptor) \
do { \
if(NULL == endpoint->bmi_cache) { \
if(ompi_atomic_cmpset_ptr(&endpoint->bmi_cache,NULL,descriptor) == 0) { \
endpoint->bmi_free(endpoint->bmi,descriptor); \
if(NULL == endpoint->btl_cache) { \
if(ompi_atomic_cmpset_ptr(&endpoint->btl_cache,NULL,descriptor) == 0) { \
endpoint->btl_free(endpoint->btl,descriptor); \
} \
} else { \
endpoint->bmi_free(endpoint->bmi,descriptor); \
endpoint->btl_free(endpoint->btl,descriptor); \
}
} while(0)
#else
#define MCA_PML_OB1_ENDPOINT_DES_RETURN(endpoint, descriptor) \
do { \
if(NULL == endpoint->bmi_cache) { \
endpoint->bmi_cache = descriptor; \
if(NULL == endpoint->btl_cache) { \
endpoint->btl_cache = descriptor; \
} else { \
endpoint->bmi_free(endpoint->bmi,descriptor); \
endpoint->btl_free(endpoint->btl,descriptor); \
} \
} while(0)
#endif

Просмотреть файл

@ -218,7 +218,7 @@ struct mca_pml_ob1_rdma_hdr_t {
ompi_ptr_t hdr_dst; /**< receive request/descriptor */
uint64_t hdr_rdma_offset; /**< current offset into user buffer */
uint32_t hdr_seg_cnt; /**< number of segments for rdma */
mca_bmi_base_segment_t hdr_segs[1]; /**< list of segments for rdma */
mca_btl_base_segment_t hdr_segs[1]; /**< list of segments for rdma */
};
typedef struct mca_pml_ob1_rdma_hdr_t mca_pml_ob1_rdma_hdr_t;

Просмотреть файл

@ -26,18 +26,18 @@ static void mca_pml_ob1_proc_construct(mca_pml_ob1_proc_t* proc)
proc->proc_ompi = NULL;
proc->proc_sequence = 0;
OBJ_CONSTRUCT(&proc->proc_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&proc->bmi_eager, mca_pml_ob1_ep_array_t);
OBJ_CONSTRUCT(&proc->bmi_send, mca_pml_ob1_ep_array_t);
OBJ_CONSTRUCT(&proc->bmi_rdma, mca_pml_ob1_ep_array_t);
OBJ_CONSTRUCT(&proc->btl_eager, mca_pml_ob1_ep_array_t);
OBJ_CONSTRUCT(&proc->btl_send, mca_pml_ob1_ep_array_t);
OBJ_CONSTRUCT(&proc->btl_rdma, mca_pml_ob1_ep_array_t);
}
static void mca_pml_ob1_proc_destruct(mca_pml_ob1_proc_t* proc)
{
OBJ_DESTRUCT(&proc->proc_lock);
OBJ_DESTRUCT(&proc->bmi_eager);
OBJ_DESTRUCT(&proc->bmi_send);
OBJ_DESTRUCT(&proc->bmi_rdma);
OBJ_DESTRUCT(&proc->btl_eager);
OBJ_DESTRUCT(&proc->btl_send);
OBJ_DESTRUCT(&proc->btl_rdma);
}

Просмотреть файл

@ -38,9 +38,9 @@ struct mca_pml_proc_t {
ompi_mutex_t proc_lock; /**< lock to protect against concurrent access */
int proc_flags; /**< prefered method of accessing this peer */
volatile uint32_t proc_sequence; /**< sequence number for send */
mca_pml_ob1_ep_array_t bmi_eager; /**< array of endpoints to use for first fragments */
mca_pml_ob1_ep_array_t bmi_send; /**< array of endpoints to use for remaining fragments */
mca_pml_ob1_ep_array_t bmi_rdma; /**< array of endpoints that support (prefer) rdma */
mca_pml_ob1_ep_array_t btl_eager; /**< array of endpoints to use for first fragments */
mca_pml_ob1_ep_array_t btl_send; /**< array of endpoints to use for remaining fragments */
mca_pml_ob1_ep_array_t btl_rdma; /**< array of endpoints that support (prefer) rdma */
};
typedef struct mca_pml_proc_t mca_pml_ob1_proc_t;
@ -74,24 +74,24 @@ static inline mca_pml_ob1_proc_t* mca_pml_ob1_proc_lookup_remote(ompi_communicat
}
/**
* Return the mca_bmi_peer_t instance corresponding to the process/bmi combination.
* Return the mca_btl_peer_t instance corresponding to the process/btl combination.
*
* @param comm Communicator
* @param rank Peer rank
* @return mca_pml_proc_t instance
*/
static inline struct mca_bmi_base_endpoint_t* mca_pml_ob1_proc_lookup_remote_endpoint(
static inline struct mca_btl_base_endpoint_t* mca_pml_ob1_proc_lookup_remote_endpoint(
ompi_communicator_t* comm,
int rank,
struct mca_bmi_base_module_t* bmi)
struct mca_btl_base_module_t* btl)
{
mca_pml_ob1_proc_t* proc = comm->c_pml_procs[rank];
size_t i, size = mca_pml_ob1_ep_array_get_size(&proc->bmi_eager);
mca_pml_ob1_endpoint_t* endpoint = proc->bmi_eager.arr_endpoints;
size_t i, size = mca_pml_ob1_ep_array_get_size(&proc->btl_eager);
mca_pml_ob1_endpoint_t* endpoint = proc->btl_eager.arr_endpoints;
for(i = 0; i < size; i++) {
if(endpoint->bmi == bmi) {
return endpoint->bmi_endpoint;
if(endpoint->btl == btl) {
return endpoint->btl_endpoint;
}
endpoint++;
}

Просмотреть файл

@ -28,8 +28,8 @@ int mca_pml_ob1_progress(void)
/*
* Progress each of the PTL modules
*/
for(i=0; i<mca_pml_ob1.num_bmi_progress; i++) {
int rc = mca_pml_ob1.bmi_progress[i]();
for(i=0; i<mca_pml_ob1.num_btl_progress; i++) {
int rc = mca_pml_ob1.btl_progress[i]();
if(rc > 0) {
count += rc;
}

Просмотреть файл

@ -20,7 +20,7 @@
#ifndef MCA_PML_OB1_RDMAFRAG_H
#define MCA_PML_OB1_RDMAFRAG_H
#include "mca/bmi/bmi.h"
#include "mca/btl/btl.h"
#include "pml_ob1_hdr.h"
typedef enum {
@ -32,11 +32,11 @@ typedef enum {
struct mca_pml_ob1_rdma_frag_t {
ompi_list_item_t super;
mca_bmi_base_module_t* rdma_bmi;
mca_btl_base_module_t* rdma_btl;
mca_pml_ob1_hdr_t rdma_hdr;
mca_pml_ob1_rdma_state_t rdma_state;
size_t rdma_length;
mca_bmi_base_segment_t rdma_segs[MCA_BMI_DES_MAX_SEGMENTS];
mca_btl_base_segment_t rdma_segs[MCA_BTL_DES_MAX_SEGMENTS];
struct mca_pml_ob1_endpoint_t* rdma_ep;
struct mca_pml_ob1_send_request_t* rdma_req;
};

Просмотреть файл

@ -51,16 +51,16 @@ OBJ_CLASS_INSTANCE(
/**
* Callback from BMI on receive.
* Callback from BTL on receive.
*/
void mca_pml_ob1_recv_frag_callback(
mca_bmi_base_module_t* bmi,
mca_bmi_base_tag_t tag,
mca_bmi_base_descriptor_t* des,
mca_btl_base_module_t* btl,
mca_btl_base_tag_t tag,
mca_btl_base_descriptor_t* des,
void* cbdata)
{
mca_bmi_base_segment_t* segments = des->des_dst;
mca_btl_base_segment_t* segments = des->des_dst;
mca_pml_ob1_hdr_t* hdr = (mca_pml_ob1_hdr_t*)segments->seg_addr.pval;
if(segments->seg_len < sizeof(mca_pml_ob1_common_hdr_t)) {
return;
@ -70,7 +70,7 @@ void mca_pml_ob1_recv_frag_callback(
case MCA_PML_OB1_HDR_TYPE_MATCH:
case MCA_PML_OB1_HDR_TYPE_RNDV:
{
mca_pml_ob1_recv_frag_match(bmi,&hdr->hdr_match,segments,des->des_dst_cnt);
mca_pml_ob1_recv_frag_match(btl,&hdr->hdr_match,segments,des->des_dst_cnt);
break;
}
case MCA_PML_OB1_HDR_TYPE_ACK:
@ -90,30 +90,30 @@ void mca_pml_ob1_recv_frag_callback(
{
mca_pml_ob1_recv_request_t* recvreq = (mca_pml_ob1_recv_request_t*)
hdr->hdr_frag.hdr_dst_req.pval;
mca_pml_ob1_recv_request_progress(recvreq,bmi,segments,des->des_dst_cnt);
mca_pml_ob1_recv_request_progress(recvreq,btl,segments,des->des_dst_cnt);
break;
}
case MCA_PML_OB1_HDR_TYPE_PUT:
{
mca_pml_ob1_send_request_t* sendreq = (mca_pml_ob1_send_request_t*)
hdr->hdr_rdma.hdr_src.pval;
mca_pml_ob1_send_request_put(sendreq,bmi,&hdr->hdr_rdma);
mca_pml_ob1_send_request_put(sendreq,btl,&hdr->hdr_rdma);
break;
}
case MCA_PML_OB1_HDR_TYPE_FIN:
{
mca_bmi_base_descriptor_t* dst = (mca_bmi_base_descriptor_t*)
mca_btl_base_descriptor_t* dst = (mca_btl_base_descriptor_t*)
hdr->hdr_fin.hdr_dst.pval;
mca_pml_ob1_recv_request_t* recvreq = (mca_pml_ob1_recv_request_t*)dst->des_cbdata;
#if MCA_PML_OB1_TIMESTAMPS
recvreq->fin1[recvreq->fin_index] = get_profiler_timestamp();
bmi->bmi_free(bmi,dst);
btl->btl_free(btl,dst);
recvreq->fin2[recvreq->fin_index] = get_profiler_timestamp();
recvreq->fin_index++;
mca_pml_ob1_recv_request_progress(recvreq,bmi,segments,des->des_dst_cnt);
mca_pml_ob1_recv_request_progress(recvreq,btl,segments,des->des_dst_cnt);
#else
mca_pml_ob1_recv_request_progress(recvreq,bmi,segments,des->des_dst_cnt);
bmi->bmi_free(bmi,dst);
mca_pml_ob1_recv_request_progress(recvreq,btl,segments,des->des_dst_cnt);
btl->btl_free(btl,dst);
#endif
break;
}
@ -410,9 +410,9 @@ static bool mca_pml_ob1_check_cantmatch_for_match(
* - this routine may be called simultaneously by more than one thread
*/
int mca_pml_ob1_recv_frag_match(
mca_bmi_base_module_t* bmi,
mca_btl_base_module_t* btl,
mca_pml_ob1_match_hdr_t *hdr,
mca_bmi_base_segment_t* segments,
mca_btl_base_segment_t* segments,
size_t num_segments)
{
/* local variables */
@ -497,7 +497,7 @@ int mca_pml_ob1_recv_frag_match(
OMPI_THREAD_UNLOCK(&pml_comm->matching_lock);
return rc;
}
MCA_PML_OB1_RECV_FRAG_INIT(frag,bmi,hdr,segments,num_segments);
MCA_PML_OB1_RECV_FRAG_INIT(frag,btl,hdr,segments,num_segments);
ompi_list_append( &proc->unexpected_frags, (ompi_list_item_t *)frag );
}
@ -522,7 +522,7 @@ int mca_pml_ob1_recv_frag_match(
OMPI_THREAD_UNLOCK(&pml_comm->matching_lock);
return rc;
}
MCA_PML_OB1_RECV_FRAG_INIT(frag,bmi,hdr,segments,num_segments);
MCA_PML_OB1_RECV_FRAG_INIT(frag,btl,hdr,segments,num_segments);
ompi_list_append(&proc->frags_cant_match, (ompi_list_item_t *)frag);
}
@ -532,14 +532,14 @@ int mca_pml_ob1_recv_frag_match(
/* release matching lock before processing fragment */
if(match != NULL) {
MCA_PML_OB1_RECV_REQUEST_MATCHED(match, hdr);
mca_pml_ob1_recv_request_progress(match,bmi,segments,num_segments);
mca_pml_ob1_recv_request_progress(match,btl,segments,num_segments);
}
if(additional_match) {
ompi_list_item_t* item;
while(NULL != (item = ompi_list_remove_first(&additional_matches))) {
mca_pml_ob1_recv_frag_t* frag = (mca_pml_ob1_recv_frag_t*)item;
MCA_PML_OB1_RECV_REQUEST_MATCHED(frag->request, hdr);
mca_pml_ob1_recv_request_progress(frag->request,frag->bmi,frag->segments,frag->num_segments);
mca_pml_ob1_recv_request_progress(frag->request,frag->btl,frag->segments,frag->num_segments);
MCA_PML_OB1_RECV_FRAG_RETURN(frag);
}
}

Просмотреть файл

@ -20,7 +20,7 @@
#ifndef MCA_PML_OB1_RECVFRAG_H
#define MCA_PML_OB1_RECVFRAG_H
#include "mca/bmi/bmi.h"
#include "mca/btl/btl.h"
#include "pml_ob1_hdr.h"
struct mca_pml_ob1_buffer_t {
@ -34,12 +34,12 @@ OBJ_CLASS_DECLARATION(mca_pml_ob1_buffer_t);
struct mca_pml_ob1_recv_frag_t {
ompi_list_item_t super;
mca_bmi_base_module_t* bmi;
mca_btl_base_module_t* btl;
mca_pml_ob1_hdr_t hdr;
struct mca_pml_ob1_recv_request_t* request;
size_t num_segments;
mca_bmi_base_segment_t segments[MCA_BMI_DES_MAX_SEGMENTS];
mca_pml_ob1_buffer_t* buffers[MCA_BMI_DES_MAX_SEGMENTS];
mca_btl_base_segment_t segments[MCA_BTL_DES_MAX_SEGMENTS];
mca_pml_ob1_buffer_t* buffers[MCA_BTL_DES_MAX_SEGMENTS];
};
typedef struct mca_pml_ob1_recv_frag_t mca_pml_ob1_recv_frag_t;
@ -54,14 +54,14 @@ do { \
} while(0)
#define MCA_PML_OB1_RECV_FRAG_INIT(frag,bmi,hdr,segs,cnt) \
#define MCA_PML_OB1_RECV_FRAG_INIT(frag,btl,hdr,segs,cnt) \
do { \
size_t i; \
mca_bmi_base_segment_t* macro_segments = frag->segments; \
mca_btl_base_segment_t* macro_segments = frag->segments; \
mca_pml_ob1_buffer_t** buffers = frag->buffers; \
\
/* init recv_frag */ \
frag->bmi = bmi; \
frag->btl = btl; \
frag->hdr = *(mca_pml_ob1_hdr_t*)hdr; \
frag->num_segments = cnt; \
\
@ -100,13 +100,13 @@ do { \
/**
* Callback from BMI on receipt of a recv_frag.
* Callback from BTL on receipt of a recv_frag.
*/
OMPI_DECLSPEC void mca_pml_ob1_recv_frag_callback(
mca_bmi_base_module_t* bmi,
mca_bmi_base_tag_t tag,
mca_bmi_base_descriptor_t* descriptor,
mca_btl_base_module_t* btl,
mca_btl_base_tag_t tag,
mca_btl_base_descriptor_t* descriptor,
void* cbdata
);
@ -121,9 +121,9 @@ OMPI_DECLSPEC void mca_pml_ob1_recv_frag_callback(
* @return OMPI_SUCCESS or error status on failure.
*/
OMPI_DECLSPEC int mca_pml_ob1_recv_frag_match(
mca_bmi_base_module_t* bmi,
mca_btl_base_module_t* btl,
mca_pml_ob1_match_hdr_t *hdr,
mca_bmi_base_segment_t* segments,
mca_btl_base_segment_t* segments,
size_t num_segments);

Просмотреть файл

@ -17,7 +17,7 @@
#include "ompi_config.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "mca/btl/btl.h"
#include "mca/mpool/mpool.h"
#include "pml_ob1_comm.h"
#include "pml_ob1_recvreq.h"
@ -102,9 +102,9 @@ OBJ_CLASS_INSTANCE(
*/
static void mca_pml_ob1_send_ctl_complete(
mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* ep,
struct mca_bmi_base_descriptor_t* des,
mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* ep,
struct mca_btl_base_descriptor_t* des,
int status)
{
mca_pml_ob1_endpoint_t* endpoint = (mca_pml_ob1_endpoint_t*)des->des_cbdata;
@ -121,8 +121,8 @@ static void mca_pml_ob1_recv_request_ack(
mca_pml_ob1_rendezvous_hdr_t* hdr)
{
mca_pml_ob1_proc_t* proc = recvreq->req_proc;
mca_pml_ob1_endpoint_t* ep = mca_pml_ob1_ep_array_get_next(&proc->bmi_eager);
mca_bmi_base_descriptor_t* des;
mca_pml_ob1_endpoint_t* ep = mca_pml_ob1_ep_array_get_next(&proc->btl_eager);
mca_btl_base_descriptor_t* des;
mca_pml_ob1_recv_frag_t* frag;
mca_pml_ob1_ack_hdr_t* ack;
int rc;
@ -152,7 +152,7 @@ static void mca_pml_ob1_recv_request_ack(
|| mca_pml_ob1.leave_pinned)) { /* BUG here! hdr_flags are 0! */
struct mca_mpool_base_reg_mpool_t *reg = recvreq->req_chunk->mpools;
while(reg->mpool != NULL) {
if(NULL != mca_pml_ob1_ep_array_find(&proc->bmi_rdma,(mca_bmi_base_module_t*) reg->user_data)) {
if(NULL != mca_pml_ob1_ep_array_find(&proc->btl_rdma,(mca_btl_base_module_t*) reg->user_data)) {
recvreq->req_rdma_offset = hdr->hdr_frag_length;
ack->hdr_rdma_offset = hdr->hdr_frag_length;
recvreq->req_mpool = reg;
@ -168,7 +168,7 @@ static void mca_pml_ob1_recv_request_ack(
*/
if(NULL == recvreq->req_mpool && !mca_pml_ob1.leave_pinned) {
if(recvreq->req_recv.req_bytes_packed > mca_pml_ob1.rdma_offset &&
mca_pml_ob1_ep_array_get_size(&proc->bmi_rdma) &&
mca_pml_ob1_ep_array_get_size(&proc->btl_rdma) &&
ompi_convertor_need_buffers(&recvreq->req_recv.req_convertor) == 0) {
/* use convertor to figure out the rdma offset for this request */
@ -188,13 +188,13 @@ static void mca_pml_ob1_recv_request_ack(
}
/* initialize descriptor */
des->des_flags |= MCA_BMI_DES_FLAGS_PRIORITY;
des->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
des->des_cbfunc = mca_pml_ob1_send_ctl_complete;
des->des_cbdata = ep;
rc = ep->bmi_send(ep->bmi, ep->bmi_endpoint, des, MCA_BMI_TAG_PML);
rc = ep->btl_send(ep->btl, ep->btl_endpoint, des, MCA_BTL_TAG_PML);
if(rc != OMPI_SUCCESS) {
ep->bmi_free(ep->bmi,des);
ep->btl_free(ep->btl,des);
goto retry;
}
return;
@ -202,7 +202,7 @@ static void mca_pml_ob1_recv_request_ack(
/* queue request to retry later */
retry:
MCA_PML_OB1_RECV_FRAG_ALLOC(frag,rc);
frag->bmi = NULL;
frag->btl = NULL;
frag->hdr.hdr_rndv = *hdr;
frag->num_segments = 0;
frag->request = recvreq;
@ -217,8 +217,8 @@ retry:
void mca_pml_ob1_recv_request_progress(
mca_pml_ob1_recv_request_t* recvreq,
mca_bmi_base_module_t* bmi,
mca_bmi_base_segment_t* segments,
mca_btl_base_module_t* btl,
mca_btl_base_segment_t* segments,
size_t num_segments)
{
size_t bytes_received = 0;
@ -334,7 +334,7 @@ void mca_pml_ob1_recv_request_schedule(mca_pml_ob1_recv_request_t* recvreq)
{
if(OMPI_THREAD_ADD32(&recvreq->req_lock,1) == 1) {
mca_pml_ob1_proc_t* proc = recvreq->req_proc;
size_t num_bmi_avail = mca_pml_ob1_ep_array_get_size(&proc->bmi_rdma);
size_t num_btl_avail = mca_pml_ob1_ep_array_get_size(&proc->btl_rdma);
do {
size_t bytes_remaining = recvreq->req_recv.req_bytes_packed - recvreq->req_rdma_offset;
while(bytes_remaining > 0 && recvreq->req_pipeline_depth < mca_pml_ob1.recv_pipeline_depth) {
@ -342,8 +342,8 @@ void mca_pml_ob1_recv_request_schedule(mca_pml_ob1_recv_request_t* recvreq)
size_t hdr_size;
size_t size;
mca_pml_ob1_rdma_hdr_t* hdr;
mca_bmi_base_descriptor_t* dst;
mca_bmi_base_descriptor_t* ctl;
mca_btl_base_descriptor_t* dst;
mca_btl_base_descriptor_t* ctl;
int rc;
/*
@ -352,26 +352,26 @@ void mca_pml_ob1_recv_request_schedule(mca_pml_ob1_recv_request_t* recvreq)
* available RDMA nics.
*/
if(recvreq->req_mpool == NULL && !mca_pml_ob1.leave_pinned) {
ep = mca_pml_ob1_ep_array_get_next(&proc->bmi_rdma);
ep = mca_pml_ob1_ep_array_get_next(&proc->btl_rdma);
/* if there is only one bmi available or the size is less than
* than the min fragment size, schedule the rest via this bmi
/* if there is only one btl available or the size is less than
* than the min fragment size, schedule the rest via this btl
*/
if(num_bmi_avail == 1 || bytes_remaining < ep->bmi_min_rdma_size) {
if(num_btl_avail == 1 || bytes_remaining < ep->btl_min_rdma_size) {
size = bytes_remaining;
/* otherwise attempt to give the BMI a percentage of the message
/* otherwise attempt to give the BTL a percentage of the message
* based on a weighting factor. for simplicity calculate this as
* a percentage of the overall message length (regardless of amount
* previously assigned)
*/
} else {
size = (ep->bmi_weight * bytes_remaining) / 100;
size = (ep->btl_weight * bytes_remaining) / 100;
}
/* makes sure that we don't exceed BMI max rdma size */
if (ep->bmi_max_rdma_size != 0 && size > ep->bmi_max_rdma_size) {
size = ep->bmi_max_rdma_size;
/* makes sure that we don't exceed BTL max rdma size */
if (ep->btl_max_rdma_size != 0 && size > ep->btl_max_rdma_size) {
size = ep->btl_max_rdma_size;
}
/* prepare a descriptor for RDMA */
@ -379,9 +379,9 @@ void mca_pml_ob1_recv_request_schedule(mca_pml_ob1_recv_request_t* recvreq)
#if MCA_PML_OB1_TIMESTAMPS
recvreq->pin1[recvreq->pin_index] = get_profiler_timestamp();
#endif
dst = ep->bmi_prepare_dst(
ep->bmi,
ep->bmi_endpoint,
dst = ep->btl_prepare_dst(
ep->btl,
ep->btl_endpoint,
NULL,
&recvreq->req_recv.req_convertor,
0,
@ -397,23 +397,23 @@ void mca_pml_ob1_recv_request_schedule(mca_pml_ob1_recv_request_t* recvreq)
ompi_convertor_set_position(&recvreq->req_recv.req_convertor, &recvreq->req_rdma_offset);
if(NULL != recvreq->req_mpool){
/* find the endpoint corresponding to this bmi and schedule the entire message */
ep = mca_pml_ob1_ep_array_find(&proc->bmi_rdma, (mca_bmi_base_module_t*) recvreq->req_mpool->user_data);
/* find the endpoint corresponding to this btl and schedule the entire message */
ep = mca_pml_ob1_ep_array_find(&proc->btl_rdma, (mca_btl_base_module_t*) recvreq->req_mpool->user_data);
reg = recvreq->req_mpool->mpool_registration;
}
else{
ep = mca_pml_ob1_ep_array_get_next(&proc->bmi_rdma);
ep = mca_pml_ob1_ep_array_get_next(&proc->btl_rdma);
reg = NULL;
}
#if MCA_PML_OB1_TIMESTAMPS
recvreq->pin1[recvreq->pin_index] = get_profiler_timestamp();
#endif
dst = ep->bmi_prepare_dst(
ep->bmi,
ep->bmi_endpoint,
dst = ep->btl_prepare_dst(
ep->btl,
ep->btl_endpoint,
reg,
&recvreq->req_recv.req_convertor,
0,
@ -437,18 +437,18 @@ void mca_pml_ob1_recv_request_schedule(mca_pml_ob1_recv_request_t* recvreq)
/* prepare a descriptor for rdma control message */
hdr_size = sizeof(mca_pml_ob1_rdma_hdr_t);
if(dst->des_dst_cnt > 1) {
hdr_size += (sizeof(mca_bmi_base_segment_t) * (dst->des_dst_cnt-1));
hdr_size += (sizeof(mca_btl_base_segment_t) * (dst->des_dst_cnt-1));
}
MCA_PML_OB1_ENDPOINT_DES_ALLOC(ep, ctl, hdr_size);
if(ctl == NULL) {
ep->bmi_free(ep->bmi,dst);
ep->btl_free(ep->btl,dst);
OMPI_THREAD_LOCK(&mca_pml_ob1.lock);
ompi_list_append(&mca_pml_ob1.recv_pending, (ompi_list_item_t*)recvreq);
OMPI_THREAD_UNLOCK(&mca_pml_ob1.lock);
break;
}
ctl->des_flags |= MCA_BMI_DES_FLAGS_PRIORITY;
ctl->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
ctl->des_cbfunc = mca_pml_ob1_send_ctl_complete;
ctl->des_cbdata = ep;
@ -460,19 +460,19 @@ void mca_pml_ob1_recv_request_schedule(mca_pml_ob1_recv_request_t* recvreq)
hdr->hdr_dst.pval = dst;
hdr->hdr_rdma_offset = recvreq->req_rdma_offset;
hdr->hdr_seg_cnt = dst->des_dst_cnt;
memcpy(hdr->hdr_segs, dst->des_dst, dst->des_dst_cnt * sizeof(mca_bmi_base_segment_t));
memcpy(hdr->hdr_segs, dst->des_dst, dst->des_dst_cnt * sizeof(mca_btl_base_segment_t));
/* update request state */
recvreq->req_rdma_offset += size;
OMPI_THREAD_ADD32(&recvreq->req_pipeline_depth,1);
/* send rdma request to peer */
rc = ep->bmi_send(ep->bmi, ep->bmi_endpoint, ctl, MCA_BMI_TAG_PML);
rc = ep->btl_send(ep->btl, ep->btl_endpoint, ctl, MCA_BTL_TAG_PML);
if(rc == OMPI_SUCCESS) {
bytes_remaining -= size;
} else {
ep->bmi_free(ep->bmi,ctl);
ep->bmi_free(ep->bmi,dst);
ep->btl_free(ep->btl,ctl);
ep->btl_free(ep->btl,dst);
recvreq->req_rdma_offset -= size;
OMPI_THREAD_ADD32(&recvreq->req_pipeline_depth,-1);
OMPI_THREAD_LOCK(&mca_pml_ob1.lock);
@ -509,7 +509,7 @@ void mca_pml_ob1_recv_request_match_specific(mca_pml_ob1_recv_request_t* request
(frag = mca_pml_ob1_recv_request_match_specific_proc(request, proc)) != NULL) {
OMPI_THREAD_UNLOCK(&comm->matching_lock);
mca_pml_ob1_recv_request_progress(request,frag->bmi,frag->segments,frag->num_segments);
mca_pml_ob1_recv_request_progress(request,frag->btl,frag->segments,frag->num_segments);
if( !((MCA_PML_REQUEST_IPROBE == request->req_recv.req_base.req_type) ||
(MCA_PML_REQUEST_PROBE == request->req_recv.req_base.req_type)) ) {
MCA_PML_OB1_RECV_FRAG_RETURN(frag);
@ -563,7 +563,7 @@ void mca_pml_ob1_recv_request_match_wild(mca_pml_ob1_recv_request_t* request)
if ((frag = mca_pml_ob1_recv_request_match_specific_proc(request, proc)) != NULL) {
OMPI_THREAD_UNLOCK(&comm->matching_lock);
mca_pml_ob1_recv_request_progress(request,frag->bmi,frag->segments,frag->num_segments);
mca_pml_ob1_recv_request_progress(request,frag->btl,frag->segments,frag->num_segments);
if( !((MCA_PML_REQUEST_IPROBE == request->req_recv.req_base.req_type) ||
(MCA_PML_REQUEST_PROBE == request->req_recv.req_base.req_type)) ) {
MCA_PML_OB1_RECV_FRAG_RETURN(frag);

Просмотреть файл

@ -223,14 +223,14 @@ do {
bytes_delivered) \
do { \
if(request->req_recv.req_base.req_count > 0) { \
struct iovec iov[MCA_BMI_DES_MAX_SEGMENTS]; \
struct iovec iov[MCA_BTL_DES_MAX_SEGMENTS]; \
uint32_t iov_count = 0; \
size_t max_data = bytes_received; \
int32_t free_after = 0; \
size_t n, offset = seg_offset; \
\
for(n=0; n<num_segments; n++) { \
mca_bmi_base_segment_t* segment = segments+n; \
mca_btl_base_segment_t* segment = segments+n; \
if(offset >= segment->seg_len) { \
offset -= segment->seg_len; \
} else { \
@ -259,8 +259,8 @@ do {
void mca_pml_ob1_recv_request_progress(
mca_pml_ob1_recv_request_t* req,
mca_bmi_base_module_t* bmi,
mca_bmi_base_segment_t* segments,
mca_btl_base_module_t* btl,
mca_btl_base_segment_t* segments,
size_t num_segments);
/**

Просмотреть файл

@ -21,7 +21,7 @@
#include <sched.h>
#include "include/constants.h"
#include "mca/pml/pml.h"
#include "mca/bmi/bmi.h"
#include "mca/btl/btl.h"
#include "mca/errmgr/errmgr.h"
#include "mca/mpool/mpool.h"
#include "pml_ob1.h"
@ -76,13 +76,13 @@ OBJ_CLASS_INSTANCE(
*/
static void mca_pml_ob1_short_completion(
mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* ep,
struct mca_bmi_base_descriptor_t* descriptor,
mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* ep,
struct mca_btl_base_descriptor_t* descriptor,
int status)
{
mca_pml_ob1_send_request_t* sendreq = (mca_pml_ob1_send_request_t*)descriptor->des_cbdata;
mca_pml_ob1_endpoint_t* bmi_ep = sendreq->req_endpoint;
mca_pml_ob1_endpoint_t* btl_ep = sendreq->req_endpoint;
/* check completion status */
if(OMPI_SUCCESS != status) {
@ -92,7 +92,7 @@ static void mca_pml_ob1_short_completion(
}
/* attempt to cache the descriptor */
MCA_PML_OB1_ENDPOINT_DES_RETURN(bmi_ep,descriptor);
MCA_PML_OB1_ENDPOINT_DES_RETURN(btl_ep,descriptor);
/* signal request completion */
OMPI_THREAD_LOCK(&ompi_request_lock);
@ -107,14 +107,14 @@ static void mca_pml_ob1_short_completion(
*/
static void mca_pml_ob1_send_completion(
mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* ep,
struct mca_bmi_base_descriptor_t* descriptor,
mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* ep,
struct mca_btl_base_descriptor_t* descriptor,
int status)
{
mca_pml_ob1_send_request_t* sendreq = (mca_pml_ob1_send_request_t*)descriptor->des_cbdata;
mca_pml_ob1_endpoint_t* bmi_ep = sendreq->req_endpoint;
mca_bmi_base_segment_t* segments = descriptor->des_src;
mca_pml_ob1_endpoint_t* btl_ep = sendreq->req_endpoint;
mca_btl_base_segment_t* segments = descriptor->des_src;
size_t i;
/* check completion status */
@ -161,7 +161,7 @@ static void mca_pml_ob1_send_completion(
/* return the descriptor */
bmi_ep->bmi_free(bmi_ep->bmi, descriptor);
btl_ep->btl_free(btl_ep->btl, descriptor);
/* advance pending requests */
while(NULL != sendreq) {
@ -180,7 +180,7 @@ static void mca_pml_ob1_send_completion(
/**
* BMI requires "specially" allocated memory. Request a segment that
* BTL requires "specially" allocated memory. Request a segment that
* is used for initial hdr and any eager data.
*/
@ -188,8 +188,8 @@ int mca_pml_ob1_send_request_start(
mca_pml_ob1_send_request_t* sendreq,
mca_pml_ob1_endpoint_t* endpoint)
{
mca_bmi_base_descriptor_t* descriptor;
mca_bmi_base_segment_t* segment;
mca_btl_base_descriptor_t* descriptor;
mca_btl_base_segment_t* segment;
mca_pml_ob1_hdr_t* hdr;
size_t size = sendreq->req_send.req_bytes_packed;
int rc;
@ -229,8 +229,8 @@ int mca_pml_ob1_send_request_start(
bool ack = false;
/* determine first fragment size */
if(size > endpoint->bmi_eager_limit - sizeof(mca_pml_ob1_hdr_t)) {
size = endpoint->bmi_eager_limit - sizeof(mca_pml_ob1_hdr_t);
if(size > endpoint->btl_eager_limit - sizeof(mca_pml_ob1_hdr_t)) {
size = endpoint->btl_eager_limit - sizeof(mca_pml_ob1_hdr_t);
ack = true;
} else if (sendreq->req_send.req_send_mode == MCA_PML_BASE_SEND_SYNCHRONOUS) {
ack = true;
@ -241,7 +241,7 @@ int mca_pml_ob1_send_request_start(
int32_t free_after;
/* allocate descriptor */
descriptor = endpoint->bmi_alloc(endpoint->bmi, sizeof(mca_pml_ob1_match_hdr_t) + size);
descriptor = endpoint->btl_alloc(endpoint->btl, sizeof(mca_pml_ob1_match_hdr_t) + size);
if(NULL == descriptor) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
@ -258,7 +258,7 @@ int mca_pml_ob1_send_request_start(
&iov_count,
&max_data,
&free_after)) < 0) {
endpoint->bmi_free(endpoint->bmi, descriptor);
endpoint->btl_free(endpoint->btl, descriptor);
return rc;
}
@ -289,7 +289,7 @@ int mca_pml_ob1_send_request_start(
int32_t free_after;
/* allocate space for hdr + first fragment */
descriptor = endpoint->bmi_alloc(endpoint->bmi, sizeof(mca_pml_ob1_rendezvous_hdr_t) + size);
descriptor = endpoint->btl_alloc(endpoint->btl, sizeof(mca_pml_ob1_rendezvous_hdr_t) + size);
if(NULL == descriptor) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
@ -314,7 +314,7 @@ int mca_pml_ob1_send_request_start(
&iov_count,
&max_data,
&free_after)) < 0) {
endpoint->bmi_free(endpoint->bmi, descriptor);
endpoint->btl_free(endpoint->btl, descriptor);
return rc;
}
}
@ -345,7 +345,7 @@ int mca_pml_ob1_send_request_start(
descriptor->des_cbfunc = mca_pml_ob1_send_completion;
}
}
descriptor->des_flags |= MCA_BMI_DES_FLAGS_PRIORITY;
descriptor->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
descriptor->des_cbdata = sendreq;
OMPI_THREAD_ADD32(&sendreq->req_pipeline_depth,1);
@ -353,13 +353,13 @@ int mca_pml_ob1_send_request_start(
#if MCA_PML_OB1_TIMESTAMPS
sendreq->t_start = get_profiler_timestamp();
#endif
rc = endpoint->bmi_send(
endpoint->bmi,
endpoint->bmi_endpoint,
rc = endpoint->btl_send(
endpoint->btl,
endpoint->btl_endpoint,
descriptor,
MCA_BMI_TAG_PML);
MCA_BTL_TAG_PML);
if(OMPI_SUCCESS != rc) {
endpoint->bmi_free(endpoint->bmi,descriptor);
endpoint->btl_free(endpoint->btl,descriptor);
}
return rc;
}
@ -379,44 +379,44 @@ int mca_pml_ob1_send_request_schedule(mca_pml_ob1_send_request_t* sendreq)
*/
if(OMPI_THREAD_ADD32(&sendreq->req_lock,1) == 1) {
mca_pml_ob1_proc_t* proc = sendreq->req_proc;
size_t num_bmi_avail = mca_pml_ob1_ep_array_get_size(&proc->bmi_send);
size_t num_btl_avail = mca_pml_ob1_ep_array_get_size(&proc->btl_send);
do {
/* allocate remaining bytes to BMIs */
/* allocate remaining bytes to BTLs */
size_t bytes_remaining = sendreq->req_rdma_offset - sendreq->req_send_offset;
while(bytes_remaining > 0 && sendreq->req_pipeline_depth < mca_pml_ob1.send_pipeline_depth) {
mca_pml_ob1_endpoint_t* ep = mca_pml_ob1_ep_array_get_next(&proc->bmi_send);
mca_pml_ob1_endpoint_t* ep = mca_pml_ob1_ep_array_get_next(&proc->btl_send);
mca_pml_ob1_frag_hdr_t* hdr;
mca_bmi_base_descriptor_t* des;
mca_btl_base_descriptor_t* des;
int rc;
/* if there is only one bmi available or the size is less than
* than the min fragment size, schedule the rest via this bmi
/* if there is only one btl available or the size is less than
* than the min fragment size, schedule the rest via this btl
*/
size_t size;
if(num_bmi_avail == 1 || bytes_remaining < ep->bmi_min_send_size) {
if(num_btl_avail == 1 || bytes_remaining < ep->btl_min_send_size) {
size = bytes_remaining;
/* otherwise attempt to give the BMI a percentage of the message
/* otherwise attempt to give the BTL a percentage of the message
* based on a weighting factor. for simplicity calculate this as
* a percentage of the overall message length (regardless of amount
* previously assigned)
*/
} else {
size = (ep->bmi_weight * bytes_remaining) / 100;
size = (ep->btl_weight * bytes_remaining) / 100;
}
/* makes sure that we don't exceed BMI max send size */
if (ep->bmi_max_send_size != 0 &&
size > ep->bmi_max_send_size - sizeof(mca_pml_ob1_frag_hdr_t)) {
size = ep->bmi_max_send_size - sizeof(mca_pml_ob1_frag_hdr_t);
/* makes sure that we don't exceed BTL max send size */
if (ep->btl_max_send_size != 0 &&
size > ep->btl_max_send_size - sizeof(mca_pml_ob1_frag_hdr_t)) {
size = ep->btl_max_send_size - sizeof(mca_pml_ob1_frag_hdr_t);
}
/* pack into a descriptor */
ompi_convertor_set_position(&sendreq->req_send.req_convertor,
&sendreq->req_send_offset);
des = ep->bmi_prepare_src(
ep->bmi,
ep->bmi_endpoint,
des = ep->btl_prepare_src(
ep->btl,
ep->btl_endpoint,
NULL,
&sendreq->req_send.req_convertor,
sizeof(mca_pml_ob1_frag_hdr_t),
@ -444,13 +444,13 @@ int mca_pml_ob1_send_request_schedule(mca_pml_ob1_send_request_t* sendreq)
OMPI_THREAD_ADD32(&sendreq->req_pipeline_depth,1);
/* initiate send - note that this may complete before the call returns */
rc = ep->bmi_send(ep->bmi, ep->bmi_endpoint, des, MCA_BMI_TAG_PML);
rc = ep->btl_send(ep->btl, ep->btl_endpoint, des, MCA_BTL_TAG_PML);
if(rc == OMPI_SUCCESS) {
bytes_remaining -= size;
} else {
sendreq->req_send_offset -= size;
OMPI_THREAD_ADD32(&sendreq->req_pipeline_depth,-1);
ep->bmi_free(ep->bmi,des);
ep->btl_free(ep->btl,des);
OMPI_THREAD_LOCK(&mca_pml_ob1.lock);
ompi_list_append(&mca_pml_ob1.send_pending, (ompi_list_item_t*)sendreq);
OMPI_THREAD_UNLOCK(&mca_pml_ob1.lock);
@ -472,9 +472,9 @@ int mca_pml_ob1_send_request_schedule(mca_pml_ob1_send_request_t* sendreq)
*/
static void mca_pml_ob1_fin_completion(
mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* ep,
struct mca_bmi_base_descriptor_t* des,
mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* ep,
struct mca_btl_base_descriptor_t* des,
int status)
{
@ -491,14 +491,14 @@ static void mca_pml_ob1_fin_completion(
*/
static void mca_pml_ob1_put_completion(
mca_bmi_base_module_t* bmi,
struct mca_bmi_base_endpoint_t* ep,
struct mca_bmi_base_descriptor_t* des,
mca_btl_base_module_t* btl,
struct mca_btl_base_endpoint_t* ep,
struct mca_btl_base_descriptor_t* des,
int status)
{
mca_pml_ob1_rdma_frag_t* frag = (mca_pml_ob1_rdma_frag_t*)des->des_cbdata;
mca_pml_ob1_send_request_t* sendreq = frag->rdma_req;
mca_bmi_base_descriptor_t* fin;
mca_btl_base_descriptor_t* fin;
mca_pml_ob1_fin_hdr_t* hdr;
int rc;
@ -537,7 +537,7 @@ static void mca_pml_ob1_put_completion(
OMPI_THREAD_LOCK(&mca_pml_ob1.lock);
goto cleanup;
}
fin->des_flags |= MCA_BMI_DES_FLAGS_PRIORITY;
fin->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
fin->des_cbfunc = mca_pml_ob1_fin_completion;
fin->des_cbdata = frag;
@ -551,13 +551,13 @@ static void mca_pml_ob1_put_completion(
hdr->hdr_rdma_length = frag->rdma_length;
/* queue request */
rc = bmi->bmi_send(
bmi,
rc = btl->btl_send(
btl,
ep,
fin,
MCA_BMI_TAG_PML);
MCA_BTL_TAG_PML);
if(OMPI_SUCCESS != rc) {
bmi->bmi_free(bmi, fin);
btl->btl_free(btl, fin);
if(rc == OMPI_ERR_OUT_OF_RESOURCE) {
OMPI_THREAD_LOCK(&mca_pml_ob1.lock);
ompi_list_append(&mca_pml_ob1.rdma_pending, (ompi_list_item_t*)frag);
@ -575,7 +575,7 @@ cleanup:
*/
des->des_dst = NULL;
des->des_dst_cnt = 0;
bmi->bmi_free(bmi, des);
btl->btl_free(btl, des);
}
@ -583,19 +583,19 @@ cleanup:
/**
* Receiver has scheduled an RDMA operation:
* (1) Allocate an RDMA fragment to maintain the state of the operation
* (2) Call BMI prepare_src to pin/prepare source buffers
* (2) Call BTL prepare_src to pin/prepare source buffers
* (3) Queue the RDMA put
*/
void mca_pml_ob1_send_request_put(
mca_pml_ob1_send_request_t* sendreq,
mca_bmi_base_module_t* bmi,
mca_btl_base_module_t* btl,
mca_pml_ob1_rdma_hdr_t* hdr)
{
mca_pml_ob1_proc_t* proc = sendreq->req_proc;
mca_pml_ob1_endpoint_t* ep = mca_pml_ob1_ep_array_find(&proc->bmi_rdma,bmi);
mca_pml_ob1_endpoint_t* ep = mca_pml_ob1_ep_array_find(&proc->btl_rdma,btl);
mca_mpool_base_registration_t* reg = NULL;
mca_bmi_base_descriptor_t* des;
mca_btl_base_descriptor_t* des;
mca_pml_ob1_rdma_frag_t* frag;
size_t offset = hdr->hdr_rdma_offset;
size_t i, size = 0;
@ -622,7 +622,7 @@ void mca_pml_ob1_send_request_put(
if(NULL != sendreq->req_chunk) {
mca_mpool_base_reg_mpool_t* mpool = sendreq->req_chunk->mpools;
while(mpool->mpool != NULL) {
if(mpool->user_data == (void*) bmi) {
if(mpool->user_data == (void*) btl) {
reg = mpool->mpool_registration;
break;
}
@ -638,9 +638,9 @@ void mca_pml_ob1_send_request_put(
/* setup descriptor */
ompi_convertor_set_position(&sendreq->req_send.req_convertor, &offset);
des = bmi->bmi_prepare_src(
bmi,
ep->bmi_endpoint,
des = btl->btl_prepare_src(
btl,
ep->btl_endpoint,
reg,
&sendreq->req_send.req_convertor,
0,
@ -665,7 +665,7 @@ void mca_pml_ob1_send_request_put(
sendreq->t_put_index = 0;
#endif
if(OMPI_SUCCESS != (rc = bmi->bmi_put(bmi, ep->bmi_endpoint, des))) {
if(OMPI_SUCCESS != (rc = btl->btl_put(btl, ep->btl_endpoint, des))) {
if(rc == OMPI_ERR_OUT_OF_RESOURCE) {
OMPI_THREAD_LOCK(&mca_pml_ob1.lock);
ompi_list_append(&mca_pml_ob1.rdma_pending, (ompi_list_item_t*)frag);

Просмотреть файл

@ -19,7 +19,7 @@
#ifndef OMPI_PML_OB1_SEND_REQUEST_H
#define OMPI_PML_OB1_SEND_REQUEST_H
#include "mca/bmi/bmi.h"
#include "mca/btl/btl.h"
#include "mca/pml/base/pml_base_sendreq.h"
#include "mca/mpool/base/base.h"
#include "pml_ob1_proc.h"
@ -171,7 +171,7 @@ OBJ_CLASS_DECLARATION(mca_pml_ob1_send_request_t);
mca_pml_ob1_proc_t* proc = sendreq->req_proc; \
\
/* select next endpoint */ \
endpoint = mca_pml_ob1_ep_array_get_next(&proc->bmi_eager); \
endpoint = mca_pml_ob1_ep_array_get_next(&proc->btl_eager); \
sendreq->req_lock = 0; \
MCA_PML_OB1_SEND_REQUEST_TSTAMPS_INIT(sendreq); \
sendreq->req_pipeline_depth = 0; \
@ -253,7 +253,7 @@ int mca_pml_ob1_send_request_schedule(
void mca_pml_ob1_send_request_put(
mca_pml_ob1_send_request_t* sendreq,
mca_bmi_base_module_t* bmi,
mca_btl_base_module_t* btl,
mca_pml_ob1_rdma_hdr_t* hdr);

Просмотреть файл

@ -30,7 +30,7 @@ int mca_pml_ob1_start(size_t count, ompi_request_t** requests)
if(NULL == pml_request)
continue;
/* If the persistent request is currebmiy active - obtain the
/* If the persistent request is currebtly active - obtain the
* request lock and verify the status is incomplete. if the
* pml layer has not completed the request - mark the request
* as free called - so that it will be freed when the request