1
1

Need to do an early commit for a name change.

This commit was SVN r2600.
Этот коммит содержится в:
Ralph Castain 2004-09-10 18:06:55 +00:00
родитель dde3dfee76
Коммит f9da579582
2 изменённых файлов: 176 добавлений и 25 удалений

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

@ -1,39 +1,19 @@
# -*- makefile -*-
#
# $HEADER$
#
include $(top_srcdir)/config/Makefile.options
AM_CPPFLAGS = \
-DOMPI_PREFIX="\"$(prefix)\"" \
-DOMPI_BINDIR="\"$(bindir)\"" \
-DOMPI_LIBDIR="\"$(libdir)\"" \
-DOMPI_INCDIR="\"$(includedir)\"" \
-DOMPI_PKGLIBDIR="\"$(pkglibdir)\"" \
-DOMPI_SYSCONFDIR="\"$(sysconfdir)\"" \
-DOMPI_CONFIGURE_USER="\"@OMPI_CONFIGURE_USER@\"" \
-DOMPI_CONFIGURE_HOST="\"@OMPI_CONFIGURE_HOST@\"" \
-DOMPI_CONFIGURE_DATE="\"@OMPI_CONFIGURE_DATE@\""
libs = $(top_builddir)/src/libmpi.la
bin_PROGRAMS = \
openmpi-console
ompi-console
openmpi_console_SOURCES = \
openmpi-console.h \
openmpi-console.c
ompi-console_SOURCES = \
ompi-console.c
openmpi_console_LDADD = \
$(libs) \
$(LIBMPI_EXTRA_LIBS) \
$(LIBOMPI_EXTRA_LIBS) \
$(top_builddir)/src/libmpi.la
openmpi_console_DFLAGS = $(LIBMPI_EXTRA_LDFLAGS) $(LIBOMPI_EXTRA_LDFLAGS)
openmpi_console_DEPENDENCIES = $(libs) \
$(openmpi_console_LDADD)
ompi-console_LDADD = $(libs)
ompi-console_DEPENDENCIES = $(ompi-console_LDADD)
clean-local:
test -z "$(OMPI_CXX_TEMPLATE_REPOSITORY)" || $(RM) -rf $(OMPI_CXX_TEMPLATE_REPOSITORY)

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

@ -0,0 +1,171 @@
/*
* $HEADER$
*/
/** @file **/
#include "ompi_config.h"
#include <stdio.h>
#include "include/constants.h"
#include "util/pack.h"
#include "runtime/runtime.h"
#include "tools/ompid/ompid.h"
int main(int argc, char *argv[])
{
/*
* Intialize the Open MPI environment
*/
if (OMPI_SUCCESS != ompi_init(argc, argv)) {
/* BWB show_help */
printf("show_help: ompi_init failed\n");
return ret;
}
/* setup to read common command line options that span all Open MPI programs */
cmd_line = OBJ_NEW(ompi_cmd_line_t);
ompi_cmd_line_make_opt(cmd_line, 'v', "version", 0,
"Show version of Open MPI and this program");
ompi_cmd_line_make_opt(cmd_line, 'h', "help", 0,
"Show help for this function");
/* setup rte command line arguments */
ompi_rte_cmd_line_setup(cmd_line);
/*
* setup mca command line arguments
*/
if (OMPI_SUCCESS != (ret = mca_base_cmd_line_setup(cmd_line))) {
/* BWB show_help */
printf("show_help: mca_base_cmd_line_setup failed\n");
return ret;
}
if (OMPI_SUCCESS != mca_base_cmd_line_process_args(cmd_line)) {
/* BWB show_help */
printf("show_help: mca_base_cmd_line_process_args\n");
return ret;
}
/* parse the local commands */
if (OMPI_SUCCESS != ompi_cmd_line_parse(cmd_line, true, argc, argv)) {
exit(ret);
}
if (ompi_cmd_line_is_taken(cmd_line, "help") ||
ompi_cmd_line_is_taken(cmd_line, "h")) {
printf("...showing ompi_info help message...\n");
exit(1);
}
if (ompi_cmd_line_is_taken(cmd_line, "version") ||
ompi_cmd_line_is_taken(cmd_line, "v")) {
printf("...showing off my version!\n");
exit(1);
}
/* parse the cmd_line for rte options - override settings from enviro, where necessary
* copy everything into enviro variables for passing later on
*/
ompi_rte_parse_cmd_line(cmd_line);
/* Open up the MCA */
if (OMPI_SUCCESS != (ret = mca_base_open())) {
/* JMS show_help */
printf("show_help: ompid failed in mca_base_open\n");
return ret;
}
/* Join the run-time environment */
allow_multi_user_threads = true;
have_hidden_threads = false;
if (OMPI_SUCCESS != (ret = ompi_rte_init_stage1(&allow_multi_user_threads,
&have_hidden_threads))) {
/* JMS show_help */
printf("show_help: ompid failed in ompi_rte_init\n");
return ret;
}
/* check for local universe existence */
if (0 != strncmp(ompi_universe_info.host, ompi_system_info.nodename, strlen(ompi_system_info.nodename))) {
fprintf(stderr, "remote universe operations not supported at this time\n");
exit(1);
}
if (OMPI_SUCCESS != (ret = ompi_rte_local_universe_exists())) {
fprintf(stderr, "could not contact local universe %s\n", ompi_universe_info.name);
exit(1);
}
/* setup the rest of the rte */
if (OMPI_SUCCESS != (ret = ompi_rte_init_stage2(&allow_multi_user_threads,
&have_hidden_threads))) {
/* JMS show_help */
printf("show_help: ompid failed in ompi_rte_init\n");
return ret;
}
/***** SET MY NAME *****/
if (NULL == ompi_process_info.name) { /* don't overwrite an existing name */
if (ompi_process_info.seed) {
ompi_process_info.name = ompi_name_server.create_process_name(0, 0, 0);
} else {
ompi_process_info.name = ompi_rte_get_self();
}
}
/* finalize the rte startup */
if (OMPI_SUCCESS != (ret = ompi_rte_init_finalstage(&allow_multi_user_threads,
&have_hidden_threads))) {
/* register the console callback function */
ret = mca_oob_recv_packed_nb(MCA_OOB_NAME_ANY, MCA_OOB_TAG_DAEMON, 0, ompi_console_recv, NULL);
if(ret != OMPI_SUCCESS && ret != OMPI_ERR_NOT_IMPLEMENTED) {
ompi_output(0, "daemon callback not registered: error code %d", ret);
return ret;
}
ompi_rte_finalize();
mca_base_close();
ompi_finalize();
return 0;
}
static void ompi_console_recv(int status, ompi_process_name_t* sender,
ompi_buffer_t buffer, int tag,
void* cbdata)
{
ompi_daemon_cmd_flag_t command;
int32_t num_bytes, i;
uint8_t *outbytes;
printf("console - message received from [%d,%d,%d]\n", sender->cellid,
sender->jobid, sender->vpid);
if (OMPI_SUCCESS != ompi_unpack(buffer, &num_bytes, OMPI_INT32)) {
printf("\terror unpacking number of bytes\n");
return;
}
outbytes = (uint8_t*)malloc(num_bytes);
if (OMPI_SUCCESS != ompi_unpack(buffer, &outbytes, OMPI_BYTE)) {
printf("\terror unpacking number of bytes\n");
return;
}
for (i=0; i<num_bytes; i++) {
printf("%c", outbytes[i]);
}
free(outbytes);
ompi_buffer_free(buffer);
return;
}