
such, the commit message back to the master SVN repository is fairly long. = ORTE Job-Level Output Messages = Add two new interfaces that should be used for all new code throughout the ORTE and OMPI layers (we already make the search-and-replace on the existing ORTE / OMPI layers): * orte_output(): (and corresponding friends ORTE_OUTPUT, orte_output_verbose, etc.) This function sends the output directly to the HNP for processing as part of a job-specific output channel. It supports all the same outputs as opal_output() (syslog, file, stdout, stderr), but for stdout/stderr, the output is sent to the HNP for processing and output. More on this below. * orte_show_help(): This function is a drop-in-replacement for opal_show_help(), with two differences in functionality: 1. the rendered text help message output is sent to the HNP for display (rather than outputting directly into the process' stderr stream) 1. the HNP detects duplicate help messages and does not display them (so that you don't see the same error message N times, once from each of your N MPI processes); instead, it counts "new" instances of the help message and displays a message every ~5 seconds when there are new ones ("I got X new copies of the help message...") opal_show_help and opal_output still exist, but they only output in the current process. The intent for the new orte_* functions is that they can apply job-level intelligence to the output. As such, we recommend that all new ORTE and OMPI code use the new orte_* functions, not thei opal_* functions. === New code === For ORTE and OMPI programmers, here's what you need to do differently in new code: * Do not include opal/util/show_help.h or opal/util/output.h. Instead, include orte/util/output.h (this one header file has declarations for both the orte_output() series of functions and orte_show_help()). * Effectively s/opal_output/orte_output/gi throughout your code. Note that orte_output_open() takes a slightly different argument list (as a way to pass data to the filtering stream -- see below), so you if explicitly call opal_output_open(), you'll need to slightly adapt to the new signature of orte_output_open(). * Literally s/opal_show_help/orte_show_help/. The function signature is identical. === Notes === * orte_output'ing to stream 0 will do similar to what opal_output'ing did, so leaving a hard-coded "0" as the first argument is safe. * For systems that do not use ORTE's RML or the HNP, the effect of orte_output_* and orte_show_help will be identical to their opal counterparts (the additional information passed to orte_output_open() will be lost!). Indeed, the orte_* functions simply become trivial wrappers to their opal_* counterparts. Note that we have not tested this; the code is simple but it is quite possible that we mucked something up. = Filter Framework = Messages sent view the new orte_* functions described above and messages output via the IOF on the HNP will now optionally be passed through a new "filter" framework before being output to stdout/stderr. The "filter" OPAL MCA framework is intended to allow preprocessing to messages before they are sent to their final destinations. The first component that was written in the filter framework was to create an XML stream, segregating all the messages into different XML tags, etc. This will allow 3rd party tools to read the stdout/stderr from the HNP and be able to know exactly what each text message is (e.g., a help message, another OMPI infrastructure message, stdout from the user process, stderr from the user process, etc.). Filtering is not active by default. Filter components must be specifically requested, such as: {{{ $ mpirun --mca filter xml ... }}} There can only be one filter component active. = New MCA Parameters = The new functionality described above introduces two new MCA parameters: * '''orte_base_help_aggregate''': Defaults to 1 (true), meaning that help messages will be aggregated, as described above. If set to 0, all help messages will be displayed, even if they are duplicates (i.e., the original behavior). * '''orte_base_show_output_recursions''': An MCA parameter to help debug one of the known issues, described below. It is likely that this MCA parameter will disappear before v1.3 final. = Known Issues = * The XML filter component is not complete. The current output from this component is preliminary and not real XML. A bit more work needs to be done to configure.m4 search for an appropriate XML library/link it in/use it at run time. * There are possible recursion loops in the orte_output() and orte_show_help() functions -- e.g., if RML send calls orte_output() or orte_show_help(). We have some ideas how to fix these, but figured that it was ok to commit before feature freeze with known issues. The code currently contains sub-optimal workarounds so that this will not be a problem, but it would be good to actually solve the problem rather than have hackish workarounds before v1.3 final. This commit was SVN r18434.
360 строки
11 KiB
C
360 строки
11 KiB
C
/*
|
|
* 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.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
#include "ompi_config.h"
|
|
|
|
#include "ompi/mca/mtl/mtl.h"
|
|
#include "ompi/communicator/communicator.h"
|
|
#include "opal/class/opal_list.h"
|
|
|
|
#include "mtl_portals.h"
|
|
#include "mtl_portals_endpoint.h"
|
|
#include "mtl_portals_request.h"
|
|
#include "mtl_portals_recv.h"
|
|
#include "mtl_portals_recv_short.h"
|
|
#include "mtl_portals_send_short.h"
|
|
|
|
static ptl_handle_md_t send_catchall_md_h;
|
|
static ptl_handle_md_t ack_catchall_md_h;
|
|
static ptl_handle_md_t read_catchall_md_h;
|
|
static ptl_handle_md_t unex_long_md_h;
|
|
|
|
static ompi_mtl_portals_request_t catchall_request;
|
|
|
|
mca_mtl_portals_module_t ompi_mtl_portals = {
|
|
{
|
|
8191, /* max cid - 2^13 - 1 */
|
|
(1UL << 30), /* max tag value - must allow negatives */
|
|
0, /* request reserve space */
|
|
0, /* flags */
|
|
|
|
ompi_mtl_portals_add_procs,
|
|
ompi_mtl_portals_del_procs,
|
|
ompi_mtl_portals_finalize,
|
|
|
|
ompi_mtl_portals_send,
|
|
ompi_mtl_portals_isend,
|
|
ompi_mtl_portals_irecv,
|
|
ompi_mtl_portals_iprobe,
|
|
|
|
NULL /* cancel */
|
|
}
|
|
};
|
|
|
|
|
|
/* BWB - fix me - this should be an ompi_free_list_item_t */
|
|
OBJ_CLASS_INSTANCE(ompi_mtl_portals_event_t, opal_list_item_t,
|
|
NULL, NULL);
|
|
|
|
|
|
/* catchall callback */
|
|
static int
|
|
ompi_mtl_portals_catchall_callback(ptl_event_t *ev, ompi_mtl_portals_request_t *ptl_request)
|
|
{
|
|
|
|
orte_output(fileno(stderr),"ERROR - received catchall event\n");
|
|
|
|
abort();
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
|
|
int
|
|
ompi_mtl_portals_add_procs(struct mca_mtl_base_module_t *mtl,
|
|
size_t nprocs,
|
|
struct ompi_proc_t** procs,
|
|
struct mca_mtl_base_endpoint_t **mtl_peer_data)
|
|
{
|
|
int ret = OMPI_SUCCESS;
|
|
ptl_process_id_t *portals_procs = NULL;
|
|
ptl_md_t md;
|
|
size_t i;
|
|
ptl_match_bits_t match_bits;
|
|
ptl_match_bits_t ignore_bits;
|
|
ptl_process_id_t anyid = { PTL_NID_ANY, PTL_PID_ANY };
|
|
bool accel;
|
|
|
|
assert(mtl == &ompi_mtl_portals.base);
|
|
|
|
/* if we havne't already initialized the network, do so now. We
|
|
delay until add_procs because if we want the automatic runtime
|
|
environment setup the common code does for the utcp
|
|
implementation, we can't do it until modex information can be
|
|
received. */
|
|
|
|
if (PTL_INVALID_HANDLE == ompi_mtl_portals.ptl_ni_h) {
|
|
|
|
ret = ompi_common_portals_ni_initialize(&(ompi_mtl_portals.ptl_ni_h), &accel);
|
|
if (OMPI_SUCCESS != ret) goto cleanup;
|
|
}
|
|
|
|
/* event queue for expected events */
|
|
ret = PtlEQAlloc(ompi_mtl_portals.ptl_ni_h,
|
|
ompi_mtl_portals.ptl_expected_queue_size,
|
|
PTL_EQ_HANDLER_NONE,
|
|
&(ompi_mtl_portals.ptl_eq_h));
|
|
assert(ret == PTL_OK);
|
|
|
|
/* event queue for unexpected receives */
|
|
ret = PtlEQAlloc(ompi_mtl_portals.ptl_ni_h,
|
|
ompi_mtl_portals.ptl_unexpected_queue_size,
|
|
PTL_EQ_HANDLER_NONE,
|
|
&(ompi_mtl_portals.ptl_unex_eq_h));
|
|
assert(ret == PTL_OK);
|
|
|
|
/* empty event queue for PtlMEMDPost() */
|
|
ret = PtlEQAlloc(ompi_mtl_portals.ptl_ni_h,
|
|
1,
|
|
PTL_EQ_HANDLER_NONE,
|
|
&(ompi_mtl_portals.ptl_empty_eq_h));
|
|
assert(ret == PTL_OK);
|
|
|
|
/* attach the long unex msg buffer */
|
|
match_bits = PTL_LONG_MSG;
|
|
ignore_bits = ~(PTL_LONG_MSG);
|
|
|
|
ret = PtlMEAttach(ompi_mtl_portals.ptl_ni_h,
|
|
OMPI_MTL_PORTALS_SEND_TABLE_ID,
|
|
anyid,
|
|
match_bits,
|
|
ignore_bits,
|
|
PTL_RETAIN,
|
|
PTL_INS_AFTER,
|
|
&(ompi_mtl_portals.ptl_unex_long_me_h));
|
|
assert(ret == PTL_OK);
|
|
|
|
md.start = NULL;
|
|
md.length = 0;
|
|
md.threshold = PTL_MD_THRESH_INF;
|
|
md.max_size = 0;
|
|
md.options = PTL_MD_OP_PUT | PTL_MD_TRUNCATE | PTL_MD_ACK_DISABLE;
|
|
md.eq_handle = ompi_mtl_portals.ptl_unex_eq_h;
|
|
md.user_ptr = NULL;
|
|
|
|
ret = PtlMDAttach(ompi_mtl_portals.ptl_unex_long_me_h,
|
|
md,
|
|
PTL_RETAIN,
|
|
&unex_long_md_h);
|
|
assert(ret == PTL_OK);
|
|
|
|
/* attach catchalls to the send, ack, and read portals */
|
|
catchall_request.event_callback = ompi_mtl_portals_catchall_callback;
|
|
md.eq_handle = ompi_mtl_portals.ptl_eq_h;
|
|
md.user_ptr = &catchall_request;
|
|
|
|
/* catchall for the send portal */
|
|
ret = PtlMEMDPost(ompi_mtl_portals.ptl_ni_h,
|
|
ompi_mtl_portals.ptl_unex_long_me_h,
|
|
anyid,
|
|
0,
|
|
~0,
|
|
PTL_RETAIN,
|
|
PTL_INS_AFTER,
|
|
md,
|
|
PTL_UNLINK,
|
|
&(ompi_mtl_portals.ptl_send_catchall_me_h),
|
|
&send_catchall_md_h,
|
|
ompi_mtl_portals.ptl_empty_eq_h);
|
|
assert(ret == PTL_OK);
|
|
|
|
/* catchall for ack portal */
|
|
ret = PtlMEAttach(ompi_mtl_portals.ptl_ni_h,
|
|
OMPI_MTL_PORTALS_ACK_TABLE_ID,
|
|
anyid,
|
|
0,
|
|
~0,
|
|
PTL_RETAIN,
|
|
PTL_INS_AFTER,
|
|
&(ompi_mtl_portals.ptl_ack_catchall_me_h));
|
|
assert(ret == PTL_OK);
|
|
|
|
ret = PtlMDAttach(ompi_mtl_portals.ptl_ack_catchall_me_h,
|
|
md,
|
|
PTL_UNLINK,
|
|
&ack_catchall_md_h);
|
|
assert(ret == PTL_OK);
|
|
|
|
/* catchall for read portal */
|
|
ret = PtlMEAttach(ompi_mtl_portals.ptl_ni_h,
|
|
OMPI_MTL_PORTALS_READ_TABLE_ID,
|
|
anyid,
|
|
0,
|
|
~0,
|
|
PTL_RETAIN,
|
|
PTL_INS_AFTER,
|
|
&(ompi_mtl_portals.ptl_read_catchall_me_h));
|
|
assert(ret == PTL_OK);
|
|
|
|
ret = PtlMDAttach(ompi_mtl_portals.ptl_read_catchall_me_h,
|
|
md,
|
|
PTL_RETAIN,
|
|
&read_catchall_md_h);
|
|
assert(ret == PTL_OK);
|
|
|
|
/* attach short unex recv blocks */
|
|
ret = ompi_mtl_portals_recv_short_enable((mca_mtl_portals_module_t*) mtl);
|
|
|
|
opal_progress_register(ompi_mtl_portals_progress);
|
|
|
|
/* bind zero-length md for sending zero-length msgs and acks */
|
|
md.start = NULL;
|
|
md.length = 0;
|
|
md.threshold = PTL_MD_THRESH_INF;
|
|
md.max_size = 0;
|
|
md.options = PTL_MD_EVENT_START_DISABLE | PTL_MD_EVENT_END_DISABLE;
|
|
md.user_ptr = NULL;
|
|
md.eq_handle = PTL_EQ_NONE;
|
|
|
|
ret = PtlMDBind(ompi_mtl_portals.ptl_ni_h,
|
|
md,
|
|
PTL_RETAIN,
|
|
&ompi_mtl_portals.ptl_zero_md_h );
|
|
assert(ret == PTL_OK);
|
|
|
|
/* set up the short copy blocks */
|
|
ompi_mtl_portals_short_setup();
|
|
|
|
|
|
|
|
/* get the list of ptl_process_id_t structures for the given proc
|
|
structures. If the Portals runtime environment supports
|
|
comm_spawn, we'll be able to support it as well. */
|
|
portals_procs = malloc(sizeof(ptl_process_id_t) * nprocs);
|
|
if (NULL == portals_procs) goto cleanup;
|
|
ret = ompi_common_portals_get_procs(nprocs, procs, portals_procs);
|
|
if (OMPI_SUCCESS != ret) goto cleanup;
|
|
|
|
/* copy the ptl_process_id_t information into our per-proc data
|
|
store */
|
|
for (i = 0 ; i < nprocs ; ++i) {
|
|
mtl_peer_data[i] = malloc(sizeof(struct mca_mtl_base_endpoint_t));
|
|
if (NULL == mtl_peer_data[i]) goto cleanup;
|
|
|
|
mtl_peer_data[i]->ptl_proc.nid = portals_procs[i].nid;
|
|
mtl_peer_data[i]->ptl_proc.pid = portals_procs[i].pid;
|
|
}
|
|
|
|
cleanup:
|
|
if (NULL != portals_procs) free(portals_procs);
|
|
return ret;
|
|
}
|
|
|
|
|
|
int
|
|
ompi_mtl_portals_del_procs(struct mca_mtl_base_module_t *mtl,
|
|
size_t nprocs,
|
|
struct ompi_proc_t** procs,
|
|
struct mca_mtl_base_endpoint_t **mtl_peer_data)
|
|
{
|
|
size_t i;
|
|
|
|
assert(mtl == &ompi_mtl_portals.base);
|
|
|
|
for (i = 0 ; i < nprocs ; ++i) {
|
|
if (NULL != mtl_peer_data[i]) {
|
|
free(mtl_peer_data[i]);
|
|
}
|
|
}
|
|
|
|
ompi_mtl_portals_recv_short_disable((mca_mtl_portals_module_t *) mtl);
|
|
|
|
ompi_mtl_portals_short_cleanup();
|
|
|
|
(void)PtlMDUnlink(ompi_mtl_portals.ptl_zero_md_h);
|
|
|
|
(void)PtlMDUnlink(send_catchall_md_h);
|
|
|
|
(void)PtlMDUnlink(ack_catchall_md_h);
|
|
|
|
(void)PtlMDUnlink(read_catchall_md_h);
|
|
|
|
(void)PtlMDUnlink(unex_long_md_h);
|
|
|
|
(void)PtlMEUnlink(ompi_mtl_portals.ptl_unex_long_me_h);
|
|
|
|
(void)PtlMEUnlink(ompi_mtl_portals.ptl_send_catchall_me_h);
|
|
|
|
(void)PtlMEUnlink(ompi_mtl_portals.ptl_ack_catchall_me_h);
|
|
|
|
(void)PtlMEUnlink(ompi_mtl_portals.ptl_read_catchall_me_h);
|
|
|
|
return OMPI_SUCCESS;
|
|
}
|
|
|
|
|
|
int
|
|
ompi_mtl_portals_finalize(struct mca_mtl_base_module_t *mtl)
|
|
{
|
|
assert(mtl == &ompi_mtl_portals.base);
|
|
|
|
/* Don't try to wait for things to finish if we've never initialized */
|
|
if (PTL_INVALID_HANDLE != ompi_mtl_portals.ptl_ni_h) {
|
|
opal_progress_unregister(ompi_mtl_portals_progress);
|
|
while (0 != ompi_mtl_portals_progress()) { }
|
|
}
|
|
|
|
ompi_common_portals_ni_finalize();
|
|
ompi_common_portals_finalize();
|
|
|
|
return OMPI_SUCCESS;
|
|
}
|
|
|
|
|
|
int
|
|
ompi_mtl_portals_progress(void)
|
|
{
|
|
int count = 0, ret;
|
|
ptl_event_t ev;
|
|
ompi_mtl_portals_request_t *ptl_request;
|
|
int which;
|
|
ompi_mtl_portals_event_t *unex_recv;
|
|
|
|
while (true) {
|
|
|
|
ret = PtlEQGet(ompi_mtl_portals.ptl_eq_h, &ev);
|
|
|
|
if (PTL_OK == ret) {
|
|
if (ev.type == PTL_EVENT_UNLINK) continue;
|
|
|
|
if (NULL != ev.md.user_ptr) {
|
|
ptl_request = ev.md.user_ptr;
|
|
ret = ptl_request->event_callback(&ev, ptl_request);
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
orte_output(0, " Error returned from the even callback. Error code - %d \n",ret);
|
|
abort();
|
|
}
|
|
}
|
|
} else if (PTL_EQ_EMPTY == ret) {
|
|
break;
|
|
} else {
|
|
orte_output(0, " Error returned from PtlEQGet. Error code - %d \n",ret);
|
|
abort();
|
|
}
|
|
}
|
|
|
|
/* clean out the unexpected event queue too */
|
|
if (ompi_mtl_portals.ptl_aggressive_polling == true) {
|
|
while ( NULL != ompi_mtl_portals_search_unex_events(0, ~0, true) );
|
|
}
|
|
|
|
return count;
|
|
}
|