2012-06-21 21:09:12 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2006-07-18 02:08:55 +04:00
|
|
|
/*
|
2007-03-17 02:11:45 +03:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University.
|
2006-07-18 02:08:55 +04:00
|
|
|
* All rights reserved.
|
2008-11-05 00:58:06 +03:00
|
|
|
* Copyright (c) 2004-2008 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2014-11-05 19:59:12 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2006-07-18 02:08:55 +04:00
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2015-02-19 23:41:41 +03:00
|
|
|
* Copyright (c) 2007-2015 Los Alamos National Security, LLC. All rights
|
2014-11-05 19:59:12 +03:00
|
|
|
* reserved.
|
2008-11-05 00:58:06 +03:00
|
|
|
* Copyright (c) 2006-2008 University of Houston. All rights reserved.
|
2010-08-24 22:10:43 +04:00
|
|
|
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
|
2014-02-25 21:36:43 +04:00
|
|
|
* Copyright (c) 2012-2013 Sandia National Laboratories. All rights reserved.
|
2015-05-08 03:19:02 +03:00
|
|
|
* Copyright (c) 2015 Research Organization for Information Science
|
|
|
|
* and Technology (RIST). All rights reserved.
|
2007-01-05 01:07:37 +03:00
|
|
|
* $COPYRIGHT$
|
2014-11-05 19:59:12 +03:00
|
|
|
*
|
2006-07-18 02:08:55 +04:00
|
|
|
* Additional copyrights may follow
|
2014-11-05 19:59:12 +03:00
|
|
|
*
|
2006-07-18 02:08:55 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
#include "osc_pt2pt.h"
|
|
|
|
#include "osc_pt2pt_data_move.h"
|
|
|
|
#include "osc_pt2pt_frag.h"
|
|
|
|
#include "osc_pt2pt_request.h"
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2007-05-24 19:41:24 +04:00
|
|
|
#include "opal/threads/condition.h"
|
2006-07-18 02:08:55 +04:00
|
|
|
#include "opal/threads/mutex.h"
|
2008-04-18 00:43:56 +04:00
|
|
|
#include "opal/util/arch.h"
|
2010-08-24 22:10:43 +04:00
|
|
|
#include "opal/align.h"
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
#include "opal/mca/btl/btl.h"
|
2008-04-18 00:43:56 +04:00
|
|
|
|
2006-07-18 02:08:55 +04:00
|
|
|
#include "ompi/info/info.h"
|
|
|
|
#include "ompi/communicator/communicator.h"
|
|
|
|
#include "ompi/mca/osc/osc.h"
|
2006-08-17 18:52:20 +04:00
|
|
|
#include "ompi/mca/osc/base/base.h"
|
2007-07-14 00:46:12 +04:00
|
|
|
#include "ompi/mca/osc/base/osc_base_obj_convert.h"
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
#include "opal/mca/btl/btl.h"
|
2011-07-01 00:05:16 +04:00
|
|
|
#include "ompi/mca/pml/pml.h"
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
static int component_open(void);
|
2013-03-28 01:09:41 +04:00
|
|
|
static int component_register(void);
|
2014-02-25 21:36:43 +04:00
|
|
|
static int component_init(bool enable_progress_threads, bool enable_mpi_threads);
|
|
|
|
static int component_finalize(void);
|
|
|
|
static int component_query(struct ompi_win_t *win, void **base, size_t size, int disp_unit,
|
|
|
|
struct ompi_communicator_t *comm, struct ompi_info_t *info,
|
|
|
|
int flavor);
|
|
|
|
static int component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit,
|
|
|
|
struct ompi_communicator_t *comm, struct ompi_info_t *info,
|
|
|
|
int flavor, int *model);
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
ompi_osc_pt2pt_component_t mca_osc_pt2pt_component = {
|
2006-07-18 02:08:55 +04:00
|
|
|
{ /* ompi_osc_base_component_t */
|
2015-04-18 18:36:05 +03:00
|
|
|
.osc_version = {
|
2014-02-25 21:36:43 +04:00
|
|
|
OMPI_OSC_BASE_VERSION_3_0_0,
|
2015-04-18 18:36:05 +03:00
|
|
|
.mca_component_name = "pt2pt",
|
|
|
|
MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
|
|
|
|
OMPI_RELEASE_VERSION),
|
|
|
|
.mca_open_component = component_open,
|
|
|
|
.mca_register_component_params = component_register,
|
2006-07-18 02:08:55 +04:00
|
|
|
},
|
2015-04-18 18:36:05 +03:00
|
|
|
.osc_data = {
|
2007-03-17 02:11:45 +03:00
|
|
|
/* The component is not checkpoint ready */
|
|
|
|
MCA_BASE_METADATA_PARAM_NONE
|
2006-07-18 02:08:55 +04:00
|
|
|
},
|
2015-04-18 18:36:05 +03:00
|
|
|
.osc_init = component_init,
|
|
|
|
.osc_query = component_query,
|
|
|
|
.osc_select = component_select,
|
|
|
|
.osc_finalize = component_finalize,
|
2006-07-18 02:08:55 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
ompi_osc_pt2pt_module_t ompi_osc_pt2pt_module_template = {
|
2006-07-18 02:08:55 +04:00
|
|
|
{
|
2014-02-25 21:36:43 +04:00
|
|
|
NULL, /* shared_query */
|
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
ompi_osc_pt2pt_attach,
|
|
|
|
ompi_osc_pt2pt_detach,
|
|
|
|
ompi_osc_pt2pt_free,
|
|
|
|
|
|
|
|
ompi_osc_pt2pt_put,
|
|
|
|
ompi_osc_pt2pt_get,
|
|
|
|
ompi_osc_pt2pt_accumulate,
|
|
|
|
ompi_osc_pt2pt_compare_and_swap,
|
|
|
|
ompi_osc_pt2pt_fetch_and_op,
|
|
|
|
ompi_osc_pt2pt_get_accumulate,
|
|
|
|
|
|
|
|
ompi_osc_pt2pt_rput,
|
|
|
|
ompi_osc_pt2pt_rget,
|
|
|
|
ompi_osc_pt2pt_raccumulate,
|
|
|
|
ompi_osc_pt2pt_rget_accumulate,
|
|
|
|
|
|
|
|
ompi_osc_pt2pt_fence,
|
|
|
|
|
|
|
|
ompi_osc_pt2pt_start,
|
|
|
|
ompi_osc_pt2pt_complete,
|
|
|
|
ompi_osc_pt2pt_post,
|
|
|
|
ompi_osc_pt2pt_wait,
|
|
|
|
ompi_osc_pt2pt_test,
|
|
|
|
|
|
|
|
ompi_osc_pt2pt_lock,
|
|
|
|
ompi_osc_pt2pt_unlock,
|
|
|
|
ompi_osc_pt2pt_lock_all,
|
|
|
|
ompi_osc_pt2pt_unlock_all,
|
|
|
|
|
|
|
|
ompi_osc_pt2pt_sync,
|
|
|
|
ompi_osc_pt2pt_flush,
|
|
|
|
ompi_osc_pt2pt_flush_all,
|
|
|
|
ompi_osc_pt2pt_flush_local,
|
|
|
|
ompi_osc_pt2pt_flush_local_all,
|
|
|
|
|
|
|
|
ompi_osc_pt2pt_set_info,
|
|
|
|
ompi_osc_pt2pt_get_info
|
2006-07-18 02:08:55 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-05-08 03:19:02 +03:00
|
|
|
bool ompi_osc_pt2pt_no_locks = false;
|
2006-07-18 02:08:55 +04:00
|
|
|
|
|
|
|
/* look up parameters for configuring this window. The code first
|
|
|
|
looks in the info structure passed by the user, then through mca
|
|
|
|
parameters. */
|
|
|
|
static bool
|
|
|
|
check_config_value_bool(char *key, ompi_info_t *info)
|
|
|
|
{
|
|
|
|
char *value_string;
|
|
|
|
int value_len, ret, flag, param;
|
2013-03-28 01:09:41 +04:00
|
|
|
const bool *flag_value;
|
2006-07-18 02:08:55 +04:00
|
|
|
bool result;
|
|
|
|
|
|
|
|
ret = ompi_info_get_valuelen(info, key, &value_len, &flag);
|
|
|
|
if (OMPI_SUCCESS != ret) goto info_not_found;
|
|
|
|
if (flag == 0) goto info_not_found;
|
|
|
|
value_len++;
|
|
|
|
|
2009-05-05 17:05:20 +04:00
|
|
|
value_string = (char*)malloc(sizeof(char) * value_len + 1); /* Should malloc 1 char for NUL-termination */
|
2006-07-18 02:08:55 +04:00
|
|
|
if (NULL == value_string) goto info_not_found;
|
|
|
|
|
|
|
|
ret = ompi_info_get(info, key, value_len, value_string, &flag);
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
free(value_string);
|
|
|
|
goto info_not_found;
|
|
|
|
}
|
|
|
|
assert(flag != 0);
|
|
|
|
ret = ompi_info_value_to_bool(value_string, &result);
|
|
|
|
free(value_string);
|
|
|
|
if (OMPI_SUCCESS != ret) goto info_not_found;
|
|
|
|
return result;
|
|
|
|
|
|
|
|
info_not_found:
|
2014-11-05 19:59:12 +03:00
|
|
|
param = mca_base_var_find("ompi", "osc", "pt2pt", key);
|
2010-05-19 00:54:11 +04:00
|
|
|
if (0 > param) return false;
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
ret = mca_base_var_get_value(param, &flag_value, NULL, NULL);
|
2006-07-18 02:08:55 +04:00
|
|
|
if (OMPI_SUCCESS != ret) return false;
|
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
return flag_value[0];
|
2006-07-18 02:08:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2014-02-25 21:36:43 +04:00
|
|
|
component_open(void)
|
2006-07-18 02:08:55 +04:00
|
|
|
{
|
2014-02-25 21:36:43 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2013-03-28 01:09:41 +04:00
|
|
|
|
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
static int
|
|
|
|
component_register(void)
|
|
|
|
{
|
2014-11-05 19:59:12 +03:00
|
|
|
ompi_osc_pt2pt_no_locks = false;
|
|
|
|
(void) mca_base_component_var_register(&mca_osc_pt2pt_component.super.osc_version,
|
2013-03-28 01:09:41 +04:00
|
|
|
"no_locks",
|
|
|
|
"Enable optimizations available only if MPI_LOCK is "
|
|
|
|
"not used. "
|
|
|
|
"Info key of same name overrides this value.",
|
|
|
|
MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
|
|
|
|
OPAL_INFO_LVL_9,
|
|
|
|
MCA_BASE_VAR_SCOPE_READONLY,
|
2014-11-05 19:59:12 +03:00
|
|
|
&ompi_osc_pt2pt_no_locks);
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
mca_osc_pt2pt_component.buffer_size = 8192;
|
|
|
|
(void) mca_base_component_var_register (&mca_osc_pt2pt_component.super.osc_version, "buffer_size",
|
2014-02-25 21:36:43 +04:00
|
|
|
"Data transfers smaller than this limit may be coalesced before "
|
|
|
|
"being transferred (default: 8k)", MCA_BASE_VAR_TYPE_UNSIGNED_INT,
|
|
|
|
NULL, 0, 0, OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
|
2014-11-05 19:59:12 +03:00
|
|
|
&mca_osc_pt2pt_component.buffer_size);
|
2014-02-25 21:36:43 +04:00
|
|
|
|
2006-07-18 02:08:55 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
static int component_progress (void)
|
2006-07-18 02:08:55 +04:00
|
|
|
{
|
2014-11-14 01:13:10 +03:00
|
|
|
int count = opal_list_get_size (&mca_osc_pt2pt_component.pending_operations);
|
2014-11-05 19:59:12 +03:00
|
|
|
ompi_osc_pt2pt_pending_t *pending, *next;
|
2014-02-25 21:36:43 +04:00
|
|
|
|
2014-11-14 01:13:10 +03:00
|
|
|
if (0 == count) {
|
2014-02-25 21:36:43 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-03-13 01:43:23 +04:00
|
|
|
/* process one incoming request */
|
2014-11-14 01:13:10 +03:00
|
|
|
OPAL_THREAD_LOCK(&mca_osc_pt2pt_component.pending_operations_lock);
|
2014-11-05 19:59:12 +03:00
|
|
|
OPAL_LIST_FOREACH_SAFE(pending, next, &mca_osc_pt2pt_component.pending_operations, ompi_osc_pt2pt_pending_t) {
|
2014-02-25 21:36:43 +04:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
switch (pending->header.base.type) {
|
2014-11-05 19:59:12 +03:00
|
|
|
case OMPI_OSC_PT2PT_HDR_TYPE_FLUSH_REQ:
|
|
|
|
ret = ompi_osc_pt2pt_process_flush (pending->module, pending->source,
|
2014-02-25 21:36:43 +04:00
|
|
|
&pending->header.flush);
|
|
|
|
break;
|
2014-11-05 19:59:12 +03:00
|
|
|
case OMPI_OSC_PT2PT_HDR_TYPE_UNLOCK_REQ:
|
|
|
|
ret = ompi_osc_pt2pt_process_unlock (pending->module, pending->source,
|
2014-02-25 21:36:43 +04:00
|
|
|
&pending->header.unlock);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* shouldn't happen */
|
|
|
|
assert (0);
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (OMPI_SUCCESS == ret) {
|
2014-11-05 19:59:12 +03:00
|
|
|
opal_list_remove_item (&mca_osc_pt2pt_component.pending_operations, &pending->super);
|
2014-02-25 21:36:43 +04:00
|
|
|
OBJ_RELEASE(pending);
|
|
|
|
}
|
|
|
|
}
|
2014-11-14 01:13:10 +03:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_osc_pt2pt_component.pending_operations_lock);
|
2014-02-25 21:36:43 +04:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
static int
|
|
|
|
component_init(bool enable_progress_threads,
|
|
|
|
bool enable_mpi_threads)
|
|
|
|
{
|
|
|
|
int ret;
|
2007-05-24 19:41:24 +04:00
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
OBJ_CONSTRUCT(&mca_osc_pt2pt_component.lock, opal_mutex_t);
|
|
|
|
OBJ_CONSTRUCT(&mca_osc_pt2pt_component.pending_operations, opal_list_t);
|
2014-11-14 01:13:10 +03:00
|
|
|
OBJ_CONSTRUCT(&mca_osc_pt2pt_component.pending_operations_lock, opal_mutex_t);
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
OBJ_CONSTRUCT(&mca_osc_pt2pt_component.modules,
|
2014-02-25 21:36:43 +04:00
|
|
|
opal_hash_table_t);
|
2014-11-05 19:59:12 +03:00
|
|
|
opal_hash_table_init(&mca_osc_pt2pt_component.modules, 2);
|
2014-11-20 09:22:43 +03:00
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
mca_osc_pt2pt_component.progress_enable = false;
|
|
|
|
mca_osc_pt2pt_component.module_count = 0;
|
2014-11-20 09:22:43 +03:00
|
|
|
|
2015-02-19 23:41:41 +03:00
|
|
|
OBJ_CONSTRUCT(&mca_osc_pt2pt_component.frags, opal_free_list_t);
|
|
|
|
ret = opal_free_list_init (&mca_osc_pt2pt_component.frags,
|
|
|
|
sizeof(ompi_osc_pt2pt_frag_t), 8,
|
|
|
|
OBJ_CLASS(ompi_osc_pt2pt_frag_t),
|
|
|
|
mca_osc_pt2pt_component.buffer_size +
|
|
|
|
sizeof (ompi_osc_pt2pt_frag_header_t),
|
|
|
|
8, 1, -1, 1, NULL, 0, NULL, NULL, NULL);
|
2014-02-25 21:36:43 +04:00
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
opal_output_verbose(1, ompi_osc_base_framework.framework_output,
|
2015-02-19 23:41:41 +03:00
|
|
|
"%s:%d: opal_free_list_init failed: %d",
|
2014-02-25 21:36:43 +04:00
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
2007-05-24 19:41:24 +04:00
|
|
|
|
2015-02-19 23:41:41 +03:00
|
|
|
OBJ_CONSTRUCT(&mca_osc_pt2pt_component.requests, opal_free_list_t);
|
|
|
|
ret = opal_free_list_init (&mca_osc_pt2pt_component.requests,
|
|
|
|
sizeof(ompi_osc_pt2pt_request_t), 8,
|
|
|
|
OBJ_CLASS(ompi_osc_pt2pt_request_t),
|
|
|
|
0, 0, 0, -1, 32, NULL, 0, NULL, NULL, NULL);
|
2014-02-25 21:36:43 +04:00
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
opal_output_verbose(1, ompi_osc_base_framework.framework_output,
|
2015-02-19 23:41:41 +03:00
|
|
|
"%s:%d: opal_free_list_init failed: %d\n",
|
2014-02-25 21:36:43 +04:00
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
2007-07-03 02:22:59 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
return ret;
|
2006-07-18 02:08:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
int
|
2014-02-25 21:36:43 +04:00
|
|
|
component_finalize(void)
|
2006-07-18 02:08:55 +04:00
|
|
|
{
|
|
|
|
size_t num_modules;
|
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
if (mca_osc_pt2pt_component.progress_enable) {
|
2014-02-25 21:36:43 +04:00
|
|
|
opal_progress_unregister (component_progress);
|
|
|
|
}
|
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
if (0 !=
|
|
|
|
(num_modules = opal_hash_table_get_size(&mca_osc_pt2pt_component.modules))) {
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output(ompi_osc_base_framework.framework_output,
|
2006-08-17 18:52:20 +04:00
|
|
|
"WARNING: There were %d Windows created but not freed.",
|
2007-01-31 20:11:06 +03:00
|
|
|
(int) num_modules);
|
2006-07-18 02:08:55 +04:00
|
|
|
}
|
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
OBJ_DESTRUCT(&mca_osc_pt2pt_component.frags);
|
|
|
|
OBJ_DESTRUCT(&mca_osc_pt2pt_component.modules);
|
|
|
|
OBJ_DESTRUCT(&mca_osc_pt2pt_component.lock);
|
|
|
|
OBJ_DESTRUCT(&mca_osc_pt2pt_component.requests);
|
|
|
|
OBJ_DESTRUCT(&mca_osc_pt2pt_component.pending_operations);
|
2014-11-14 01:13:10 +03:00
|
|
|
OBJ_DESTRUCT(&mca_osc_pt2pt_component.pending_operations_lock);
|
2006-07-18 02:08:55 +04:00
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
static int
|
|
|
|
component_query(struct ompi_win_t *win, void **base, size_t size, int disp_unit,
|
|
|
|
struct ompi_communicator_t *comm, struct ompi_info_t *info,
|
|
|
|
int flavor)
|
2006-07-18 02:08:55 +04:00
|
|
|
{
|
2014-02-25 21:36:43 +04:00
|
|
|
if (MPI_WIN_FLAVOR_SHARED == flavor) return -1;
|
|
|
|
|
2009-05-01 02:36:09 +04:00
|
|
|
return 10;
|
2006-07-18 02:08:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
static int
|
|
|
|
component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit,
|
|
|
|
struct ompi_communicator_t *comm, struct ompi_info_t *info,
|
|
|
|
int flavor, int *model)
|
2006-07-18 02:08:55 +04:00
|
|
|
{
|
2014-11-05 19:59:12 +03:00
|
|
|
ompi_osc_pt2pt_module_t *module = NULL;
|
2014-02-25 21:36:43 +04:00
|
|
|
int ret;
|
|
|
|
char *name;
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
/* We don't support shared windows; that's for the sm onesided
|
|
|
|
component */
|
|
|
|
if (MPI_WIN_FLAVOR_SHARED == flavor) return OMPI_ERR_NOT_SUPPORTED;
|
|
|
|
|
|
|
|
/* create module structure with all fields initialized to zero */
|
2014-11-05 19:59:12 +03:00
|
|
|
module = (ompi_osc_pt2pt_module_t*)
|
|
|
|
calloc(1, sizeof(ompi_osc_pt2pt_module_t));
|
2007-05-24 19:41:24 +04:00
|
|
|
if (NULL == module) return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
|
2006-07-18 02:08:55 +04:00
|
|
|
|
|
|
|
/* fill in the function pointer part */
|
2014-11-05 19:59:12 +03:00
|
|
|
memcpy(module, &ompi_osc_pt2pt_module_template,
|
2006-07-18 02:08:55 +04:00
|
|
|
sizeof(ompi_osc_base_module_t));
|
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
/* initialize the objects, so that always free in cleanup */
|
|
|
|
OBJ_CONSTRUCT(&module->lock, opal_mutex_t);
|
|
|
|
OBJ_CONSTRUCT(&module->cond, opal_condition_t);
|
|
|
|
OBJ_CONSTRUCT(&module->acc_lock, opal_mutex_t);
|
|
|
|
OBJ_CONSTRUCT(&module->locks_pending, opal_list_t);
|
2014-11-14 01:13:10 +03:00
|
|
|
OBJ_CONSTRUCT(&module->locks_pending_lock, opal_mutex_t);
|
2014-02-25 21:36:43 +04:00
|
|
|
OBJ_CONSTRUCT(&module->outstanding_locks, opal_list_t);
|
|
|
|
OBJ_CONSTRUCT(&module->pending_acc, opal_list_t);
|
2014-06-17 19:23:06 +04:00
|
|
|
OBJ_CONSTRUCT(&module->pending_posts, opal_list_t);
|
2014-11-14 01:13:10 +03:00
|
|
|
OBJ_CONSTRUCT(&module->request_gc, opal_list_t);
|
|
|
|
OBJ_CONSTRUCT(&module->buffer_gc, opal_list_t);
|
|
|
|
OBJ_CONSTRUCT(&module->gc_lock, opal_mutex_t);
|
2014-02-25 21:36:43 +04:00
|
|
|
|
|
|
|
/* options */
|
|
|
|
/* FIX ME: should actually check this value... */
|
|
|
|
#if 1
|
|
|
|
module->accumulate_ordering = 1;
|
|
|
|
#else
|
|
|
|
ompi_osc_base_config_value_equal("accumulate_ordering", info, "none");
|
|
|
|
#endif
|
2007-05-24 19:41:24 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
/* fill in our part */
|
|
|
|
if (MPI_WIN_FLAVOR_ALLOCATE == flavor && size) {
|
|
|
|
module->free_after = *base = malloc(size);
|
|
|
|
if (NULL == *base) {
|
|
|
|
ret = OMPI_ERR_TEMP_OUT_OF_RESOURCE;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
}
|
2007-05-24 19:41:24 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
/* in the dynamic case base is MPI_BOTTOM */
|
|
|
|
if (MPI_WIN_FLAVOR_DYNAMIC != flavor) {
|
|
|
|
module->baseptr = *base;
|
|
|
|
}
|
2007-07-03 02:22:59 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
ret = ompi_comm_dup(comm, &module->comm);
|
|
|
|
if (OMPI_SUCCESS != ret) goto cleanup;
|
2007-05-24 19:41:24 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((10, ompi_osc_base_framework.framework_output,
|
2014-11-05 19:59:12 +03:00
|
|
|
"pt2pt component creating window with id %d",
|
2014-02-25 21:36:43 +04:00
|
|
|
ompi_comm_get_cid(module->comm)));
|
2007-05-24 19:41:24 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
/* record my displacement unit. Always resolved at target */
|
|
|
|
module->disp_unit = disp_unit;
|
2009-05-01 02:36:09 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
/* peer data */
|
2014-11-05 19:59:12 +03:00
|
|
|
module->peers = calloc(ompi_comm_size(comm), sizeof(ompi_osc_pt2pt_peer_t));
|
2014-02-25 21:36:43 +04:00
|
|
|
if (NULL == module->peers) {
|
2007-05-24 19:41:24 +04:00
|
|
|
ret = OMPI_ERR_TEMP_OUT_OF_RESOURCE;
|
|
|
|
goto cleanup;
|
2006-07-18 02:08:55 +04:00
|
|
|
}
|
2014-02-25 21:36:43 +04:00
|
|
|
|
2015-03-25 00:04:08 +03:00
|
|
|
for (int i = 0 ; i < ompi_comm_size (comm) ; ++i) {
|
|
|
|
OBJ_CONSTRUCT(module->peers + i, ompi_osc_pt2pt_peer_t);
|
|
|
|
}
|
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
/* peer op count data */
|
|
|
|
module->epoch_outgoing_frag_count = calloc (ompi_comm_size(comm), sizeof(uint32_t));
|
|
|
|
if (NULL == module->epoch_outgoing_frag_count) {
|
2007-05-24 19:41:24 +04:00
|
|
|
ret = OMPI_ERR_TEMP_OUT_OF_RESOURCE;
|
|
|
|
goto cleanup;
|
2006-07-18 02:08:55 +04:00
|
|
|
}
|
|
|
|
|
2014-03-12 03:01:51 +04:00
|
|
|
/* the statement below (from Brian) does not seem correct so disable active target on the
|
|
|
|
* window. if this end up being incorrect please revert this one change */
|
|
|
|
module->active_eager_send_active = false;
|
|
|
|
#if 0
|
2007-05-30 21:06:19 +04:00
|
|
|
/* initially, we're in that pseudo-fence state, so we allow eager
|
|
|
|
sends (yay for Fence). Other protocols will disable before
|
|
|
|
they start their epochs, so this isn't a problem. */
|
2014-02-25 21:36:43 +04:00
|
|
|
module->active_eager_send_active = true;
|
2014-03-12 03:01:51 +04:00
|
|
|
#endif
|
2006-07-18 02:08:55 +04:00
|
|
|
|
|
|
|
/* lock data */
|
2014-02-25 21:36:43 +04:00
|
|
|
if (check_config_value_bool("no_locks", info)) {
|
|
|
|
win->w_flags |= OMPI_WIN_NO_LOCKS;
|
|
|
|
}
|
2006-07-18 02:08:55 +04:00
|
|
|
|
|
|
|
/* update component data */
|
2014-11-05 19:59:12 +03:00
|
|
|
OPAL_THREAD_LOCK(&mca_osc_pt2pt_component.lock);
|
|
|
|
ret = opal_hash_table_set_value_uint32(&mca_osc_pt2pt_component.modules,
|
2014-02-25 21:36:43 +04:00
|
|
|
ompi_comm_get_cid(module->comm),
|
|
|
|
module);
|
2014-11-05 19:59:12 +03:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_osc_pt2pt_component.lock);
|
2007-05-24 19:41:24 +04:00
|
|
|
if (OMPI_SUCCESS != ret) goto cleanup;
|
2006-07-18 02:08:55 +04:00
|
|
|
|
|
|
|
/* fill in window information */
|
2014-02-25 21:36:43 +04:00
|
|
|
*model = MPI_WIN_UNIFIED;
|
2006-07-18 02:08:55 +04:00
|
|
|
win->w_osc_module = (ompi_osc_base_module_t*) module;
|
2014-11-05 19:59:12 +03:00
|
|
|
asprintf(&name, "pt2pt window %d", ompi_comm_get_cid(module->comm));
|
2014-02-25 21:36:43 +04:00
|
|
|
ompi_win_set_name(win, name);
|
|
|
|
free(name);
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2007-07-03 02:22:59 +04:00
|
|
|
/* sync memory - make sure all initialization completed */
|
|
|
|
opal_atomic_mb();
|
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
module->incoming_buffer = malloc (mca_osc_pt2pt_component.buffer_size + sizeof (ompi_osc_pt2pt_frag_header_t));
|
2014-03-13 01:43:23 +04:00
|
|
|
if (OPAL_UNLIKELY(NULL == module->incoming_buffer)) {
|
2014-02-25 21:36:43 +04:00
|
|
|
goto cleanup;
|
2007-07-03 02:22:59 +04:00
|
|
|
}
|
2007-05-24 19:41:24 +04:00
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
ret = ompi_osc_pt2pt_frag_start_receive (module);
|
2014-02-25 21:36:43 +04:00
|
|
|
if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) {
|
|
|
|
goto cleanup;
|
2007-05-24 19:41:24 +04:00
|
|
|
}
|
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
/* barrier to prevent arrival of lock requests before we're
|
|
|
|
fully created */
|
|
|
|
ret = module->comm->c_coll.coll_barrier(module->comm,
|
|
|
|
module->comm->c_coll.coll_barrier_module);
|
|
|
|
if (OMPI_SUCCESS != ret) goto cleanup;
|
2011-07-01 00:05:16 +04:00
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
if (!mca_osc_pt2pt_component.progress_enable) {
|
2014-02-25 21:36:43 +04:00
|
|
|
opal_progress_register (component_progress);
|
2014-11-05 19:59:12 +03:00
|
|
|
mca_osc_pt2pt_component.progress_enable = true;
|
2007-05-24 19:41:24 +04:00
|
|
|
}
|
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((10, ompi_osc_base_framework.framework_output,
|
2014-11-05 19:59:12 +03:00
|
|
|
"done creating pt2pt window %d", ompi_comm_get_cid(module->comm)));
|
2007-05-24 19:41:24 +04:00
|
|
|
|
2011-07-01 00:05:16 +04:00
|
|
|
return OMPI_SUCCESS;
|
2007-07-03 02:22:59 +04:00
|
|
|
|
|
|
|
cleanup:
|
2014-04-28 23:55:18 +04:00
|
|
|
/* set the module so we properly cleanup */
|
|
|
|
win->w_osc_module = (ompi_osc_base_module_t*) module;
|
2014-11-05 19:59:12 +03:00
|
|
|
ompi_osc_pt2pt_free (win);
|
2007-07-03 02:22:59 +04:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
int
|
2014-11-05 19:59:12 +03:00
|
|
|
ompi_osc_pt2pt_set_info(struct ompi_win_t *win, struct ompi_info_t *info)
|
2007-07-03 02:22:59 +04:00
|
|
|
{
|
2014-11-05 19:59:12 +03:00
|
|
|
ompi_osc_pt2pt_module_t *module =
|
|
|
|
(ompi_osc_pt2pt_module_t*) win->w_osc_module;
|
2007-07-03 02:22:59 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
/* enforce collectiveness... */
|
|
|
|
return module->comm->c_coll.coll_barrier(module->comm,
|
|
|
|
module->comm->c_coll.coll_barrier_module);
|
2007-07-03 02:22:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
int
|
2014-11-05 19:59:12 +03:00
|
|
|
ompi_osc_pt2pt_get_info(struct ompi_win_t *win, struct ompi_info_t **info_used)
|
2007-07-03 02:22:59 +04:00
|
|
|
{
|
2014-02-25 21:36:43 +04:00
|
|
|
ompi_info_t *info = OBJ_NEW(ompi_info_t);
|
|
|
|
if (NULL == info) return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
|
2007-07-03 02:22:59 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
*info_used = info;
|
2007-07-03 02:22:59 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
return OMPI_SUCCESS;
|
2007-07-03 02:22:59 +04:00
|
|
|
}
|
2008-11-05 00:58:06 +03:00
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
OBJ_CLASS_INSTANCE(ompi_osc_pt2pt_pending_t, opal_list_item_t, NULL, NULL);
|
2015-03-25 00:04:08 +03:00
|
|
|
|
2015-04-24 00:34:40 +03:00
|
|
|
static void ompi_osc_pt2pt_peer_construct (ompi_osc_pt2pt_peer_t *peer)
|
2015-03-25 00:04:08 +03:00
|
|
|
{
|
|
|
|
OBJ_CONSTRUCT(&peer->queued_frags, opal_list_t);
|
|
|
|
OBJ_CONSTRUCT(&peer->lock, opal_mutex_t);
|
|
|
|
}
|
|
|
|
|
2015-04-24 00:34:40 +03:00
|
|
|
static void ompi_osc_pt2pt_peer_destruct (ompi_osc_pt2pt_peer_t *peer)
|
2015-03-25 00:04:08 +03:00
|
|
|
{
|
|
|
|
OBJ_DESTRUCT(&peer->queued_frags);
|
|
|
|
OBJ_DESTRUCT(&peer->lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE(ompi_osc_pt2pt_peer_t, opal_object_t,
|
|
|
|
ompi_osc_pt2pt_peer_construct,
|
|
|
|
ompi_osc_pt2pt_peer_destruct);
|