
The primary change that underlies all this is in the OOB. Specifically, the problem in the code until now has been that the OOB attempts to resolve an address when we call the "send" to an unknown recipient. The OOB would then wait forever if that recipient never actually started (and hence, never reported back its OOB contact info). In the case of an orted that failed to start, we would correctly detect that the orted hadn't started, but then we would attempt to order all orteds (including the one that failed to start) to die. This would cause the OOB to "hang" the system. Unfortunately, revising how the OOB resolves addresses introduced a number of additional problems. Specifically, and most troublesome, was the fact that comm_spawn involved the immediate transmission of the rendezvous point from parent-to-child after the child was spawned. The current code used the OOB address resolution as a "barrier" - basically, the parent would attempt to send the info to the child, and then "hold" there until the child's contact info had arrived (meaning the child had started) and the send could be completed. Note that this also caused comm_spawn to "hang" the entire system if the child never started... The app-failed-to-start helped improve that behavior - this code provides additional relief. With this change, the OOB will return an ADDRESSEE_UNKNOWN error if you attempt to send to a recipient whose contact info isn't already in the OOB's hash tables. To resolve comm_spawn issues, we also now force the cross-sharing of connection info between parent and child jobs during spawn. Finally, to aid in setting triggers to the right values, we introduce the "arith" API for the GPR. This function allows you to atomically change the value in a registry location (either divide, multiply, add, or subtract) by the provided operand. It is equivalent to first fetching the value using a "get", then modifying it, and then putting the result back into the registry via a "put". This commit was SVN r14711.
322 строки
8.7 KiB
C
322 строки
8.7 KiB
C
/*
|
|
* Copyright (c) 2004-2005 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 "orte_config.h"
|
|
#include "orte/orte_constants.h"
|
|
#include "orte/orte_types.h"
|
|
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
#include <sys/param.h>
|
|
#endif
|
|
#ifdef HAVE_NETINET_IN_H
|
|
#include <netinet/in.h>
|
|
#endif
|
|
|
|
#include "opal/runtime/opal.h"
|
|
#include "orte/util/proc_info.h"
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
#include "orte/runtime/runtime.h"
|
|
|
|
#include "orte/dss/dss.h"
|
|
|
|
#define NUM_ITERS 100
|
|
#define NUM_ELEMS 1024
|
|
|
|
static bool test1(void); /* verify dss_copy_payload */
|
|
static bool test2(void); /* verify dss_xfer_payload */
|
|
|
|
FILE *test_out;
|
|
|
|
|
|
int main (int argc, char* argv[])
|
|
{
|
|
int ret;
|
|
|
|
orte_init(ORTE_INFRASTRUCTURE, ORTE_NON_BARRIER);
|
|
|
|
test_out = stderr;
|
|
|
|
/* run the tests */
|
|
|
|
fprintf(test_out, "executing test1\n");
|
|
if (test1()) {
|
|
fprintf(test_out, "Test1 succeeded\n");
|
|
}
|
|
else {
|
|
fprintf(test_out, "Test1 failed\n");
|
|
}
|
|
|
|
fprintf(test_out, "executing test2\n");
|
|
if (test2()) {
|
|
fprintf(test_out, "Test2 succeeded\n");
|
|
}
|
|
else {
|
|
fprintf(test_out, "Test2 failed\n");
|
|
}
|
|
|
|
orte_dss_close();
|
|
|
|
opal_finalize();
|
|
|
|
return(0);
|
|
}
|
|
|
|
static bool test1(void) /* verify dss_copy_payload */
|
|
{
|
|
orte_buffer_t *bufA, *bufB;
|
|
int rc;
|
|
int32_t i;
|
|
int16_t src[NUM_ELEMS];
|
|
int16_t dst[NUM_ELEMS];
|
|
int32_t src32[NUM_ELEMS];
|
|
int32_t dst32[NUM_ELEMS];
|
|
|
|
/* init src arrays */
|
|
for (i=0; i < NUM_ELEMS; i++) {
|
|
src[i] = i;
|
|
src32[i] = 132 * i;
|
|
}
|
|
|
|
/* init A */
|
|
bufA = OBJ_NEW(orte_buffer_t);
|
|
if (NULL == bufA) {
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
|
return false;
|
|
}
|
|
|
|
orte_dss.set_buffer_type(bufA, ORTE_DSS_BUFFER_NON_DESC);
|
|
|
|
/* pack something in A */
|
|
for (i=0;i<NUM_ITERS;i++) {
|
|
rc = orte_dss.pack(bufA, src, NUM_ELEMS, ORTE_INT16);
|
|
if (ORTE_SUCCESS != rc) {
|
|
fprintf(test_out, "orte_dss.pack failed with return code %d\n", rc);
|
|
return(false);
|
|
}
|
|
}
|
|
|
|
/* setup bufB */
|
|
bufB = OBJ_NEW(orte_buffer_t);
|
|
if (NULL == bufB) {
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
|
return false;
|
|
}
|
|
|
|
orte_dss.set_buffer_type(bufB, ORTE_DSS_BUFFER_NON_DESC);
|
|
|
|
/* pack something in B */
|
|
for (i=0;i<NUM_ITERS;i++) {
|
|
rc = orte_dss.pack(bufB, src32, NUM_ELEMS, ORTE_INT32);
|
|
if (ORTE_SUCCESS != rc) {
|
|
fprintf(test_out, "orte_dss.pack failed with return code %d\n", rc);
|
|
return(false);
|
|
}
|
|
}
|
|
|
|
/* copy payload to bufB */
|
|
if (ORTE_SUCCESS != (rc = orte_dss.copy_payload(bufB, bufA))) {
|
|
fprintf(test_out, "orte_dss.copy_payload failed with return code %d\n", rc);
|
|
return(false);
|
|
}
|
|
|
|
/* pack some more stuff in B */
|
|
for (i=0;i<NUM_ITERS;i++) {
|
|
rc = orte_dss.pack(bufB, src32, NUM_ELEMS, ORTE_INT32);
|
|
if (ORTE_SUCCESS != rc) {
|
|
fprintf(test_out, "orte_dss.pack failed with return code %d\n", rc);
|
|
return(false);
|
|
}
|
|
}
|
|
|
|
/* validate the results */
|
|
for (i=0; i<NUM_ITERS; i++) {
|
|
int j;
|
|
orte_std_cntr_t count;
|
|
|
|
for(j=0; j<NUM_ELEMS; j++)
|
|
dst32[j] = -1;
|
|
|
|
count = NUM_ELEMS;
|
|
rc = orte_dss.unpack(bufB, dst32, &count, ORTE_INT32);
|
|
if (ORTE_SUCCESS != rc || count != NUM_ELEMS) {
|
|
fprintf(test_out, "orte_dss.unpack of dest buffer failed with return code %d\n", rc);
|
|
return(false);
|
|
}
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
if(src32[j] != dst32[j]) {
|
|
fprintf(test_out, "test2: invalid results from unpack of dest buffer\n");
|
|
return(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
for (i=0; i<NUM_ITERS; i++) {
|
|
int j;
|
|
orte_std_cntr_t count;
|
|
|
|
for(j=0; j<NUM_ELEMS; j++)
|
|
dst[j] = -1;
|
|
|
|
count = NUM_ELEMS;
|
|
rc = orte_dss.unpack(bufB, dst, &count, ORTE_INT16);
|
|
if (ORTE_SUCCESS != rc || count != NUM_ELEMS) {
|
|
fprintf(test_out, "orte_dss.unpack of dest buffer failed with return code %d\n", rc);
|
|
return(false);
|
|
}
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
if(src[j] != dst[j]) {
|
|
fprintf(test_out, "test2: invalid results from unpack of dest buffer\n");
|
|
return(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
for (i=0; i<NUM_ITERS; i++) {
|
|
int j;
|
|
orte_std_cntr_t count;
|
|
|
|
for(j=0; j<NUM_ELEMS; j++)
|
|
dst32[j] = -1;
|
|
|
|
count = NUM_ELEMS;
|
|
rc = orte_dss.unpack(bufB, dst32, &count, ORTE_INT32);
|
|
if (ORTE_SUCCESS != rc || count != NUM_ELEMS) {
|
|
fprintf(test_out, "orte_dss.unpack of dest buffer failed with return code %d\n", rc);
|
|
return(false);
|
|
}
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
if(src32[j] != dst32[j]) {
|
|
fprintf(test_out, "test2: invalid results from unpack of dest buffer\n");
|
|
return(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* check that A is still okay */
|
|
for (i=0; i<NUM_ITERS; i++) {
|
|
int j;
|
|
orte_std_cntr_t count;
|
|
|
|
for(j=0; j<NUM_ELEMS; j++)
|
|
dst[j] = -1;
|
|
|
|
count = NUM_ELEMS;
|
|
rc = orte_dss.unpack(bufA, dst, &count, ORTE_INT16);
|
|
if (ORTE_SUCCESS != rc || count != NUM_ELEMS) {
|
|
fprintf(test_out, "orte_dss.unpack of src buffer failed with return code %d\n", rc);
|
|
return(false);
|
|
}
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
if(src[j] != dst[j]) {
|
|
fprintf(test_out, "test2: invalid results from unpack of src buffer\n");
|
|
return(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
OBJ_RELEASE(bufA);
|
|
OBJ_RELEASE(bufB);
|
|
if (NULL != bufA || NULL != bufB) {
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer\n");
|
|
return false;
|
|
}
|
|
|
|
return (true);
|
|
}
|
|
|
|
|
|
static bool test2(void) /* verify dss_xfer_payload */
|
|
{
|
|
orte_buffer_t *bufA, *bufB;
|
|
int rc;
|
|
int32_t i;
|
|
int16_t src[NUM_ELEMS];
|
|
int16_t dst[NUM_ELEMS];
|
|
|
|
bufA = OBJ_NEW(orte_buffer_t);
|
|
if (NULL == bufA) {
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
|
return false;
|
|
}
|
|
|
|
orte_dss.set_buffer_type(bufA, ORTE_DSS_BUFFER_NON_DESC);
|
|
|
|
for (i=0;i<NUM_ITERS;i++) {
|
|
rc = orte_dss.pack(bufA, src, NUM_ELEMS, ORTE_INT16);
|
|
if (ORTE_SUCCESS != rc) {
|
|
fprintf(test_out, "orte_dss.pack failed with return code %d\n", rc);
|
|
return(false);
|
|
}
|
|
}
|
|
|
|
/* setup bufB */
|
|
bufB = OBJ_NEW(orte_buffer_t);
|
|
if (NULL == bufB) {
|
|
fprintf(test_out, "orte_buffer failed init in OBJ_NEW\n");
|
|
return false;
|
|
}
|
|
|
|
orte_dss.set_buffer_type(bufB, ORTE_DSS_BUFFER_NON_DESC);
|
|
|
|
/* xfer payload to bufB */
|
|
if (ORTE_SUCCESS != (rc = orte_dss.xfer_payload(bufB, bufA))) {
|
|
fprintf(test_out, "orte_dss.xfer_payload failed with return code %d\n", rc);
|
|
return(false);
|
|
}
|
|
|
|
/* validate the results */
|
|
for (i=0; i<NUM_ITERS; i++) {
|
|
int j;
|
|
orte_std_cntr_t count;
|
|
|
|
for(j=0; j<NUM_ELEMS; j++)
|
|
dst[j] = -1;
|
|
|
|
count = NUM_ELEMS;
|
|
rc = orte_dss.unpack(bufB, dst, &count, ORTE_INT16);
|
|
if (ORTE_SUCCESS != rc || count != NUM_ELEMS) {
|
|
fprintf(test_out, "orte_dss.unpack of dest buffer failed with return code %d\n", rc);
|
|
return(false);
|
|
}
|
|
|
|
for(j=0; j<NUM_ELEMS; j++) {
|
|
if(src[j] != dst[j]) {
|
|
fprintf(test_out, "test2: invalid results from unpack of dest buffer\n");
|
|
return(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
OBJ_RELEASE(bufA);
|
|
OBJ_RELEASE(bufB);
|
|
if (NULL != bufA || NULL != bufB) {
|
|
fprintf(test_out, "OBJ_RELEASE did not NULL the buffer pointer\n");
|
|
return false;
|
|
}
|
|
|
|
return (true);
|
|
}
|