* start portals development again. nothing interesting, just some code
cleanup This commit was SVN r5501.
Этот коммит содержится в:
родитель
24eef59f7b
Коммит
8f73d829d4
@ -30,12 +30,16 @@ component_noinst = libmca_ptl_portals.la
|
||||
component_install =
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
ptl_portals_compat_utcp.c \
|
||||
ptl_portals_compat_redstorm.c
|
||||
|
||||
portals_SOURCES = \
|
||||
ptl_portals.h \
|
||||
ptl_portals_nal.h \
|
||||
ptl_portals_compat.h \
|
||||
ptl_portals_component.c \
|
||||
ptl_portals_nal.c \
|
||||
ptl_portals_stubs.c
|
||||
ptl_portals_stubs.c \
|
||||
ptl_portals_compat_utcp.c
|
||||
|
||||
|
||||
mcacomponentdir = $(libdir)/openmpi
|
||||
|
@ -28,7 +28,6 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
|
||||
[Specify the installation directory of PORTALS]))
|
||||
|
||||
# Add to CPPFLAGS if necessary
|
||||
|
||||
EXTRA_CPPFLAGS=
|
||||
if test -n "$with_ptl_portals"; then
|
||||
if test -d "$with_ptl_portals/include"; then
|
||||
@ -40,13 +39,11 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
|
||||
fi
|
||||
|
||||
# See if we can find portals.h
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $EXTRA_CPPFLAGS"
|
||||
AC_CHECK_HEADERS(portals3.h,,
|
||||
AC_MSG_ERROR([*** Cannot find working portals3.h.]))
|
||||
|
||||
# Add to LDFLAGS if necessary
|
||||
|
||||
EXTRA_LDFLAGS=
|
||||
if test -n "$with_ptl_portals"; then
|
||||
if test -d "$with_ptl_portals/lib"; then
|
||||
@ -56,24 +53,38 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
|
||||
AC_MSG_WARN([*** Will still try to configure portals ptl anyway...])
|
||||
fi
|
||||
fi
|
||||
PORTALS_LIBS="-lp3api -lp3lib -lp3rt"
|
||||
|
||||
# Should we enable special setup magic for UTCP reference
|
||||
# implementation?
|
||||
|
||||
#
|
||||
# BWB - XXX - FIXME - make this not the default for release
|
||||
PTL_PORTALS_NAL_UTCP=0
|
||||
AC_ARG_ENABLE(ptl-portals-nal-utcp,
|
||||
AC_HELP_STRING([--enable-ptl-portals-nal-utcp],
|
||||
[enable pre-init code to configure the utcp NAL]))
|
||||
if test "$enable_ptl_portals_utcp" = "no" ; then
|
||||
PTL_PORTALS_NAL_UTCP=0
|
||||
else
|
||||
PORTALS_LIBS="-lutcpapi -lutcplib -lp3api -lp3lib -lp3rt"
|
||||
PTL_PORTALS_NAL_UTCP=1
|
||||
# Configure Portals for our local environment
|
||||
#
|
||||
PTL_PORTALS_UTCP=0
|
||||
PTL_PORTALS_REDSTORM=0
|
||||
PTL_PORTALS_COMPAT=""
|
||||
|
||||
AC_ARG_WITH([ptl-portals-config],
|
||||
AC_HELP_STRING([--with-ptl-portals-config],
|
||||
[configuration to use for Portals support.
|
||||
One of "utcp", "redstorm". (default: utcp)]))
|
||||
AC_MSG_CHECKING([for Portals configuration])
|
||||
if test "$with_ptl_portals_config" = "" ; then
|
||||
with_ptl_portals_config="utcp"
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([PTL_PORTALS_NAL_UTCP], [$PTL_PORTALS_NAL_UTCP],
|
||||
[enable special startup code for the utcp NAL])
|
||||
case "$with_ptl_portals_config" in
|
||||
"utcp")
|
||||
PTL_PORTALS_UTCP=1
|
||||
PORTALS_LIBS="-lutcpapi -lutcplib -lp3api -lp3lib -lp3rt"
|
||||
AC_MSG_RESULT([utcp])
|
||||
;;
|
||||
"redstorm")
|
||||
PTL_PORTALS_REDSTORM=1
|
||||
PORTALS_LIBS="-lp3api -lp3lib -lp3rt"
|
||||
AC_MSG_RESULT([red storm])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([unknown Portals configuration. Can not continue])
|
||||
;;
|
||||
esac
|
||||
|
||||
# Try to find all the portals libraries (this is not fun!)
|
||||
AC_ARG_WITH(ptl-portals-libs,
|
||||
@ -94,6 +105,14 @@ AC_DEFUN([MCA_CONFIGURE_STUB],[
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Can not link with Portals libraries])])
|
||||
|
||||
AC_DEFINE_UNQUOTED([PTL_PORTALS_UTCP], [$PTL_PORTALS_UTCP],
|
||||
[Use the UTCP reference implementation or Portals])
|
||||
AM_CONDITIONAL([PTL_PORTALS_UTCP], [test "$PTL_PORTALS_UTCP" = "1"])
|
||||
|
||||
AC_DEFINE_UNQUOTED([PTL_PORTALS_REDSTORM], [$PTL_PORTALS_REDSTORM],
|
||||
[Use the Red Storm implementation or Portals])
|
||||
AM_CONDITIONAL([PTL_PORTALS_REDSTORM], [test "$PTL_PORTALS_REDSTORM" = "1"])
|
||||
|
||||
#
|
||||
# Save extra compiler/linker flags so that they can be added in
|
||||
# the wrapper compilers, if necessary
|
||||
|
88
src/mca/ptl/portals/ptl_portals.c
Обычный файл
88
src/mca/ptl/portals/ptl_portals.c
Обычный файл
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* 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 "ompi_config.h"
|
||||
#include "portals_config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "util/output.h"
|
||||
|
||||
#include "ptl_portals.h"
|
||||
#include "ptl_portals_nal.h"
|
||||
|
||||
mca_ptl_portals_module_t mca_ptl_portals_module = {
|
||||
{
|
||||
&mca_ptl_portals_component.super,
|
||||
1, /* max size of request cache */
|
||||
0, /* byest required by ptl for a request */
|
||||
0, /* max size of first frag */
|
||||
0, /* min size of frag */
|
||||
0, /* max size of frag */
|
||||
50, /* latency */
|
||||
0, /* bandwidth */
|
||||
0, /* ptl flags */
|
||||
|
||||
mca_ptl_portals_add_procs,
|
||||
mca_ptl_portals_del_procs,
|
||||
mca_ptl_portals_finalize,
|
||||
mca_ptl_portals_send,
|
||||
mca_ptl_portals_put,
|
||||
mca_ptl_portals_get,
|
||||
mca_ptl_portals_matched,
|
||||
mca_ptl_portals_request_init,
|
||||
mca_ptl_portals_request_fini,
|
||||
|
||||
mca_ptl_portals_match,
|
||||
mca_ptl_portals_send_progess,
|
||||
mca_ptl_portals_recv_progress,
|
||||
|
||||
NULL, /* PTL stack */
|
||||
NULL /* PML use */
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
int
|
||||
mca_ptl_portals_add_procs(struct mca_ptl_base_module_t* ptl,
|
||||
size_t nprocs, struct ompi_proc_t **procs,
|
||||
struct mca_ptl_base_peer_t** peers,
|
||||
ompi_bitmap_t* reachable);
|
||||
{
|
||||
int ret;
|
||||
struct ompi_proc_t *local_proc = ompi_proc_local();
|
||||
struct ompi_ptoc_t *curr_proc;
|
||||
size_t i;
|
||||
|
||||
ret = mca_ptl_portals_add_procs_compat(ptl, nprocs, procs,
|
||||
peers, reachable);
|
||||
if (OMPI_SUCCESS != ret) return ret;
|
||||
|
||||
/* loop through all procs, setting our reachable flag */
|
||||
for (i= 0; i < nprocs ; ++i) {
|
||||
curr_proc = procs[i];
|
||||
/* BWB - do we want to send to self? No for now */
|
||||
if (curr_proc == local_proc) continue;
|
||||
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
@ -19,13 +19,18 @@
|
||||
#ifndef MCA_PTL_PORTALS_H
|
||||
#define MCA_PTL_PORTALS_H
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/ptl/ptl.h"
|
||||
#include "class/ompi_bitmap.h"
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "class/ompi_proc_table.h"
|
||||
|
||||
/* need this type for the compat header */
|
||||
struct mca_ptl_portals_component_t;
|
||||
typedef struct mca_ptl_portals_component_t mca_ptl_portals_component_t;
|
||||
|
||||
#include "ptl_portals_compat.h"
|
||||
|
||||
|
||||
/**
|
||||
* Portals PTL component.
|
||||
@ -51,17 +56,9 @@ struct mca_ptl_portals_component_t {
|
||||
/** Number of currently active portals modules */
|
||||
uint32_t portals_num_modules;
|
||||
/** List of currently running modules */
|
||||
struct mca_ptl_base_module_t **portals_modules;
|
||||
|
||||
/** Initial size of the free lists */
|
||||
int32_t portals_free_list_num;
|
||||
/** maximum size of the free lists */
|
||||
int32_t portals_free_list_max;
|
||||
/** number of elements to alloc when group free lists */
|
||||
int32_t portals_free_list_inc;
|
||||
struct mca_ptl_portals_module_t **portals_modules;
|
||||
};
|
||||
|
||||
typedef struct mca_ptl_portals_component_t mca_ptl_portals_component_t;
|
||||
struct mca_ptl_portals_recv_frag_t;
|
||||
struct mca_ptl_portals_send_frag_t;
|
||||
|
||||
@ -103,8 +100,8 @@ extern int mca_ptl_portals_component_close(void);
|
||||
|
||||
extern mca_ptl_base_module_t** mca_ptl_portals_component_init(
|
||||
int *num_ptls,
|
||||
bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads
|
||||
bool enable_progress_threads,
|
||||
bool enable_mpi_threads
|
||||
);
|
||||
|
||||
|
||||
@ -144,6 +141,11 @@ extern int mca_ptl_portals_component_progress(
|
||||
*/
|
||||
struct mca_ptl_portals_module_t {
|
||||
mca_ptl_base_module_t super; /**< base PTL module interface */
|
||||
|
||||
/** our portals network interface */
|
||||
ptl_handle_ni_t ni_handle;
|
||||
/** the limits returned from PtlNIInit for interface */
|
||||
ptl_ni_limits_t limits;
|
||||
};
|
||||
typedef struct mca_ptl_portals_module_t mca_ptl_portals_module_t;
|
||||
|
||||
@ -354,4 +356,5 @@ extern int mca_ptl_portals_send_continue(
|
||||
int flags
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
45
src/mca/ptl/portals/ptl_portals_compat.h
Обычный файл
45
src/mca/ptl/portals/ptl_portals_compat.h
Обычный файл
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PTL_PORTALS_COMPAT_H
|
||||
#define PTL_PORTALS_COMPAT_H
|
||||
|
||||
#if PTL_PORTALS_UTCP
|
||||
|
||||
#include <portals3.h>
|
||||
#include <p3nal_utcp.h>
|
||||
#include <p3rt/p3rt.h>
|
||||
#include <p3api/debug.h>
|
||||
|
||||
#elif PTL_PORTALS_REDSTORM
|
||||
|
||||
#error "Red Storm Compatibility not implemented"
|
||||
|
||||
#else
|
||||
|
||||
#error "Unknown Portals library configuration"
|
||||
|
||||
#endif
|
||||
|
||||
int mca_ptl_portals_init(mca_ptl_portals_component_t *comp);
|
||||
|
||||
int mca_ptl_portals_add_procs_compat(struct mca_ptl_base_module_t* ptl,
|
||||
size_t nprocs, struct ompi_proc_t **procs,
|
||||
struct mca_ptl_base_peer_t** peers,
|
||||
ompi_bitmap_t* reachable);
|
||||
|
||||
#endif /* PTL_PORTALS_NAL_H */
|
@ -14,22 +14,5 @@
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PTL_PORTALS_NAL_H
|
||||
#define PTL_PORTALS_NAL_H
|
||||
|
||||
/******************* UTCP CONFIGURATION **********************/
|
||||
|
||||
#include <portals3.h>
|
||||
#include <p3nal_utcp.h>
|
||||
#include <p3rt/p3rt.h>
|
||||
#include <p3api/debug.h>
|
||||
|
||||
int mca_ptl_portals_nal_init(void);
|
||||
|
||||
int mca_ptl_portals_nal_configure(size_t nprocs, struct ompi_proc_t **procs);
|
||||
|
||||
/******************* CRAY CONFIGURATION **********************/
|
||||
|
||||
|
||||
#endif /* PTL_PORTALS_NAL_H */
|
||||
#include "ompi_config.h"
|
||||
#include "portals_config.h"
|
174
src/mca/ptl/portals/ptl_portals_compat_utcp.c
Обычный файл
174
src/mca/ptl/portals/ptl_portals_compat_utcp.c
Обычный файл
@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* 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 "ompi_config.h"
|
||||
#include "portals_config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "util/output.h"
|
||||
|
||||
#include "ptl_portals.h"
|
||||
|
||||
/* how's this for source code diving? - find private method for
|
||||
getting interface */
|
||||
extern unsigned int utcp_my_nid(const char *if_str);
|
||||
|
||||
/* these need to be defined, or things get "unhappy" */
|
||||
FILE* utcp_api_out;
|
||||
FILE* utcp_lib_out;
|
||||
|
||||
int
|
||||
mca_ptl_portals_init(mca_ptl_portals_component_t *comp)
|
||||
{
|
||||
ptl_process_id_t info;
|
||||
int ret;
|
||||
|
||||
utcp_lib_out = stderr;
|
||||
utcp_api_out = stderr;
|
||||
|
||||
info.nid = utcp_my_nid(mca_ptl_portals_component.portals_ifname);
|
||||
info.pid = (ptl_pid_t) getpid();
|
||||
ompi_output_verbose(100, mca_ptl_portals_component.portals_output,
|
||||
"contact info: %u, %u", info.nid, info.pid);
|
||||
|
||||
ret = mca_base_modex_send(&mca_ptl_portals_component.super.ptlm_version,
|
||||
&info, sizeof(ptl_process_id_t));
|
||||
if (OMPI_SUCCESS != ret) {
|
||||
ompi_output_verbose(10, mca_ptl_portals_component.portals_output,
|
||||
"mca_base_modex_send failed: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* with the utcp interface, only ever one "NIC" */
|
||||
comp->portals_num_modules = 1;
|
||||
comp->portals_modules = calloc(comp->portals_num_modules,
|
||||
sizeof(mca_ptl_portals_module_t *));
|
||||
if (NULL == comp->portals_modules) {
|
||||
ompi_output_verbose(10, mca_ptl_portals_component.portals_output,
|
||||
"malloc failed in mca_ptl_portals_init");
|
||||
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
|
||||
}
|
||||
comp->portals_modules[0] = malloc(sizeof(mca_ptl_portals_module_t));
|
||||
if (NULL == comp->portals_modules) {
|
||||
ompi_output_verbose(10, mca_ptl_portals_component.portals_output,
|
||||
"malloc failed in mca_ptl_portals_init");
|
||||
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mca_ptl_portals_add_procs_compat(struct mca_ptl_base_module_t* ptl_base,
|
||||
size_t nprocs, struct ompi_proc_t **procs,
|
||||
struct mca_ptl_base_peer_t** peers,
|
||||
ompi_bitmap_t* reachable)
|
||||
{
|
||||
int ret, my_rid;
|
||||
char *env;
|
||||
ptl_process_id_t *info;
|
||||
char *nidmap = NULL;
|
||||
char *pidmap = NULL;
|
||||
const size_t map_size = nprocs * 12 + 1; /* 12 is max length of long in decimal */
|
||||
size_t size, i;
|
||||
char *tmp;
|
||||
ompi_proc_t* proc_self = ompi_proc_local();
|
||||
int max_interfaces;
|
||||
struct mca_ptl_portals_module_t *ptl = (struct mca_ptl_portals_module_t*) ptl_base;
|
||||
|
||||
/*
|
||||
* Do all the NID/PID map setup
|
||||
*/
|
||||
/* each nid is a int, so need 10 there, plus the : */
|
||||
nidmap = malloc(map_size);
|
||||
pidmap = malloc(map_size);
|
||||
if (NULL == nidmap || NULL == pidmap) return OMPI_ERROR;
|
||||
|
||||
for (i = 0 ; i < nprocs ; ++i) {
|
||||
if (proc_self == procs[i]) my_rid = i;
|
||||
|
||||
ret = mca_base_modex_recv(&mca_ptl_portals_component.super.ptlm_version,
|
||||
procs[i], (void**) &info, &size);
|
||||
if (OMPI_SUCCESS != ret) {
|
||||
ompi_output_verbose(10, mca_ptl_portals_component.portals_output,
|
||||
"mca_base_modex_recv failed: %d", ret);
|
||||
return ret;
|
||||
} else if (sizeof(ptl_process_id_t) != size) {
|
||||
ompi_output_verbose(10, mca_ptl_portals_component.portals_output,
|
||||
"mca_base_modex_recv returned size%d",
|
||||
size);
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
snprintf(nidmap, map_size, "%u", info->nid);
|
||||
snprintf(pidmap, map_size, "%u", info->pid);
|
||||
} else {
|
||||
snprintf(nidmap, map_size, "%s:%u", nidmap, info->nid);
|
||||
snprintf(pidmap, map_size, "%s:%u", nidmap, info->pid);
|
||||
}
|
||||
}
|
||||
|
||||
ompi_output_verbose(100, mca_ptl_portals_component.portals_output,
|
||||
"my rid: %u", my_rid);
|
||||
ompi_output_verbose(100, mca_ptl_portals_component.portals_output,
|
||||
"nid map: %s", nidmap);
|
||||
ompi_output_verbose(100, mca_ptl_portals_component.portals_output,
|
||||
"pid map: %s", pidmap);
|
||||
ompi_output_verbose(100, mca_ptl_portals_component.portals_output,
|
||||
"iface: %s", mca_ptl_portals_component.portals_ifname);
|
||||
|
||||
asprintf(&tmp, "PTL_MY_RID=%u", my_rid);
|
||||
putenv(tmp);
|
||||
asprintf(&tmp, "PTL_NIDMAP=%s", nidmap);
|
||||
putenv(tmp);
|
||||
asprintf(&tmp, "PTL_PIDMAP=%s", pidmap);
|
||||
putenv(tmp);
|
||||
asprintf(&tmp, "PTL_IFACE=%s", mca_ptl_portals_component.portals_ifname);
|
||||
putenv(tmp);
|
||||
|
||||
/*
|
||||
* Initialize Portals
|
||||
*/
|
||||
ret = PtlInit(&max_interfaces);
|
||||
if (PTL_OK != ret) {
|
||||
ompi_output_verbose(10, mca_ptl_portals_component.portals_output,
|
||||
"PtlInit failed, returning %d\n", ret);
|
||||
return OMPI_ERR_FATAL;
|
||||
}
|
||||
|
||||
ret = PtlNIInit(PTL_IFACE_DEFAULT, /* interface to initialize */
|
||||
PTL_PID_ANY, /* let library assign our pid */
|
||||
NULL, /* no desired limits */
|
||||
&(ptl->limits), /* save our limits somewhere */
|
||||
&(ptl->ni_handle) /* our interface handle */
|
||||
);
|
||||
if (PTL_OK != ret) {
|
||||
ompi_output_verbose(10, mca_ptl_portals_component.portals_output,
|
||||
"PtlNIInit failed, returning %d\n", ret);
|
||||
return OMPI_ERR_FATAL;
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "portals_config.h"
|
||||
|
||||
#include "include/constants.h"
|
||||
|
||||
@ -22,7 +23,7 @@
|
||||
#include "threads/thread.h"
|
||||
|
||||
#include "ptl_portals.h"
|
||||
#include "ptl_portals_nal.h"
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -116,18 +117,18 @@ mca_ptl_portals_component_open(void)
|
||||
mca_ptl_portals_component.portals_modules = NULL;
|
||||
|
||||
/* initialize objects */
|
||||
printf("here\n");
|
||||
|
||||
/* register portals module parameters */
|
||||
mca_ptl_portals_component.portals_free_list_num =
|
||||
mca_ptl_portals_param_register_int("free_list_num", 256);
|
||||
mca_ptl_portals_component.portals_free_list_max =
|
||||
mca_ptl_portals_param_register_int("free_list_max", -1);
|
||||
mca_ptl_portals_component.portals_free_list_inc =
|
||||
mca_ptl_portals_param_register_int("free_list_inc", 256);
|
||||
#if PTL_PORTALS_UTCP
|
||||
mca_ptl_portals_component.portals_ifname =
|
||||
mca_ptl_portals_param_register_string("ifname", "eth0");
|
||||
#endif
|
||||
portals_output_stream.lds_verbose_level =
|
||||
mca_ptl_portals_param_register_int("debug_level", 100);
|
||||
mca_ptl_portals_param_register_int("debug_level", 1000);
|
||||
|
||||
ompi_output_verbose(100, mca_ptl_portals_component.portals_output,
|
||||
"mca_ptl_portals_component_open()");
|
||||
|
||||
/* finish with objects */
|
||||
mca_ptl_portals_component.portals_output =
|
||||
@ -143,6 +144,9 @@ mca_ptl_portals_component_open(void)
|
||||
int
|
||||
mca_ptl_portals_component_close(void)
|
||||
{
|
||||
ompi_output_verbose(100, mca_ptl_portals_component.portals_output,
|
||||
"mca_ptl_portals_component_close()");
|
||||
|
||||
/* finalize interface? */
|
||||
|
||||
/* print out debugging if anything is pending */
|
||||
@ -167,23 +171,20 @@ mca_ptl_portals_component_init(int *num_ptls,
|
||||
mca_ptl_base_module_t** ptls;
|
||||
*num_ptls = 0;
|
||||
|
||||
/* do the non-portable global initialization stuff for a
|
||||
particular network link */
|
||||
if (OMPI_SUCCESS != mca_ptl_portals_nal_init()) {
|
||||
ompi_output_verbose(10, mca_ptl_portals_component.portals_output,
|
||||
"nal_init() failed - failing component_init()\n");
|
||||
/* BWB - no support for progress threads */
|
||||
if (enable_progress_threads) return NULL;
|
||||
|
||||
ompi_output_verbose(100, mca_ptl_portals_component.portals_output,
|
||||
"mca_ptl_portals_component_init()");
|
||||
|
||||
/* initialize portals ptl. note that this is in the compat code because
|
||||
it's fairly non-portable between implementations */
|
||||
if (OMPI_SUCCESS != mca_ptl_portals_init(&mca_ptl_portals_component)) {
|
||||
/* error message should already be displayed */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (OMPI_SUCCESS != mca_ptl_portals_module_init()) {
|
||||
ompi_output_verbose(10, mca_ptl_portals_component.portals_output,
|
||||
"module_init() failed - failing component_init()\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* BWB - why do we duplicate / copy here? do we need to free
|
||||
anything? */
|
||||
mca_ptl_portals_component.portals_num_modules = 1;
|
||||
/* return array of ptls */
|
||||
ptls = malloc(mca_ptl_portals_component.portals_num_modules *
|
||||
sizeof(mca_ptl_base_module_t*));
|
||||
if (NULL == ptls) return NULL;
|
||||
@ -191,7 +192,7 @@ mca_ptl_portals_component_init(int *num_ptls,
|
||||
memcpy(ptls,
|
||||
mca_ptl_portals_component.portals_modules,
|
||||
mca_ptl_portals_component.portals_num_modules *
|
||||
sizeof(mca_ptl_portals_module_t*));
|
||||
sizeof(mca_ptl_base_module_t*));
|
||||
*num_ptls = mca_ptl_portals_component.portals_num_modules;
|
||||
return ptls;
|
||||
}
|
||||
@ -203,6 +204,9 @@ mca_ptl_portals_component_init(int *num_ptls,
|
||||
int
|
||||
mca_ptl_portals_component_control(int param, void* value, size_t size)
|
||||
{
|
||||
ompi_output_verbose(100, mca_ptl_portals_component.portals_output,
|
||||
"mca_ptl_portals_component_control(%d)", param);
|
||||
|
||||
switch(param) {
|
||||
case MCA_PTL_ENABLE:
|
||||
if(*(int*)value) {
|
||||
@ -225,6 +229,9 @@ mca_ptl_portals_component_progress(mca_ptl_tstamp_t tstamp)
|
||||
{
|
||||
int num_progressed = 0;
|
||||
|
||||
ompi_output_verbose(110, mca_ptl_portals_component.portals_output,
|
||||
"mca_ptl_portals_component_progress(%ld)", tstamp);
|
||||
|
||||
/* BWB - write me */
|
||||
|
||||
return num_progressed;
|
||||
|
@ -1,140 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* 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 "ompi_config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "util/output.h"
|
||||
|
||||
#include "ptl_portals.h"
|
||||
#include "ptl_portals_nal.h"
|
||||
|
||||
|
||||
/******************* UTCP CONFIGURATION **********************/
|
||||
|
||||
/* how's this for source code diving? */
|
||||
extern unsigned int utcp_my_nid(const char *if_str);
|
||||
|
||||
/* these need to be defined, or things get "unhappy" */
|
||||
FILE* utcp_api_out;
|
||||
FILE* utcp_lib_out;
|
||||
|
||||
|
||||
int
|
||||
mca_ptl_portals_nal_init(void)
|
||||
{
|
||||
ptl_process_id_t info;
|
||||
int ret;
|
||||
|
||||
utcp_lib_out = stderr;
|
||||
utcp_api_out = stderr;
|
||||
|
||||
info.nid = utcp_my_nid(mca_ptl_portals_component.portals_ifname);
|
||||
info.pid = (ptl_pid_t) getpid();
|
||||
ompi_output_verbose(100, mca_ptl_portals_component.portals_output,
|
||||
"contact info: %u, %u", info.nid, info.pid);
|
||||
|
||||
ret = mca_base_modex_send(&mca_ptl_portals_component.super.ptlm_version,
|
||||
&info, sizeof(ptl_process_id_t));
|
||||
if (OMPI_SUCCESS != ret) {
|
||||
ompi_output_verbose(10, mca_ptl_portals_component.portals_output,
|
||||
"mca_base_modex_send failed: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mca_ptl_portals_nal_configure(size_t nprocs, struct ompi_proc_t **procs)
|
||||
{
|
||||
int ret, my_rid;
|
||||
char *env;
|
||||
ptl_process_id_t *info;
|
||||
char *nidmap = NULL;
|
||||
char *pidmap = NULL;
|
||||
const size_t map_size = nprocs * 12 + 1;
|
||||
size_t size, i;
|
||||
char *tmp;
|
||||
ompi_proc_t* proc_self = ompi_proc_local();
|
||||
|
||||
env = getenv("PTL_IFACE");
|
||||
if (NULL == env) {
|
||||
asprintf(&tmp, "PTL_IFACE=%s", mca_ptl_portals_component.portals_ifname);
|
||||
putenv(tmp);
|
||||
}
|
||||
|
||||
env = getenv("PTL_NIDMAP");
|
||||
if (NULL == env) {
|
||||
/* build up a list of all the nids/pids for the current world */
|
||||
|
||||
/* each nid is a int, so need 10 there, plus the : */
|
||||
nidmap = malloc(map_size);
|
||||
pidmap = malloc(map_size);
|
||||
if (NULL == nidmap || NULL == pidmap) return OMPI_ERROR;
|
||||
|
||||
for (i = 0 ; i < nprocs ; ++i) {
|
||||
if (proc_self == procs[i]) my_rid = i;
|
||||
|
||||
ret = mca_base_modex_recv(&mca_ptl_portals_component.super.ptlm_version,
|
||||
procs[i], (void**) &info, &size);
|
||||
if (OMPI_SUCCESS != ret) {
|
||||
ompi_output_verbose(10, mca_ptl_portals_component.portals_output,
|
||||
"mca_base_modex_recv failed: %d", ret);
|
||||
return ret;
|
||||
} else if (sizeof(ptl_process_id_t) != size) {
|
||||
ompi_output_verbose(10, mca_ptl_portals_component.portals_output,
|
||||
"mca_base_modex_recv returned size%d",
|
||||
size);
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
snprintf(nidmap, map_size, "%u", info->nid);
|
||||
snprintf(pidmap, map_size, "%u", info->pid);
|
||||
} else {
|
||||
snprintf(nidmap, map_size, "%s:%u", nidmap, info->nid);
|
||||
snprintf(pidmap, map_size, "%s:%u", nidmap, info->pid);
|
||||
}
|
||||
}
|
||||
|
||||
ompi_output_verbose(100, mca_ptl_portals_component.portals_output,
|
||||
"my rid: %u", my_rid);
|
||||
ompi_output_verbose(100, mca_ptl_portals_component.portals_output,
|
||||
"nid map: %s", nidmap);
|
||||
ompi_output_verbose(100, mca_ptl_portals_component.portals_output,
|
||||
"pid map: %s", pidmap);
|
||||
|
||||
asprintf(&tmp, "PTL_MY_RID=%u", my_rid);
|
||||
putenv(tmp);
|
||||
asprintf(&tmp, "PTL_NIDMAP=%s", nidmap);
|
||||
putenv(tmp);
|
||||
asprintf(&tmp, "PTL_PIDMAP=%s", pidmap);
|
||||
putenv(tmp);
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/******************* CRAY CONFIGURATION **********************/
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "portals_config.h"
|
||||
|
||||
#include "ptl_portals.h"
|
||||
|
||||
@ -29,28 +30,12 @@
|
||||
* BWB - README - BWB - README - BWB - README - BWB - README - BWB */
|
||||
|
||||
|
||||
int
|
||||
mca_ptl_portals_module_init()
|
||||
{
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
int
|
||||
mca_ptl_portals_finalize(struct mca_ptl_base_module_t *ptl)
|
||||
{
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
int
|
||||
mca_ptl_portals_add_procs(struct mca_ptl_base_module_t *ptl,
|
||||
size_t nprocs,
|
||||
struct ompi_proc_t **procs,
|
||||
struct mca_ptl_base_peer_t **peers,
|
||||
ompi_bitmap_t * reachable)
|
||||
{
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mca_ptl_portals_del_procs(struct mca_ptl_base_module_t *ptl,
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user