1
1

* move error -> string converter registration from orte_init to

orte_init_stage1(), since not all ORTE processes call orte_init().
* Expad opal_error test case to make sure ORTE error codes print
  properly
* Make project error codes start at easy values (OPAL is -1 to -100,
  ORTE is -101 to -200, OMPI is less than -201) to make it easier
  to figure out what an error code as an integer means.  Also has
  the nice property of not changing the values of error codes ever
  time a new error code is added.

This commit was SVN r7061.
Этот коммит содержится в:
Brian Barrett 2005-08-26 23:36:57 +00:00
родитель 0eabdd9498
Коммит 2143ed4c81
6 изменённых файлов: 117 добавлений и 110 удалений

Просмотреть файл

@ -47,7 +47,7 @@ enum {
OPAL_ERR_FILE_OPEN_FAILURE = (OPAL_ERR_BASE - 21)
};
#define OPAL_ERR_MAX (OPAL_ERR_BASE - 21)
#define OPAL_ERR_MAX (OPAL_ERR_BASE - 100)
#endif /* OPAL_CONSTANTS_H */

Просмотреть файл

@ -82,7 +82,7 @@ enum {
ORTE_ERR_TYPE_MISMATCH = (ORTE_ERR_BASE - 30)
};
#define ORTE_ERR_MAX (ORTE_ERR_BASE - 30)
#define ORTE_ERR_MAX (ORTE_ERR_BASE - 100)
#endif /* ORTE_CONSTANTS_H */

Просмотреть файл

@ -34,8 +34,6 @@
/* globals used by RTE */
int orte_debug_flag=(int)false;
static const char * orte_err2str(int errnum);
int orte_init(bool infrastructure)
{
int rc;
@ -44,9 +42,6 @@ int orte_init(bool infrastructure)
ORTE_ERROR_LOG(rc);
return rc;
}
/* register handler for errnum -> string converstion */
opal_error_register(orte_err2str);
if (ORTE_SUCCESS != (rc = orte_system_init(infrastructure))) {
ORTE_ERROR_LOG(rc);
@ -55,104 +50,3 @@ int orte_init(bool infrastructure)
return ORTE_SUCCESS;
}
static const char *
orte_err2str(int errnum)
{
const char *retval;
switch (errnum) {
case ORTE_ERR_RECV_LESS_THAN_POSTED:
retval = "Receive was less than posted size";
break;
case ORTE_ERR_RECV_MORE_THAN_POSTED:
retval = "Receive was greater than posted size";
break;
case ORTE_ERR_NO_MATCH_YET:
retval = "No match for receive posted";
break;
case ORTE_ERR_BUFFER:
retval = "Buffer error";
break;
case ORTE_ERR_REQUEST:
retval = "Request error";
break;
case ORTE_ERR_NO_CONNECTION_ALLOWED:
retval = "No connection allowed";
break;
case ORTE_ERR_CONNECTION_REFUSED:
retval = "Connection refused";
break;
case ORTE_ERR_CONNECTION_FAILED:
retval = "Connection failed";
break;
case ORTE_STARTUP_DETECTED:
retval = "Startup detected";
break;
case ORTE_SHUTDOWN_DETECTED:
retval = "Shutdown detected";
break;
case ORTE_PROC_STARTING:
retval = "Proccess starting";
break;
case ORTE_PROC_STOPPED:
retval = "Proccess stopped";
break;
case ORTE_PROC_TERMINATING:
retval = "Proccess terminating";
break;
case ORTE_PROC_ALIVE:
retval = "Proccess alive";
break;
case ORTE_PROC_RUNNING:
retval = "Process running";
break;
case ORTE_PROC_KILLED:
retval = "Process killed";
break;
case ORTE_PROC_EXITED:
retval = "Process exited";
break;
case ORTE_NODE_UP:
retval = "Node is up";
break;
case ORTE_NODE_DOWN:
retval = "Node is down";
break;
case ORTE_NODE_BOOTING:
retval = "Node is booting";
break;
case ORTE_NODE_ERROR:
retval = "Node is in error condition";
break;
case ORTE_PACK_MISMATCH:
retval = "Pack data mismatch";
break;
case ORTE_ERR_PACK_FAILURE:
retval = "Data pack failed";
break;
case ORTE_ERR_UNPACK_FAILURE:
retval = "Data unpack failed";
break;
case ORTE_ERR_COMM_FAILURE:
retval = "Communication failure";
break;
case ORTE_UNPACK_INADEQUATE_SPACE:
retval = "Data unpack had inadequate space";
break;
case ORTE_UNPACK_READ_PAST_END_OF_BUFFER:
retval = "Data unpack would read past end of buffer";
break;
case ORTE_ERR_GPR_DATA_CORRUPT:
retval = "GPR data corruption";
break;
case ORTE_ERR_TYPE_MISMATCH:
retval = "Type mismatch";
break;
default:
retval = NULL;
}
return retval;
}

Просмотреть файл

@ -57,6 +57,8 @@
#include "runtime/runtime_internal.h"
#include "runtime/orte_wait.h"
static const char * orte_err2str(int errnum);
int orte_init_stage1(bool infrastructure)
{
int ret;
@ -66,6 +68,9 @@ int orte_init_stage1(bool infrastructure)
orte_jobid_t my_jobid;
orte_cellid_t my_cellid;
/* register handler for errnum -> string converstion */
opal_error_register(orte_err2str);
/* Register all MCA Params */
if (ORTE_SUCCESS != (ret = orte_register_params(infrastructure))) {
ORTE_ERROR_LOG(ret);
@ -455,3 +460,103 @@ int orte_init_stage1(bool infrastructure)
return ORTE_SUCCESS;
}
static const char *
orte_err2str(int errnum)
{
const char *retval;
switch (errnum) {
case ORTE_ERR_RECV_LESS_THAN_POSTED:
retval = "Receive was less than posted size";
break;
case ORTE_ERR_RECV_MORE_THAN_POSTED:
retval = "Receive was greater than posted size";
break;
case ORTE_ERR_NO_MATCH_YET:
retval = "No match for receive posted";
break;
case ORTE_ERR_BUFFER:
retval = "Buffer error";
break;
case ORTE_ERR_REQUEST:
retval = "Request error";
break;
case ORTE_ERR_NO_CONNECTION_ALLOWED:
retval = "No connection allowed";
break;
case ORTE_ERR_CONNECTION_REFUSED:
retval = "Connection refused";
break;
case ORTE_ERR_CONNECTION_FAILED:
retval = "Connection failed";
break;
case ORTE_STARTUP_DETECTED:
retval = "Startup detected";
break;
case ORTE_SHUTDOWN_DETECTED:
retval = "Shutdown detected";
break;
case ORTE_PROC_STARTING:
retval = "Proccess starting";
break;
case ORTE_PROC_STOPPED:
retval = "Proccess stopped";
break;
case ORTE_PROC_TERMINATING:
retval = "Proccess terminating";
break;
case ORTE_PROC_ALIVE:
retval = "Proccess alive";
break;
case ORTE_PROC_RUNNING:
retval = "Process running";
break;
case ORTE_PROC_KILLED:
retval = "Process killed";
break;
case ORTE_PROC_EXITED:
retval = "Process exited";
break;
case ORTE_NODE_UP:
retval = "Node is up";
break;
case ORTE_NODE_DOWN:
retval = "Node is down";
break;
case ORTE_NODE_BOOTING:
retval = "Node is booting";
break;
case ORTE_NODE_ERROR:
retval = "Node is in error condition";
break;
case ORTE_PACK_MISMATCH:
retval = "Pack data mismatch";
break;
case ORTE_ERR_PACK_FAILURE:
retval = "Data pack failed";
break;
case ORTE_ERR_UNPACK_FAILURE:
retval = "Data unpack failed";
break;
case ORTE_ERR_COMM_FAILURE:
retval = "Communication failure";
break;
case ORTE_UNPACK_INADEQUATE_SPACE:
retval = "Data unpack had inadequate space";
break;
case ORTE_UNPACK_READ_PAST_END_OF_BUFFER:
retval = "Data unpack would read past end of buffer";
break;
case ORTE_ERR_GPR_DATA_CORRUPT:
retval = "GPR data corruption";
break;
case ORTE_ERR_TYPE_MISMATCH:
retval = "Type mismatch";
break;
default:
retval = NULL;
}
return retval;
}

Просмотреть файл

@ -40,7 +40,8 @@ ompi_numtostr_DEPENDENCIES = $(ompi_numtostr_LDADD)
opal_error_SOURCES = opal_error.c
opal_error_LDADD = \
$(top_builddir)/opal/libopal.la
$(top_builddir)/opal/libopal.la \
$(top_builddir)/orte/liborte.la
opal_error_DEPENDENCIES = $(opal_error_LDADD)
opal_if_SOURCES = opal_if.c

Просмотреть файл

@ -36,7 +36,8 @@
#include "opal/util/error.h"
#include "opal/include/constants.h"
#include "opal/runtime/opal.h"
#include "orte/runtime/runtime.h"
#include "orte/include/orte_constants.h"
int
main(int argc, char *argv[])
@ -52,6 +53,8 @@ main(int argc, char *argv[])
char buf[1024];
opal_init();
orte_init_stage1(true);
orte_init_stage2();
for (i = 0 ; errors[i] <= 0 ; ++i) {
printf("--> error code: %d\n", errors[i]);
@ -70,6 +73,10 @@ main(int argc, char *argv[])
opal_strerror_r(OPAL_ERR_IN_ERRNO, buf, sizeof(buf));
printf("strerror_r test: %s\n", buf);
printf("--> orte error test\n");
opal_perror(ORTE_ERR_BUFFER, "orte test");
orte_system_finalize();
opal_finalize();
return 0;