2006-07-04 05:20:20 +04:00
|
|
|
/*
|
2007-03-17 02:11:45 +03:00
|
|
|
* Copyright (c) 2006-2007 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2007-07-11 02:16:38 +04:00
|
|
|
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2006-07-04 05:20:20 +04:00
|
|
|
* Copyright (c) 2004-2006 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include "ompi/communicator/communicator.h"
|
|
|
|
#include "ompi/mca/pml/base/pml_base_request.h"
|
|
|
|
#include "ompi/mca/pml/base/pml_base_bsend.h"
|
2007-02-09 19:38:16 +03:00
|
|
|
#include "ompi/mca/pml/base/base.h"
|
2006-07-04 05:20:20 +04:00
|
|
|
|
|
|
|
#include "pml_cm.h"
|
|
|
|
#include "pml_cm_sendreq.h"
|
|
|
|
#include "pml_cm_recvreq.h"
|
|
|
|
|
|
|
|
ompi_pml_cm_t ompi_pml_cm = {
|
|
|
|
{
|
|
|
|
mca_pml_cm_add_procs,
|
|
|
|
mca_pml_cm_del_procs,
|
|
|
|
mca_pml_cm_enable,
|
2007-10-10 03:28:53 +04:00
|
|
|
NULL, /* No progress function. The MTL register their own */
|
2006-07-04 05:20:20 +04:00
|
|
|
mca_pml_cm_add_comm,
|
|
|
|
mca_pml_cm_del_comm,
|
|
|
|
mca_pml_cm_irecv_init,
|
|
|
|
mca_pml_cm_irecv,
|
|
|
|
mca_pml_cm_recv,
|
|
|
|
mca_pml_cm_isend_init,
|
|
|
|
mca_pml_cm_isend,
|
|
|
|
mca_pml_cm_send,
|
|
|
|
mca_pml_cm_iprobe,
|
|
|
|
mca_pml_cm_probe,
|
|
|
|
mca_pml_cm_start,
|
|
|
|
mca_pml_cm_dump,
|
2007-03-17 02:11:45 +03:00
|
|
|
NULL,
|
2006-07-04 05:20:20 +04:00
|
|
|
0,
|
|
|
|
0
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
mca_pml_cm_enable(bool enable)
|
|
|
|
{
|
|
|
|
/* BWB - FIX ME - need to have this actually do something,
|
|
|
|
maybe? */
|
2007-11-02 02:38:50 +03:00
|
|
|
ompi_free_list_init_new(&mca_pml_base_send_requests,
|
2007-07-11 04:04:33 +04:00
|
|
|
sizeof(mca_pml_cm_hvy_send_request_t) + ompi_mtl->mtl_request_size,
|
2007-11-02 02:38:50 +03:00
|
|
|
CACHE_LINE_SIZE,
|
2007-07-11 03:45:23 +04:00
|
|
|
OBJ_CLASS(mca_pml_cm_hvy_send_request_t),
|
2007-11-02 02:38:50 +03:00
|
|
|
0,CACHE_LINE_SIZE,
|
2007-07-11 03:45:23 +04:00
|
|
|
ompi_pml_cm.free_list_num,
|
|
|
|
ompi_pml_cm.free_list_max,
|
|
|
|
ompi_pml_cm.free_list_inc,
|
|
|
|
NULL);
|
|
|
|
|
2007-11-02 02:38:50 +03:00
|
|
|
ompi_free_list_init_new(&mca_pml_base_recv_requests,
|
2007-07-11 04:04:33 +04:00
|
|
|
sizeof(mca_pml_cm_hvy_recv_request_t) + ompi_mtl->mtl_request_size,
|
2007-11-02 02:38:50 +03:00
|
|
|
CACHE_LINE_SIZE,
|
2007-07-11 03:45:23 +04:00
|
|
|
OBJ_CLASS(mca_pml_cm_hvy_recv_request_t),
|
2007-11-02 02:38:50 +03:00
|
|
|
0,CACHE_LINE_SIZE,
|
2007-07-11 03:45:23 +04:00
|
|
|
ompi_pml_cm.free_list_num,
|
|
|
|
ompi_pml_cm.free_list_max,
|
|
|
|
ompi_pml_cm.free_list_inc,
|
|
|
|
NULL);
|
|
|
|
|
2006-07-04 05:20:20 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
mca_pml_cm_add_comm(ompi_communicator_t* comm)
|
|
|
|
{
|
2009-04-30 23:23:57 +04:00
|
|
|
/* 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;
|
|
|
|
}
|
|
|
|
|
2006-07-04 05:20:20 +04:00
|
|
|
/* setup our per-communicator data */
|
|
|
|
comm->c_pml_comm = NULL;
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
mca_pml_cm_del_comm(ompi_communicator_t* comm)
|
|
|
|
{
|
|
|
|
/* clean up our per-communicator data */
|
|
|
|
comm->c_pml_comm = NULL;
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
mca_pml_cm_add_procs(struct ompi_proc_t** procs, size_t nprocs)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
size_t i;
|
|
|
|
struct mca_mtl_base_endpoint_t **endpoints;
|
|
|
|
|
2006-12-30 19:17:56 +03:00
|
|
|
#if OMPI_ENABLE_HETEROGENEOUS_SUPPORT
|
|
|
|
for (i = 0 ; i < nprocs ; ++i) {
|
|
|
|
if (procs[i]->proc_arch != ompi_proc_local()->proc_arch) {
|
|
|
|
return OMPI_ERR_NOT_SUPPORTED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-02-09 19:38:16 +03:00
|
|
|
/* make sure remote procs are using the same PML as us */
|
|
|
|
if (OMPI_SUCCESS != (ret = mca_pml_base_pml_check_selected("cm",
|
|
|
|
procs,
|
|
|
|
nprocs))) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2006-08-24 20:38:08 +04:00
|
|
|
endpoints = (struct mca_mtl_base_endpoint_t**)malloc(nprocs * sizeof(struct mca_mtl_base_endpoint_t*));
|
2006-07-04 05:20:20 +04:00
|
|
|
if (NULL == endpoints) return OMPI_ERROR;
|
|
|
|
|
|
|
|
#if OMPI_ENABLE_DEBUG
|
|
|
|
for (i = 0 ; i < nprocs ; ++i) {
|
|
|
|
endpoints[i] = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ret = OMPI_MTL_CALL(add_procs(ompi_mtl, nprocs, procs, endpoints));
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
free(endpoints);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0 ; i < nprocs ; ++i) {
|
|
|
|
procs[i]->proc_pml = (struct mca_pml_base_endpoint_t*) endpoints[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
free(endpoints);
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
mca_pml_cm_del_procs(struct ompi_proc_t** procs, size_t nprocs)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
size_t i;
|
|
|
|
struct mca_mtl_base_endpoint_t **endpoints;
|
|
|
|
|
2006-08-24 20:38:08 +04:00
|
|
|
endpoints = (struct mca_mtl_base_endpoint_t**)malloc(nprocs * sizeof(struct mca_mtl_base_endpoint_t*));
|
2006-07-04 05:20:20 +04:00
|
|
|
if (NULL == endpoints) return OMPI_ERROR;
|
|
|
|
|
|
|
|
for (i = 0 ; i < nprocs ; ++i) {
|
|
|
|
endpoints[i] = (struct mca_mtl_base_endpoint_t*) procs[i]->proc_pml;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = OMPI_MTL_CALL(del_procs(ompi_mtl, nprocs, procs, endpoints));
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
free(endpoints);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
free(endpoints);
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* print any available useful information from this communicator */
|
|
|
|
int
|
|
|
|
mca_pml_cm_dump(struct ompi_communicator_t* comm, int verbose)
|
|
|
|
{
|
|
|
|
return OMPI_ERR_NOT_IMPLEMENTED;
|
|
|
|
}
|