1
1

Update the MX component using the MX library version 1.0. However, it require a patched version. I will add a configure test to see if the MX is patched or not (not patched version

lack the register_match callback).

This commit was SVN r6357.
Этот коммит содержится в:
George Bosilca 2005-07-06 16:37:48 +00:00
родитель 48cbb249ab
Коммит 8e30d2e7cb
6 изменённых файлов: 60 добавлений и 126 удалений

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

@ -30,20 +30,9 @@ component_noinst = libmca_ptl_mx.la
component_install =
endif
mx_SOURCES = \
ptl_mx.c \
ptl_mx.h \
ptl_mx_component.c \
ptl_mx_module.c \
ptl_mx_module.h \
ptl_mx_peer.c \
ptl_mx_peer.h \
ptl_mx_proc.c \
ptl_mx_proc.h \
ptl_mx_recvfrag.c \
ptl_mx_recvfrag.h \
ptl_mx_sendfrag.c \
ptl_mx_sendfrag.h
mx_SOURCES = ptl_mx.c ptl_mx.h ptl_mx_component.c ptl_mx_module.c ptl_mx_module.h \
ptl_mx_peer.c ptl_mx_peer.h ptl_mx_proc.c ptl_mx_proc.h \
ptl_mx_recvfrag.c ptl_mx_recvfrag.h ptl_mx_sendfrag.c ptl_mx_sendfrag.h
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component_install)

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

@ -18,11 +18,11 @@
#include <unistd.h>
#include <string.h>
#include "include/constants.h"
#include "ompi/include/constants.h"
#include "opal/util/argv.h"
#include "opal/util/output.h"
#include "mca/pml/pml.h"
#include "mca/ptl/ptl.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/ptl/ptl.h"
#include "ptl_mx.h"
#include "ptl_mx_peer.h"
#include "ptl_mx_sendfrag.h"
@ -62,7 +62,7 @@ mca_ptl_mx_module_t mca_ptl_mx_module = {
* Allocate memory for use by the convert.
*/
static void *mca_ptl_mx_alloc(size_t *size)
static void *mca_ptl_mx_alloc( size_t *size, void* user )
{
return malloc(*size);
}
@ -172,21 +172,13 @@ int mca_ptl_mx_send(
if(size > 0) {
ompi_convertor_t *convertor;
struct iovec iov;
unsigned int iov_count;
unsigned int max_data;
uint32_t iov_count;
size_t max_data;
int rc;
convertor = &sendfrag->frag_send.frag_base.frag_convertor;
ompi_convertor_copy(&sendreq->req_send.req_convertor, convertor);
ompi_convertor_init_for_send(
convertor,
0,
sendreq->req_send.req_datatype,
sendreq->req_send.req_count,
sendreq->req_send.req_addr,
offset,
mca_ptl_mx_alloc );
convertor = &sendreq->req_send.req_convertor;
ompi_convertor_personalize( convertor, 0, &offset, mca_ptl_mx_alloc, NULL );
/* if data is contigous convertor will return an offset
* into users buffer - otherwise will return an allocated buffer
* that holds the packed data
@ -195,12 +187,11 @@ int mca_ptl_mx_send(
iov.iov_len = size;
iov_count = 1;
max_data = size;
if((rc = ompi_convertor_pack(
convertor,
&iov,
&iov_count,
&max_data,
&(sendfrag->frag_free))) < 0) {
if((rc = ompi_convertor_pack( convertor,
&iov,
&iov_count,
&max_data,
&(sendfrag->frag_free))) < 0) {
return OMPI_ERROR;
}
sendfrag->frag_segments[1].segment_ptr = iov.iov_base;
@ -340,8 +331,8 @@ int mca_ptl_mx_send_continue(
ompi_ptr_t match;
ompi_convertor_t *convertor;
struct iovec iov;
unsigned int iov_count;
unsigned int max_data;
uint32_t iov_count;
size_t max_data;
int rc;
/* allocate fragment */
@ -353,16 +344,9 @@ int mca_ptl_mx_send_continue(
/* initialize convertor */
convertor = &sendfrag->frag_send.frag_base.frag_convertor;
ompi_convertor_copy(&sendreq->req_send.req_convertor, convertor);
ompi_convertor_init_for_send(
convertor,
0,
sendreq->req_send.req_datatype,
sendreq->req_send.req_count,
sendreq->req_send.req_addr,
offset,
mca_ptl_mx_alloc );
ompi_convertor_clone( &(sendreq->req_send.req_convertor), convertor, 1 );
ompi_convertor_personalize( convertor, 0, &offset, mca_ptl_mx_alloc, NULL );
/* if data is contigous convertor will return an offset
* into users buffer - otherwise will return an allocated buffer
* that holds the packed data
@ -371,12 +355,11 @@ int mca_ptl_mx_send_continue(
iov.iov_len = size;
iov_count = 1;
max_data = size;
if((rc = ompi_convertor_pack(
convertor,
&iov,
&iov_count,
&max_data,
&(sendfrag->frag_free))) < 0) {
if((rc = ompi_convertor_pack( convertor,
&iov,
&iov_count,
&max_data,
&(sendfrag->frag_free))) < 0) {
return OMPI_ERROR;
}
@ -449,7 +432,7 @@ void mca_ptl_mx_matched(
mca_ptl_base_recv_request_t* request = frag->frag_request;
mca_ptl_mx_module_t* mx_ptl = (mca_ptl_mx_module_t*)ptl;
mca_ptl_mx_recv_frag_t* mx_frag = (mca_ptl_mx_recv_frag_t*)frag;
unsigned int bytes_delivered = mx_frag->frag_size;
size_t bytes_delivered = mx_frag->frag_size;
bool ack_pending = false;
/* generate an acknowledgment if required */
@ -491,35 +474,21 @@ void mca_ptl_mx_matched(
/* copy data into users buffer */
if(mx_frag->frag_size > 0) {
struct iovec iov;
unsigned int iov_count = 1;
uint32_t iov_count = 1;
int free_after = 0;
ompi_proc_t *proc = ompi_comm_peer_lookup(request->req_recv.req_base.req_comm,
request->req_recv.req_base.req_ompi.req_status.MPI_SOURCE);
ompi_convertor_t* convertor = &frag->frag_base.frag_convertor;
/* initialize receive convertor */
ompi_convertor_copy(proc->proc_convertor, convertor);
ompi_convertor_init_for_recv(
convertor, /* convertor */
0, /* flags */
request->req_recv.req_base.req_datatype, /* datatype */
request->req_recv.req_base.req_count, /* count elements */
request->req_recv.req_base.req_addr, /* users buffer */
0, /* offset in bytes into packed buffer */
NULL ); /* not allocating memory */
/*ompi_convertor_get_packed_size(convertor, &request->req_bytes_packed); */
ompi_convertor_t* convertor = &(request->req_recv.req_convertor);
/* we do not attach a memory allocation function so the personalization of
* the convertor is not necessary.
*/
iov.iov_base = mx_frag->frag_data;
iov.iov_len = mx_frag->frag_size;
ompi_convertor_unpack(convertor, &iov, &iov_count, &bytes_delivered, &free_after );
}
/* update request status */
ptl->ptl_recv_progress(
ptl,
request,
mx_frag->frag_size,
bytes_delivered);
ptl->ptl_recv_progress( ptl, request,
mx_frag->frag_size, bytes_delivered);
/* release resources */
if(ack_pending == false)

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

@ -92,9 +92,8 @@ extern int mca_ptl_mx_component_close(void);
extern mca_ptl_base_module_t** mca_ptl_mx_component_init(
int *num_ptls,
bool *allow_multi_user_threads,
bool *have_hidden_threads
);
bool allow_multi_user_threads,
bool have_hidden_threads );
/**

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

@ -24,7 +24,7 @@
static mca_ptl_mx_module_t* mca_ptl_mx_create(uint64_t addr);
static void* mca_ptl_mx_mem_alloc( size_t* size )
static void* mca_ptl_mx_mem_alloc( size_t* size, void* userdata )
{
return malloc(*size);
}
@ -50,11 +50,8 @@ int mca_ptl_mx_module_init(void)
}
/* determine the number of NICs */
if((status = mx_get_info(
NULL,
MX_NIC_COUNT,
&mca_ptl_mx_component.mx_num_ptls,
sizeof(uint32_t))) != MX_SUCCESS) {
if((status = mx_get_info( NULL, MX_NIC_COUNT, NULL, 0,
&mca_ptl_mx_component.mx_num_ptls, sizeof(uint32_t))) != MX_SUCCESS) {
opal_output(0, "mca_ptl_mx_init: mx_get_info(MX_NIC_COUNT) failed with status=%d\n", status);
return OMPI_ERROR;
}
@ -63,11 +60,10 @@ int mca_ptl_mx_module_init(void)
size = sizeof(uint64_t) * (mca_ptl_mx_component.mx_num_ptls+1);
if(NULL == (nic_addrs = (uint64_t*)malloc(size)))
return OMPI_ERR_OUT_OF_RESOURCE;
if((status = mx_get_info(
NULL,
MX_NIC_IDS,
nic_addrs,
size)) != MX_SUCCESS) {
if((status = mx_get_info( NULL,
MX_NIC_IDS, NULL, 0,
nic_addrs,
size)) != MX_SUCCESS) {
free(nic_addrs);
return OMPI_ERROR;
}
@ -178,11 +174,11 @@ static void* mca_ptl_mx_thread(opal_object_t *arg)
static void mca_ptl_mx_match(void* context, uint64_t match_value, int size)
{
mca_ptl_mx_module_t* ptl = (mca_ptl_mx_module_t*)context;
mca_ptl_base_recv_request_t* request;
mca_ptl_base_recv_request_t* request;
mca_ptl_mx_recv_frag_t *frag;
mx_return_t mx_return;
ompi_ptr_t match;
uint32_t offset;
size_t offset;
ompi_proc_t* proc;
ompi_convertor_t* convertor;
int rc;
@ -193,9 +189,9 @@ static void mca_ptl_mx_match(void* context, uint64_t match_value, int size)
/* otherwise extract request pointer and offset */
match.lval = match_value;
request = (mca_ptl_base_recv_request_t*)match.sval.uval;
request = (mca_ptl_base_recv_request_t*)match.pval;
offset = match.sval.lval;
proc = ompi_comm_peer_lookup(request->req_base.req_comm,
proc = ompi_comm_peer_lookup(request->req_recv.req_base.req_comm,
request->req_recv.req_base.req_ompi.req_status.MPI_SOURCE);
/* allocate a fragment for receive */
@ -215,16 +211,9 @@ static void mca_ptl_mx_match(void* context, uint64_t match_value, int size)
frag->frag_recv.frag_base.frag_header.hdr_common.hdr_flags = 0;
convertor = &frag->frag_recv.frag_base.frag_convertor;
/* initialize convertor */
ompi_convertor_copy(proc->proc_convertor, convertor);
ompi_convertor_init_for_recv(
convertor,
0, /* flags */
request->req_recv.req_base.req_datatype, /* datatype */
request->req_recv.req_base.req_count, /* count elements */
request->req_recv.req_base.req_addr, /* users buffer */
offset, /* offset in bytes into packed buffer */
mca_ptl_mx_mem_alloc ); /* not allocating memory */
ompi_convertor_clone( &(request->req_recv.req_convertor),
convertor, 1 );
ompi_convertor_personalize( convertor, 0, &offset, mca_ptl_mx_mem_alloc, NULL );
/* non-contiguous - allocate buffer for receive */
if( 1 == ompi_convertor_need_buffers( convertor ) ||
@ -313,11 +302,9 @@ static mca_ptl_mx_module_t* mca_ptl_mx_create(uint64_t addr)
}
/* breakup the endpoint address */
if((status = mx_decompose_endpoint_addr(
ptl->mx_endpoint_addr,
&ptl->mx_nic_addr,
&ptl->mx_endpoint_id,
&ptl->mx_filter)) != MX_SUCCESS) {
if((status = mx_decompose_endpoint_addr( ptl->mx_endpoint_addr,
&ptl->mx_nic_addr,
&ptl->mx_endpoint_id)) != MX_SUCCESS) {
opal_output(0, "mca_ptl_mx_init: mx_decompose_endpoint_addr() failed with status=%d\n", status);
mca_ptl_mx_finalize(&ptl->super);
return NULL;

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

@ -135,7 +135,7 @@ mca_ptl_mx_proc_t* mca_ptl_mx_proc_create(ompi_proc_t* ompi_proc)
* Look for an existing MX process instance based on the globally unique
* process identifier.
*/
mca_ptl_mx_proc_t* mca_ptl_mx_proc_lookup(const ompi_process_name_t *name)
mca_ptl_mx_proc_t* mca_ptl_mx_proc_lookup(const orte_process_name_t *name)
{
mca_ptl_mx_proc_t* proc;
OPAL_THREAD_LOCK(&mca_ptl_mx_component.mx_lock);
@ -165,17 +165,9 @@ int mca_ptl_mx_proc_insert(mca_ptl_mx_proc_t* ptl_proc, mca_ptl_base_peer_t* ptl
/* breakup the endpoint address and reconstruct - otherwise it doesn't
* appear to be initialized correctly for this proc
*/
mx_decompose_endpoint_addr(
ptl_peer->peer_addr,
&mx_nic_addr,
&mx_endpoint_id,
&mx_filter);
memset(&ptl_peer->peer_addr, 0, sizeof(ptl_peer->peer_addr));
mx_compose_endpoint_addr(
mx_nic_addr,
mx_endpoint_id,
mx_filter,
&ptl_peer->peer_addr);
mx_decompose_endpoint_addr( ptl_peer->peer_addr,
&mx_nic_addr,
&mx_endpoint_id );
return OMPI_SUCCESS;
}

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

@ -30,8 +30,6 @@
extern "C" {
#endif
/**
* Represents the state of a remote process and the set of addresses
* that it exports. Also cache an instance of mca_ptl_base_peer_t for each
@ -40,7 +38,7 @@ extern "C" {
struct mca_ptl_mx_proc_t {
opal_list_item_t super; /**< allow proc to be placed on a list */
ompi_proc_t *proc_ompi; /**< pointer to corresponding ompi_proc_t */
ompi_process_name_t proc_name; /**< globally unique identifier for the process */
orte_process_name_t proc_name; /**< globally unique identifier for the process */
mx_endpoint_addr_t *proc_addrs; /**< peer endpoint address */
size_t proc_addr_count; /**< number of addresses published by peer */
mca_ptl_mx_peer_t **proc_peers; /**< array of peers that have been created to access this proc */
@ -54,7 +52,7 @@ OBJ_CLASS_DECLARATION(mca_ptl_mx_proc_t);
mca_ptl_mx_proc_t* mca_ptl_mx_proc_create(ompi_proc_t* ompi_proc);
mca_ptl_mx_proc_t* mca_ptl_mx_proc_lookup(const ompi_process_name_t*);
mca_ptl_mx_proc_t* mca_ptl_mx_proc_lookup(const orte_process_name_t*);
int mca_ptl_mx_proc_insert(mca_ptl_mx_proc_t* ptl_proc, mca_ptl_base_peer_t* ptl_peer);
int mca_ptl_mx_proc_remove(mca_ptl_mx_proc_t* ptl_proc, mca_ptl_base_peer_t* ptl_peer);