updates to reliability debug code
This commit was SVN r9390.
Этот коммит содержится в:
родитель
2a18ebd9e1
Коммит
c1bec478c4
@ -64,6 +64,8 @@ int mca_bml_base_btl_array_reserve(mca_bml_base_btl_array_t* array, size_t size)
|
||||
|
||||
#if OMPI_ENABLE_DEBUG_RELIABILITY
|
||||
|
||||
extern double mca_bml_base_error_rate;
|
||||
|
||||
struct mca_bml_base_context_t {
|
||||
size_t index;
|
||||
mca_btl_base_completion_fn_t cbfunc;
|
||||
@ -78,7 +80,6 @@ static void mca_bml_base_completion(
|
||||
int status)
|
||||
{
|
||||
mca_bml_base_context_t* ctx = (mca_bml_base_context_t*) des->des_cbdata;
|
||||
uint32_t csum;
|
||||
/* restore original state */
|
||||
((unsigned char*)des->des_src[0].seg_addr.pval)[ctx->index] ^= ~0;
|
||||
des->des_cbdata = ctx->cbdata;
|
||||
@ -95,8 +96,8 @@ int mca_bml_base_send(
|
||||
{
|
||||
static int count;
|
||||
des->des_context = bml_btl;
|
||||
if(count <= 0) {
|
||||
count = (int) ((1000.0 * rand())/(RAND_MAX+1.0));
|
||||
if(count <= 0 && mca_bml_base_error_rate > 0) {
|
||||
count = (int) ((mca_bml_base_error_rate * rand())/(RAND_MAX+1.0));
|
||||
if(count % 2) {
|
||||
/* local completion - network "drops" packet */
|
||||
opal_output(0, "dropping data\n");
|
||||
@ -106,14 +107,9 @@ int mca_bml_base_send(
|
||||
/* corrupt data */
|
||||
mca_bml_base_context_t* ctx = (mca_bml_base_context_t*)
|
||||
malloc(sizeof(mca_bml_base_context_t));
|
||||
opal_output(0, "corrupting data\n");
|
||||
if(NULL != ctx) {
|
||||
opal_output(0, "corrupting data\n");
|
||||
ctx->index = (size_t) ((des->des_src[0].seg_len * rand() * 1.0) / (RAND_MAX + 1.0));
|
||||
if(des->des_src[0].seg_len > 40 ) {
|
||||
unsigned char temp;
|
||||
ctx->index = 40;
|
||||
temp = ((unsigned char*)des->des_src[0].seg_addr.pval)[ctx->index];
|
||||
}
|
||||
ctx->cbfunc = des->des_cbfunc;
|
||||
ctx->cbdata = des->des_cbdata;
|
||||
((unsigned char*)des->des_src[0].seg_addr.pval)[ctx->index] ^= ~0;
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "ompi/mca/bml/bml.h"
|
||||
#include "ompi/mca/bml/base/base.h"
|
||||
#include "ompi/mca/btl/base/base.h"
|
||||
@ -27,6 +28,9 @@
|
||||
|
||||
opal_list_t mca_bml_base_components_available;
|
||||
|
||||
#if OMPI_ENABLE_DEBUG_RELIABILITY
|
||||
double mca_bml_base_error_rate;
|
||||
#endif
|
||||
|
||||
int mca_bml_base_open( void ) {
|
||||
|
||||
@ -36,6 +40,28 @@ int mca_bml_base_open( void ) {
|
||||
true)) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
#if OMPI_ENABLE_DEBUG_RELIABILITY
|
||||
do {
|
||||
int param, value;
|
||||
|
||||
mca_base_param_register_int("bml", NULL, "error_rate", "error_rate", 0);
|
||||
param = mca_base_param_find("bml", NULL, "error_rate");
|
||||
mca_base_param_lookup_int(param, &value);
|
||||
mca_bml_base_error_rate = value;
|
||||
|
||||
mca_base_param_register_int("bml", NULL, "srand", "srand", 1);
|
||||
param = mca_base_param_find("bml", NULL, "srand");
|
||||
mca_base_param_lookup_int(param, &value);
|
||||
|
||||
/* seed random number generator */
|
||||
if(value) {
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
srand(getpid() * tv.tv_usec);
|
||||
}
|
||||
} while (0);
|
||||
#endif
|
||||
return mca_btl_base_open();
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "ompi/class/ompi_free_list.h"
|
||||
#include "ompi/mca/pml/pml.h"
|
||||
|
||||
#define OMPI_ENABLE_DEBUG_RELIABILITY 0
|
||||
#define OMPI_ENABLE_DEBUG_RELIABILITY 1
|
||||
|
||||
/*
|
||||
* BML types
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user