e7ecd56bd2
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.
136 строки
4.6 KiB
C
136 строки
4.6 KiB
C
/*
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
* University Research and Technology
|
|
* Corporation. All rights reserved.
|
|
* Copyright (c) 2004-2007 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-2006 The Regents of the University of California.
|
|
* All rights reserved.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
#include "ompi_config.h"
|
|
|
|
#include <string.h>
|
|
|
|
#include "ompi/mca/bml/bml.h"
|
|
#include "bml_base_btl.h"
|
|
#include "opal/util/crc.h"
|
|
|
|
static void mca_bml_base_btl_array_construct(mca_bml_base_btl_array_t* array)
|
|
{
|
|
array->bml_btls = NULL;
|
|
array->arr_size = 0;
|
|
array->arr_index = 0;
|
|
array->arr_reserve = 0;
|
|
}
|
|
|
|
|
|
static void mca_bml_base_btl_array_destruct(mca_bml_base_btl_array_t* array)
|
|
{
|
|
if(NULL != array->bml_btls) {
|
|
free(array->bml_btls);
|
|
array->bml_btls = NULL;
|
|
}
|
|
array->arr_size = 0;
|
|
array->arr_index = 0;
|
|
array->arr_reserve = 0;
|
|
}
|
|
|
|
OBJ_CLASS_INSTANCE(
|
|
mca_bml_base_btl_array_t,
|
|
opal_object_t,
|
|
mca_bml_base_btl_array_construct,
|
|
mca_bml_base_btl_array_destruct
|
|
);
|
|
|
|
int mca_bml_base_btl_array_reserve(mca_bml_base_btl_array_t* array, size_t size)
|
|
{
|
|
size_t old_len = sizeof(mca_bml_base_btl_t)*array->arr_reserve;
|
|
size_t new_len = sizeof(mca_bml_base_btl_t)*size;
|
|
if(old_len >= new_len)
|
|
return OMPI_SUCCESS;
|
|
|
|
array->bml_btls = (mca_bml_base_btl_t*)realloc(array->bml_btls, new_len);
|
|
if(NULL == array->bml_btls)
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
memset((unsigned char*)array->bml_btls + old_len, 0, new_len-old_len);
|
|
array->arr_reserve = size;
|
|
return OMPI_SUCCESS;
|
|
}
|
|
|
|
|
|
#if OMPI_ENABLE_DEBUG_RELIABILITY
|
|
|
|
extern double mca_bml_base_error_rate_floor;
|
|
extern double mca_bml_base_error_rate_ceiling;
|
|
extern int mca_bml_base_error_count;
|
|
|
|
struct mca_bml_base_context_t {
|
|
size_t index;
|
|
mca_btl_base_completion_fn_t cbfunc;
|
|
void* cbdata;
|
|
};
|
|
typedef struct mca_bml_base_context_t mca_bml_base_context_t;
|
|
|
|
static void mca_bml_base_completion(
|
|
struct mca_btl_base_module_t* btl,
|
|
struct mca_btl_base_endpoint_t* ep,
|
|
struct mca_btl_base_descriptor_t* des,
|
|
int status)
|
|
{
|
|
mca_bml_base_context_t* ctx = (mca_bml_base_context_t*) des->des_cbdata;
|
|
/* restore original state */
|
|
((unsigned char*)des->des_src[0].seg_addr.pval)[ctx->index] ^= ~0;
|
|
des->des_cbdata = ctx->cbdata;
|
|
des->des_cbfunc = ctx->cbfunc;
|
|
free(ctx);
|
|
/* invoke original callback */
|
|
des->des_cbfunc(btl,ep,des,status);
|
|
}
|
|
|
|
int mca_bml_base_send( mca_bml_base_btl_t* bml_btl,
|
|
mca_btl_base_descriptor_t* des,
|
|
mca_btl_base_tag_t tag )
|
|
{
|
|
des->des_context = (void*)bml_btl;
|
|
if(mca_bml_base_error_count <= 0 && mca_bml_base_error_rate_ceiling > 0) {
|
|
mca_bml_base_error_count = (int) ((mca_bml_base_error_rate_ceiling * rand())/(RAND_MAX+1.0));
|
|
if(mca_bml_base_error_count < mca_bml_base_error_rate_floor) {
|
|
mca_bml_base_error_count = mca_bml_base_error_rate_floor;
|
|
}
|
|
if(mca_bml_base_error_count % 2) {
|
|
/* local completion - network "drops" packet */
|
|
orte_output(0, "%s:%d: dropping data, with local completion\n", __FILE__, __LINE__);
|
|
des->des_cbfunc(bml_btl->btl, bml_btl->btl_endpoint, des, OMPI_SUCCESS);
|
|
return OMPI_SUCCESS;
|
|
} else {
|
|
/* corrupt data */
|
|
mca_bml_base_context_t* ctx = (mca_bml_base_context_t*)
|
|
malloc(sizeof(mca_bml_base_context_t));
|
|
if(NULL != ctx) {
|
|
orte_output(0, "%s:%d: corrupting data\n", __FILE__, __LINE__);
|
|
ctx->index = (size_t) ((des->des_src[0].seg_len * rand() * 1.0) / (RAND_MAX + 1.0));
|
|
ctx->cbfunc = des->des_cbfunc;
|
|
ctx->cbdata = des->des_cbdata;
|
|
((unsigned char*)des->des_src[0].seg_addr.pval)[ctx->index] ^= ~0;
|
|
des->des_cbdata = ctx;
|
|
des->des_cbfunc = mca_bml_base_completion;
|
|
}
|
|
}
|
|
}
|
|
mca_bml_base_error_count--;
|
|
return bml_btl->btl_send( bml_btl->btl,
|
|
bml_btl->btl_endpoint,
|
|
des, tag );
|
|
}
|
|
|
|
#endif
|