2010-10-15 02:49:09 +04:00
|
|
|
/*
|
2010-12-07 23:11:25 +03:00
|
|
|
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
|
|
|
* 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.
|
2012-03-23 02:55:59 +04:00
|
|
|
* Copyright (c) 2010-2012 Sandia National Laboratories. All rights reserved.
|
2010-10-15 02:49:09 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include <portals4.h>
|
|
|
|
|
2011-06-01 21:20:18 +04:00
|
|
|
#include "ompi/proc/proc.h"
|
2010-10-15 02:49:09 +04:00
|
|
|
#include "ompi/mca/mtl/mtl.h"
|
2010-12-07 23:11:25 +03:00
|
|
|
#include "opal/class/opal_list.h"
|
2011-05-26 02:10:27 +04:00
|
|
|
#include "ompi/runtime/ompi_module_exchange.h"
|
2010-10-15 02:49:09 +04:00
|
|
|
|
|
|
|
#include "mtl_portals4.h"
|
|
|
|
#include "mtl_portals4_endpoint.h"
|
2010-12-07 23:11:25 +03:00
|
|
|
#include "mtl_portals4_recv_short.h"
|
2010-10-15 02:49:09 +04:00
|
|
|
|
2011-05-26 02:10:27 +04:00
|
|
|
extern mca_mtl_base_component_2_0_0_t mca_mtl_portals4_component;
|
|
|
|
|
2010-10-15 02:49:09 +04:00
|
|
|
mca_mtl_portals4_module_t ompi_mtl_portals4 = {
|
|
|
|
{
|
|
|
|
8191, /* max cid - 2^13 - 1 */
|
|
|
|
(1UL << 30), /* max tag value - must allow negatives */
|
|
|
|
0, /* request reserve space */
|
|
|
|
0, /* flags */
|
|
|
|
|
|
|
|
ompi_mtl_portals4_add_procs,
|
|
|
|
ompi_mtl_portals4_del_procs,
|
|
|
|
ompi_mtl_portals4_finalize,
|
|
|
|
|
2012-03-26 23:19:11 +04:00
|
|
|
ompi_mtl_portals4_send,
|
2010-10-15 02:49:09 +04:00
|
|
|
ompi_mtl_portals4_isend,
|
|
|
|
ompi_mtl_portals4_irecv,
|
|
|
|
ompi_mtl_portals4_iprobe,
|
2012-03-23 02:55:59 +04:00
|
|
|
ompi_mtl_portals4_imrecv,
|
|
|
|
ompi_mtl_portals4_improbe,
|
2010-10-15 02:49:09 +04:00
|
|
|
|
2011-11-11 06:49:03 +04:00
|
|
|
ompi_mtl_portals4_cancel,
|
2012-03-23 02:55:59 +04:00
|
|
|
ompi_mtl_portals4_add_comm,
|
|
|
|
ompi_mtl_portals4_del_comm
|
2010-10-15 02:49:09 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
ompi_mtl_portals4_add_procs(struct mca_mtl_base_module_t *mtl,
|
2010-12-07 23:11:25 +03:00
|
|
|
size_t nprocs,
|
|
|
|
struct ompi_proc_t** procs,
|
|
|
|
struct mca_mtl_base_endpoint_t **mtl_peer_data)
|
2010-10-15 02:49:09 +04:00
|
|
|
{
|
2012-03-26 05:31:58 +04:00
|
|
|
int ret, me;
|
2010-12-07 23:11:25 +03:00
|
|
|
size_t i;
|
|
|
|
|
|
|
|
/* Get the list of ptl_process_id_t from the runtime and copy into structure */
|
|
|
|
for (i = 0 ; i < nprocs ; ++i) {
|
2011-05-26 02:10:27 +04:00
|
|
|
ptl_process_t *id;
|
|
|
|
size_t size;
|
|
|
|
|
2012-03-26 05:31:58 +04:00
|
|
|
if( procs[i] == ompi_proc_local_proc ) {
|
|
|
|
me = i;
|
|
|
|
}
|
|
|
|
|
2011-06-01 21:20:18 +04:00
|
|
|
if (procs[i]->proc_arch != ompi_proc_local()->proc_arch) {
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
2011-09-30 02:26:33 +04:00
|
|
|
"Portals 4 MTL does not support heterogeneous operations.");
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
2011-09-30 02:26:33 +04:00
|
|
|
"Proc %s architecture %x, mine %x.",
|
2013-01-28 03:25:10 +04:00
|
|
|
OMPI_NAME_PRINT(&procs[i]->proc_name),
|
2011-09-30 02:26:33 +04:00
|
|
|
procs[i]->proc_arch, ompi_proc_local()->proc_arch);
|
2011-06-13 19:18:55 +04:00
|
|
|
return OMPI_ERR_NOT_SUPPORTED;
|
2011-06-01 21:20:18 +04:00
|
|
|
}
|
|
|
|
|
2010-12-07 23:11:25 +03:00
|
|
|
mtl_peer_data[i] = malloc(sizeof(struct mca_mtl_base_endpoint_t));
|
|
|
|
if (NULL == mtl_peer_data[i]) {
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
2011-09-30 02:26:33 +04:00
|
|
|
"%s:%d: malloc failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
2011-06-13 19:18:55 +04:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2010-12-07 23:11:25 +03:00
|
|
|
}
|
2011-05-26 02:10:27 +04:00
|
|
|
|
|
|
|
ret = ompi_modex_recv(&mca_mtl_portals4_component.mtl_version,
|
|
|
|
procs[i], (void**) &id, &size);
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
2011-09-30 02:26:33 +04:00
|
|
|
"%s:%d: ompi_modex_recv failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
2011-05-26 02:10:27 +04:00
|
|
|
return ret;
|
|
|
|
} else if (sizeof(ptl_process_t) != size) {
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
2011-09-30 02:26:33 +04:00
|
|
|
"%s:%d: ompi_modex_recv failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
2011-06-13 19:18:55 +04:00
|
|
|
return OMPI_ERR_BAD_PARAM;
|
2011-05-26 02:10:27 +04:00
|
|
|
}
|
2012-03-26 05:31:58 +04:00
|
|
|
|
2011-05-26 02:10:27 +04:00
|
|
|
mtl_peer_data[i]->ptl_proc = *id;
|
2010-10-15 02:49:09 +04:00
|
|
|
}
|
|
|
|
|
2012-03-26 05:31:58 +04:00
|
|
|
#if OMPI_MTL_PORTALS4_FLOW_CONTROL
|
|
|
|
ret = ompi_mtl_portals4_flowctl_add_procs(me, nprocs, mtl_peer_data);
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
2012-03-26 05:31:58 +04:00
|
|
|
"%s:%d: flowctl_add_procs failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-10-15 02:49:09 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
ompi_mtl_portals4_del_procs(struct mca_mtl_base_module_t *mtl,
|
2010-12-07 23:11:25 +03:00
|
|
|
size_t nprocs,
|
|
|
|
struct ompi_proc_t** procs,
|
|
|
|
struct mca_mtl_base_endpoint_t **mtl_peer_data)
|
2010-10-15 02:49:09 +04:00
|
|
|
{
|
2010-12-07 23:11:25 +03:00
|
|
|
size_t i;
|
|
|
|
|
|
|
|
for (i = 0 ; i < nprocs ; ++i) {
|
|
|
|
if (NULL != mtl_peer_data[i]) {
|
|
|
|
free(mtl_peer_data[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-15 02:49:09 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
ompi_mtl_portals4_finalize(struct mca_mtl_base_module_t *mtl)
|
|
|
|
{
|
2010-12-07 23:11:25 +03:00
|
|
|
opal_progress_unregister(ompi_mtl_portals4_progress);
|
|
|
|
while (0 != ompi_mtl_portals4_progress()) { }
|
|
|
|
|
2012-03-26 05:31:58 +04:00
|
|
|
#if OMPI_MTL_PORTALS4_FLOW_CONTROL
|
|
|
|
ompi_mtl_portals4_flowctl_fini();
|
|
|
|
#endif
|
2012-03-22 02:20:55 +04:00
|
|
|
ompi_mtl_portals4_recv_short_fini();
|
2011-06-13 19:18:55 +04:00
|
|
|
|
2010-12-07 23:11:25 +03:00
|
|
|
PtlMEUnlink(ompi_mtl_portals4.long_overflow_me_h);
|
|
|
|
PtlMDRelease(ompi_mtl_portals4.zero_md_h);
|
2013-02-27 21:02:45 +04:00
|
|
|
|
|
|
|
if (0 != ompi_mtl_portals4.fixed_md_h) {
|
|
|
|
int i, fixed_md_nb;
|
|
|
|
|
|
|
|
if (MEMORY_MAX_SIZE > ompi_mtl_portals4.fixed_md_distance) fixed_md_nb = MEMORY_MAX_SIZE/ompi_mtl_portals4.fixed_md_distance;
|
|
|
|
else fixed_md_nb = 1;
|
|
|
|
for (i=0; i< fixed_md_nb; i++) PtlMDRelease(ompi_mtl_portals4.fixed_md_h[i]);
|
|
|
|
free(ompi_mtl_portals4.fixed_md_h);
|
|
|
|
}
|
|
|
|
|
2011-06-13 19:18:55 +04:00
|
|
|
PtlPTFree(ompi_mtl_portals4.ni_h, ompi_mtl_portals4.read_idx);
|
2012-04-18 05:05:18 +04:00
|
|
|
PtlPTFree(ompi_mtl_portals4.ni_h, ompi_mtl_portals4.recv_idx);
|
2012-03-22 02:20:55 +04:00
|
|
|
PtlEQFree(ompi_mtl_portals4.send_eq_h);
|
|
|
|
PtlEQFree(ompi_mtl_portals4.recv_eq_h);
|
2010-12-07 23:11:25 +03:00
|
|
|
PtlNIFini(ompi_mtl_portals4.ni_h);
|
2010-10-15 02:49:09 +04:00
|
|
|
PtlFini();
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2010-12-07 23:11:25 +03:00
|
|
|
|
2012-03-22 02:20:55 +04:00
|
|
|
|
2012-03-23 02:55:59 +04:00
|
|
|
int
|
|
|
|
ompi_mtl_portals4_add_comm(struct mca_mtl_base_module_t *mtl,
|
|
|
|
struct ompi_communicator_t *comm)
|
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ompi_mtl_portals4_del_comm(struct mca_mtl_base_module_t *mtl,
|
|
|
|
struct ompi_communicator_t *comm)
|
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|