1
1

adapting comm_set/get_name to the new internal function and the mutex

open_port and close_port should now be implemented correctly.
updating intercomm_merge

This commit was SVN r1876.
Этот коммит содержится в:
Edgar Gabriel 2004-08-04 19:48:03 +00:00
родитель 177d6ddae2
Коммит ec0f556680
5 изменённых файлов: 52 добавлений и 46 удалений

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

@ -30,12 +30,13 @@ int MPI_Close_port(char *port_name)
FUNC_NAME);
}
/* As far as I can see at the moment, this is an empty function.
Since we are relying on OOB, we did not allocate any 'address',
therefore we don't have to free an 'address'.
*/
/*
* since the port_name is our own process_name_t structure,
* we do not have to close anything or free a pointer.
* This function is therefore just a dummy function
* and fully implemented. I love these type functions,
* we should have more of them :-).
*/
/* This function is not yet implemented */
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN, FUNC_NAME);
return MPI_SUCCESS;
}

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

@ -12,6 +12,7 @@
#include "mpi/c/bindings.h"
#include "runtime/runtime.h"
#include "communicator/communicator.h"
#include "threads/mutex.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Comm_get_name = PMPI_Comm_get_name
@ -24,9 +25,8 @@
static const char FUNC_NAME[] = "MPI_Comm_get_name";
int MPI_Comm_get_name(MPI_Comm comm, char *name, int *length) {
ompi_communicator_t* comp;
int MPI_Comm_get_name(MPI_Comm comm, char *name, int *length)
{
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
@ -40,16 +40,16 @@ int MPI_Comm_get_name(MPI_Comm comm, char *name, int *length) {
FUNC_NAME);
}
comp = (ompi_communicator_t*) comm;
if ( comp->c_flags & OMPI_COMM_NAMEISSET ) {
strncpy ( name, comp->c_name, MPI_MAX_OBJECT_NAME );
*length = strlen ( comp->c_name );
OMPI_THREAD_LOCK(&(comm->c_lock));
if ( comm->c_flags & OMPI_COMM_NAMEISSET ) {
strncpy ( name, comm->c_name, MPI_MAX_OBJECT_NAME );
*length = strlen ( comm->c_name );
}
else {
memset ( name, 0, MPI_MAX_OBJECT_NAME );
*length = 0;
}
OMPI_THREAD_UNLOCK(&(comm->c_lock));
return MPI_SUCCESS;
}

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

@ -24,9 +24,9 @@
static const char FUNC_NAME[] = "MPI_Comm_set_name";
int MPI_Comm_set_name(MPI_Comm comm, char *name) {
ompi_communicator_t* comp;
int MPI_Comm_set_name(MPI_Comm comm, char *name)
{
int rc;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
@ -42,15 +42,7 @@ int MPI_Comm_set_name(MPI_Comm comm, char *name) {
}
}
/* -- Thread safety entrance -- */
/* Copy in the name */
comp = (ompi_communicator_t*) comm;
strncpy(comp->c_name, name, MPI_MAX_OBJECT_NAME);
comp->c_name[MPI_MAX_OBJECT_NAME - 1] = 0;
comp->c_flags |= OMPI_COMM_NAMEISSET;
rc = ompi_comm_set_name (comm, name );
/* -- Tracing information for new communicator name -- */
#if 0
/* Force TotalView DLL to take note of this name setting */
@ -61,8 +53,5 @@ int MPI_Comm_set_name(MPI_Comm comm, char *name) {
#if OMPI_PROFILING_DEFINES
#include "mpi/c/profile/defines.h"
#endif
/* -- Thread safety exit -- */
return MPI_SUCCESS;
OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);
}

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

@ -25,7 +25,7 @@ static const char FUNC_NAME[] = "MPI_Intercomm_merge";
int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
MPI_Comm *newcomm)
{
ompi_communicator_t *newcomp;
ompi_communicator_t *newcomp=MPI_COMM_NULL;
ompi_proc_t **procs=NULL;
int local_size, remote_size;
int local_rank;
@ -53,11 +53,16 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
total_size = local_size + remote_size;
procs = (ompi_proc_t **) malloc ( total_size * sizeof(ompi_proc_t *));
if ( NULL == procs ) {
return OMPI_ERRHANDLER_INVOKE(intercomm,MPI_ERR_INTERN,
FUNC_NAME);
rc = MPI_ERR_INTERN;
goto exit;
}
first = ompi_comm_determine_first ( intercomm, thigh );
if ( MPI_UNDEFINED == first ) {
rc = MPI_ERR_INTERN;
goto exit;
}
if ( first ) {
memcpy ( procs, intercomm->c_local_group->grp_proc_pointers,
local_size * sizeof(ompi_proc_t *));
@ -109,6 +114,9 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
free ( procs );
}
if ( MPI_SUCCESS != rc ) {
if ( MPI_COMM_NULL != newcomp ) {
OBJ_RELEASE(newcomp);
}
*newcomm = MPI_COMM_NULL;
return OMPI_ERRHANDLER_INVOKE(intercomm, rc, FUNC_NAME);
}

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

@ -9,6 +9,8 @@
#include "info/info.h"
#include "runtime/runtime.h"
#include "communicator/communicator.h"
#include "proc/proc.h"
#include "mca/ns/base/base.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Open_port = PMPI_Open_port
@ -23,6 +25,10 @@ static const char FUNC_NAME[] = "MPI_Open_port";
int MPI_Open_port(MPI_Info info, char *port_name)
{
ompi_proc_t **myproc=NULL;
char *name=NULL;
size_t size;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
@ -35,23 +41,25 @@ int MPI_Open_port(MPI_Info info, char *port_name)
if ( MPI_INFO_NULL != info ) {
/* in theory, they user might tell us here
how to establish the address. Since our communication
is relying on OOB, we probably
won't use the info-object.
is relying on OOB, we probably won't use the info-object.
potential values defined in MPI-2:
- "ip_port" : value contains IP port number
Potential values defined in MPI-2:
- "ip_port" : value contains IP port number
- "ip_address" : value contains IP address
*/
}
/* According to our current understanding, the port_name will
be the OOB-name. No real port has to be opne, since
OOB always accepts new connections (e.g. has a pending accept).
memcpy ( port_name, oob-whatever-fcnt, strlen(oob-whatever-fctn));
/* The port_name is equal to the OOB-contact information.
No real port has to be open, since OOB always accepts new
connections (e.g. has a pending accept).
*/
myproc = ompi_proc_self (&size);
name = ompi_name_server.get_proc_name_string (&(myproc[0]->proc_name));
strncpy (port_name, name, MPI_MAX_PORT_NAME);
/* This function is not yet implemented */
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, FUNC_NAME);
free ( myproc );
free ( name );
return MPI_SUCCESS;
}