1
1

Checking for NULL function pointers and direct-call semantics can't work

together, so implement all functions in the MTL interface for all
MTLs.  The only places NULL was still being set was for add_comm/del_comm,
and matched probe, both of which are straight forward to implement (or
return ERROR_NOT_IMPLEMENTED, since the PML can't emulate matched probe).

This commit was SVN r26194.
Этот коммит содержится в:
Brian Barrett 2012-03-26 19:27:03 +00:00
родитель cdaf110c0f
Коммит 61a090e0d1
22 изменённых файлов: 248 добавлений и 78 удалений

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

@ -197,9 +197,7 @@ typedef int (*mca_mtl_base_module_del_procs_fn_t)(
* \note Open MPI is built around non-blocking operations. This
* function is provided for networks where progressing events outside
* of point-to-point (for example, collectives, I/O, one-sided) can
* occur without a progress function regularily being triggered. If
* this is not the case for the given network, this function pointer
* should be set to NULL and non-blocking sends be used.
* occur without a progress function regularily being triggered.
*
* \note While MPI does not allow users to specify negative tags, they
* are used internally in Open MPI to provide a unique channel for
@ -239,9 +237,8 @@ typedef int (*mca_mtl_base_module_send_fn_t)(
* @param mode (IN) Mode for send operation (see pml.h)
* @param blocking (IN) True if the call originated from a blocking
* call, but the PML decided to use a
* non-blocking operation. This is either for
* internal performance decisions or because the
* blocking send function is NULL. This is an
* non-blocking operation, likely for
* internal performance decisions This is an
* optimization flag and is not needed for
* correctness.
* @param mtl_request (IN) Pointer to mtl_request. The ompi_req field

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

@ -41,6 +41,14 @@ ompi_mtl_mx_del_procs(struct mca_mtl_base_module_t *mtl,
struct ompi_proc_t** procs,
struct mca_mtl_base_endpoint_t **mtl_peer_data);
static int
ompi_mtl_mx_add_comm(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm);
static int
ompi_mtl_mx_del_comm(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm);
mca_mtl_mx_module_t ompi_mtl_mx = {
{
8191, /* max cid - 2^13 - 1 */
@ -58,12 +66,12 @@ mca_mtl_mx_module_t ompi_mtl_mx = {
ompi_mtl_mx_irecv,
ompi_mtl_mx_iprobe,
NULL, /* imrecv */
NULL, /* improbe */
ompi_mtl_mx_imrecv,
ompi_mtl_mx_improbe,
ompi_mtl_mx_cancel,
NULL, /* add_comm */
NULL /* del_comm */
ompi_mtl_mx_add_comm,
ompi_mtl_mx_del_comm
}
};
@ -190,6 +198,20 @@ ompi_mtl_mx_del_procs(struct mca_mtl_base_module_t *mtl,
}
int
ompi_mtl_mx_add_comm(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm)
{
return OMPI_SUCCESS;
}
int
ompi_mtl_mx_del_comm(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm)
{
return OMPI_SUCCESS;
}
int ompi_mtl_mx_progress( void ) {
mx_return_t mx_return;

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

@ -58,6 +58,19 @@ extern int ompi_mtl_mx_iprobe(struct mca_mtl_base_module_t* mtl,
int *flag,
struct ompi_status_public_t *status);
extern int ompi_mtl_mx_imrecv(struct mca_mtl_base_module_t* mtl,
struct opal_convertor_t *convertor,
struct ompi_message_t **message,
struct mca_mtl_request_t *mtl_request);
extern int ompi_mtl_mx_improbe(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm,
int src,
int tag,
int *matched,
struct ompi_message_t **message,
struct ompi_status_public_t *status);
extern int ompi_mtl_mx_cancel(struct mca_mtl_base_module_t* mtl,
struct mca_mtl_request_t *mtl_request,
int flag);

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

@ -71,3 +71,16 @@ ompi_mtl_mx_iprobe(struct mca_mtl_base_module_t* mtl,
return OMPI_SUCCESS;
}
int
ompi_mtl_mx_improbe(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm,
int src,
int tag,
int *matched,
struct ompi_message_t **message,
struct ompi_status_public_t *status)
{
return OMPI_ERR_NOT_IMPLEMENTED;
}

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

@ -78,3 +78,12 @@ ompi_mtl_mx_irecv(struct mca_mtl_base_module_t* mtl,
return OMPI_SUCCESS;
}
int
ompi_mtl_mx_imrecv(struct mca_mtl_base_module_t* mtl,
struct opal_convertor_t *convertor,
struct ompi_message_t **message,
struct mca_mtl_request_t *mtl_request)
{
return OMPI_ERR_NOT_IMPLEMENTED;
}

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

@ -36,8 +36,8 @@ mca_mtl_mxm_module_t ompi_mtl_mxm = {
ompi_mtl_mxm_isend,
ompi_mtl_mxm_irecv,
ompi_mtl_mxm_iprobe,
NULL, /* imrecv */
NULL, /* improbe */
ompi_mtl_mxm_imrecv,
ompi_mtl_mxm_improbe,
ompi_mtl_mxm_cancel,
ompi_mtl_mxm_add_comm,
ompi_mtl_mxm_del_comm

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

@ -59,6 +59,19 @@ extern int ompi_mtl_mxm_iprobe(struct mca_mtl_base_module_t* mtl,
extern int ompi_mtl_mxm_cancel(struct mca_mtl_base_module_t* mtl,
struct mca_mtl_request_t *mtl_request, int flag);
extern int ompi_mtl_mxm_imrecv(struct mca_mtl_base_module_t* mtl,
struct opal_convertor_t *convertor,
struct ompi_message_t **message,
struct mca_mtl_request_t *mtl_request);
extern int ompi_mtl_mxm_improbe(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm,
int src,
int tag,
int *matched,
struct ompi_message_t **message,
struct ompi_status_public_t *status);
extern int ompi_mtl_mxm_add_comm(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm);

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

@ -40,3 +40,15 @@ int ompi_mtl_mxm_iprobe(struct mca_mtl_base_module_t* mtl,
return OMPI_ERROR;
}
}
int ompi_mtl_mxm_improbe(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm,
int src,
int tag,
int *matched,
struct ompi_message_t **message,
struct ompi_status_public_t *status)
{
return OMPI_ERR_NOT_IMPLEMENTED;
}

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

@ -84,3 +84,11 @@ int ompi_mtl_mxm_irecv(struct mca_mtl_base_module_t* mtl,
return OMPI_SUCCESS;
}
int ompi_mtl_mxm_imrecv(struct mca_mtl_base_module_t* mtl,
struct opal_convertor_t *convertor,
struct ompi_message_t **message,
struct mca_mtl_request_t *mtl_request)
{
return OMPI_ERR_NOT_IMPLEMENTED;
}

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

@ -52,12 +52,11 @@ mca_mtl_portals_module_t ompi_mtl_portals = {
ompi_mtl_portals_isend,
ompi_mtl_portals_irecv,
ompi_mtl_portals_iprobe,
NULL, /* imrecv */
NULL, /* improbe */
NULL, /* cancel */
NULL, /* add_comm */
NULL /* del_comm */
ompi_mtl_portals_imrecv,
ompi_mtl_portals_improbe,
ompi_mtl_portals_cancel,
ompi_mtl_portals_add_comm,
ompi_mtl_portals_del_comm
}
};
@ -341,6 +340,32 @@ ompi_mtl_portals_finalize(struct mca_mtl_base_module_t *mtl)
}
int
ompi_mtl_portals_cancel(struct mca_mtl_base_module_t* mtl,
mca_mtl_request_t *mtl_request,
int flag)
{
return OMPI_SUCCESS;
}
int
ompi_mtl_portals_add_comm(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm)
{
return OMPI_SUCCESS;
}
int
ompi_mtl_portals_del_comm(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm)
{
return OMPI_SUCCESS;
}
int
ompi_mtl_portals_progress(void)
{

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

@ -218,10 +218,29 @@ extern int ompi_mtl_portals_iprobe(struct mca_mtl_base_module_t* mtl,
int *flag,
struct ompi_status_public_t *status);
extern int ompi_mtl_portals_imrecv(struct mca_mtl_base_module_t* mtl,
struct opal_convertor_t *convertor,
struct ompi_message_t **message,
struct mca_mtl_request_t *mtl_request);
extern int ompi_mtl_portals_improbe(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm,
int src,
int tag,
int *matched,
struct ompi_message_t **message,
struct ompi_status_public_t *status);
extern int ompi_mtl_portals_cancel(struct mca_mtl_base_module_t* mtl,
mca_mtl_request_t *mtl_request,
int flag);
extern int ompi_mtl_portals_add_comm(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm);
extern int ompi_mtl_portals_del_comm(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm);
extern int ompi_mtl_portals_progress(void);

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

@ -56,3 +56,16 @@ ompi_mtl_portals_iprobe(struct mca_mtl_base_module_t* mtl,
return OMPI_SUCCESS;
}
int
ompi_mtl_portals_improbe(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm,
int src,
int tag,
int *matched,
struct ompi_message_t **message,
struct ompi_status_public_t *status)
{
return OMPI_ERR_NOT_IMPLEMENTED;
}

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

@ -562,3 +562,12 @@ restart_search:
return ret;
}
int
ompi_mtl_portals_imrecv(struct mca_mtl_base_module_t* mtl,
struct opal_convertor_t *convertor,
struct ompi_message_t **message,
struct mca_mtl_request_t *mtl_request)
{
return OMPI_ERR_NOT_IMPLEMENTED;
}

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

@ -47,12 +47,12 @@ mca_mtl_psm_module_t ompi_mtl_psm = {
ompi_mtl_psm_irecv,
ompi_mtl_psm_iprobe,
NULL, /* imrecv */
NULL, /* improbe */
ompi_mtl_psm_imrecv,
ompi_mtl_psm_improbe,
ompi_mtl_psm_cancel,
NULL,
NULL
ompi_mtl_psm_add_comm,
ompi_mtl_psm_del_comm
}
};
@ -364,6 +364,22 @@ ompi_mtl_psm_del_procs(struct mca_mtl_base_module_t *mtl,
}
int
ompi_mtl_psm_add_comm(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm)
{
return OMPI_SUCCESS;
}
int
ompi_mtl_psm_del_comm(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm)
{
return OMPI_SUCCESS;
}
int ompi_mtl_psm_progress( void ) {
psm_error_t err;
mca_mtl_psm_request_t* mtl_psm_request;

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

@ -73,10 +73,29 @@ extern int ompi_mtl_psm_iprobe(struct mca_mtl_base_module_t* mtl,
int *flag,
struct ompi_status_public_t *status);
extern int ompi_mtl_psm_imrecv(struct mca_mtl_base_module_t* mtl,
struct opal_convertor_t *convertor,
struct ompi_message_t **message,
struct mca_mtl_request_t *mtl_request);
extern int ompi_mtl_psm_improbe(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm,
int src,
int tag,
int *matched,
struct ompi_message_t **message,
struct ompi_status_public_t *status);
extern int ompi_mtl_psm_cancel(struct mca_mtl_base_module_t* mtl,
struct mca_mtl_request_t *mtl_request,
int flag);
extern int ompi_mtl_psm_add_comm(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm);
extern int ompi_mtl_psm_del_comm(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm);
extern int ompi_mtl_psm_finalize(struct mca_mtl_base_module_t* mtl);
int ompi_mtl_psm_module_init(int local_rank, int num_local_procs);

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

@ -68,3 +68,16 @@ int ompi_mtl_psm_iprobe(struct mca_mtl_base_module_t* mtl,
else
return OMPI_ERROR;
}
int
ompi_mtl_mxm_improbe(struct mca_mtl_base_module_t *mtl,
struct ompi_communicator_t *comm,
int src,
int tag,
int *matched,
struct ompi_message_t **message,
struct ompi_status_public_t *status)
{
return OMPI_ERR_NOT_IMPLEMENTED;
}

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

@ -80,3 +80,12 @@ ompi_mtl_psm_irecv(struct mca_mtl_base_module_t* mtl,
return OMPI_SUCCESS;
}
int
ompi_mtl_mxm_imrecv(struct mca_mtl_base_module_t* mtl,
struct opal_convertor_t *convertor,
struct ompi_message_t **message,
struct mca_mtl_request_t *mtl_request)
{
return OMPI_ERR_NOT_IMPLEMENTED;
}

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

@ -87,8 +87,6 @@ mca_pml_cm_enable(bool enable)
int
mca_pml_cm_add_comm(ompi_communicator_t* comm)
{
int ret;
/* should never happen, but it was, so check */
if (comm->c_contextid > ompi_pml_cm.super.pml_max_contextid) {
return OMPI_ERR_OUT_OF_RESOURCE;
@ -98,27 +96,15 @@ mca_pml_cm_add_comm(ompi_communicator_t* comm)
comm->c_pml_comm = NULL;
/* notify the MTL about the added communicator */
if ((NULL != ompi_mtl->mtl_add_comm) &&
(OMPI_SUCCESS != (ret = OMPI_MTL_CALL(add_comm(ompi_mtl, comm))))) {
return ret;
}
return OMPI_SUCCESS;
return OMPI_MTL_CALL(add_comm(ompi_mtl, comm));
}
int
mca_pml_cm_del_comm(ompi_communicator_t* comm)
{
int ret;
/* notify the MTL about the deleted communicator */
if ((NULL != ompi_mtl->mtl_del_comm) &&
(OMPI_SUCCESS != (ret = OMPI_MTL_CALL(del_comm(ompi_mtl, comm))))) {
return ret;
}
return OMPI_SUCCESS;
return OMPI_MTL_CALL(del_comm(ompi_mtl, comm));
}

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

@ -178,8 +178,8 @@ mca_pml_cm_component_init(int* priority,
static int
mca_pml_cm_component_fini(void)
{
if (NULL != ompi_mtl && NULL != ompi_mtl->mtl_finalize) {
return ompi_mtl->mtl_finalize(ompi_mtl);
if (NULL != ompi_mtl) {
return OMPI_MTL_CALL(finalize(ompi_mtl));
}
return OMPI_SUCCESS;

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

@ -55,8 +55,6 @@ mca_pml_cm_improbe(int src,
struct ompi_message_t **message,
ompi_status_public_t* status)
{
if (NULL == ompi_mtl->mtl_improbe) return OMPI_ERR_NOT_IMPLEMENTED;
return OMPI_MTL_CALL(improbe(ompi_mtl,
comm, src, tag,
matched, message,
@ -73,8 +71,6 @@ mca_pml_cm_mprobe(int src,
{
int ret, matched = 0;
if (NULL == ompi_mtl->mtl_improbe) return OMPI_ERR_NOT_IMPLEMENTED;
while (true) {
ret = OMPI_MTL_CALL(improbe(ompi_mtl,
comm, src, tag,

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

@ -137,8 +137,6 @@ mca_pml_cm_imrecv(void *buf,
ompi_communicator_t *comm = (*message)->comm;
int peer = (*message)->peer;
if (NULL == ompi_mtl->mtl_imrecv) return OMPI_ERR_NOT_IMPLEMENTED;
MCA_PML_CM_THIN_RECV_REQUEST_ALLOC(recvreq, ret);
if( OPAL_UNLIKELY(OMPI_SUCCESS != ret) ) return ret;
@ -171,8 +169,6 @@ mca_pml_cm_mrecv(void *buf,
ompi_communicator_t *comm = (*message)->comm;
int peer = (*message)->peer;
if (NULL == ompi_mtl->mtl_imrecv) return OMPI_ERR_NOT_IMPLEMENTED;
MCA_PML_CM_THIN_RECV_REQUEST_ALLOC(recvreq, ret);
if( OPAL_UNLIKELY(OMPI_SUCCESS != ret) ) return ret;

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

@ -162,23 +162,6 @@ mca_pml_cm_send(void *buf,
sendmode,
buf,
count);
if (NULL == ompi_mtl->mtl_send) {
MCA_PML_CM_THIN_SEND_REQUEST_START(sendreq,
comm,
tag,
dst,
sendmode,
false,
ret);
if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) {
MCA_PML_CM_THIN_SEND_REQUEST_RETURN(sendreq);
return ret;
}
ompi_request_wait_completion(&sendreq->req_send.req_base.req_ompi);
ompi_request_free( (ompi_request_t**)&sendreq );
} else {
MCA_PML_CM_SEND_REQUEST_START_SETUP((&sendreq->req_send));
ret = OMPI_MTL_CALL(send(ompi_mtl,
@ -191,7 +174,6 @@ mca_pml_cm_send(void *buf,
sendreq->req_send.req_base.req_free_called = true;
MCA_PML_CM_THIN_SEND_REQUEST_PML_COMPLETE(sendreq);
}
}
return ret;
}