removing two unused functions. Furthermore, modifying the get_namebuf functions to use ompi_pack/unpack and thus work in heterogeneous environments.
This commit was SVN r2707.
Этот коммит содержится в:
родитель
3b3855fc23
Коммит
3617f6d16e
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
static ompi_list_t ompi_proc_list;
|
static ompi_list_t ompi_proc_list;
|
||||||
static ompi_mutex_t ompi_proc_lock;
|
static ompi_mutex_t ompi_proc_lock;
|
||||||
|
static ompi_mutex_t ompi_proc_lock2;
|
||||||
ompi_proc_t* ompi_proc_local_proc = NULL;
|
ompi_proc_t* ompi_proc_local_proc = NULL;
|
||||||
|
|
||||||
static void ompi_proc_construct(ompi_proc_t* proc);
|
static void ompi_proc_construct(ompi_proc_t* proc);
|
||||||
@ -169,110 +170,51 @@ ompi_proc_t * ompi_proc_find ( const ompi_process_name_t * name )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
int ompi_proc_get_namebuf ( ompi_proc_t **proclist, int proclistsize,
|
||||||
** The functions in this chapter are at the moment purely for
|
ompi_buffer_t buf)
|
||||||
** homogeneous environments. Support for heterogeneous environments
|
|
||||||
** to follow as soon as the datatype engine supports heterogeneous envs.
|
|
||||||
** I just wanted to avoid duplicating data conversion code here...
|
|
||||||
*/
|
|
||||||
int ompi_proc_get_namebuf_by_proc ( ompi_proc_t **proclist, int proclistsize,
|
|
||||||
char **namebuf, int *namebuflen )
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
ompi_process_name_t *nbuf=NULL;
|
|
||||||
|
|
||||||
nbuf = (ompi_process_name_t *) calloc (proclistsize, sizeof(ompi_process_name_t));
|
/* buf has to be initiated in the calling function */
|
||||||
if ( NULL == nbuf ) {
|
|
||||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
OMPI_THREAD_LOCK(&ompi_proc_lock);
|
OMPI_THREAD_LOCK(&ompi_proc_lock);
|
||||||
for (i=0; i<proclistsize; i++) {
|
for (i=0; i<proclistsize; i++) {
|
||||||
nbuf[i] = proclist[i]->proc_name;
|
ompi_pack(buf, &(proclist[i]->proc_name), 1, OMPI_NAME);
|
||||||
}
|
}
|
||||||
OMPI_THREAD_UNLOCK(&ompi_proc_lock);
|
OMPI_THREAD_UNLOCK(&ompi_proc_lock);
|
||||||
|
|
||||||
*namebuf = (char *)nbuf;
|
|
||||||
*namebuflen = (proclistsize * sizeof(ompi_process_name_t));
|
|
||||||
|
|
||||||
return OMPI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ompi_proc_namebuf_returnbuf ( char *namebuf )
|
|
||||||
{
|
|
||||||
if ( NULL != namebuf ) {
|
|
||||||
free (namebuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ompi_proc_get_proclist (char *namebuf, int namebuflen,
|
int ompi_proc_get_proclist (ompi_buffer_t buf, int proclistsize, ompi_proc_t ***proclist)
|
||||||
int proclistsize, ompi_proc_t ***proclist)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
ompi_proc_t **plist=NULL;
|
ompi_proc_t **plist=NULL;
|
||||||
ompi_process_name_t *nlist= (ompi_process_name_t *) namebuf;
|
ompi_process_name_t name;
|
||||||
|
|
||||||
plist = (ompi_proc_t **) calloc ( proclistsize, sizeof (ompi_proc_t *));
|
OMPI_THREAD_LOCK(&ompi_proc_lock2);
|
||||||
|
|
||||||
|
/* do not free plist *ever*, since it is used in the remote group structure
|
||||||
|
of a communicator */
|
||||||
|
plist = (ompi_proc_t **) calloc (proclistsize, sizeof (ompi_proc_t *));
|
||||||
if ( NULL == plist ) {
|
if ( NULL == plist ) {
|
||||||
|
OMPI_THREAD_UNLOCK(&ompi_proc_lock2);
|
||||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i=0; i<proclistsize; i++ ){
|
for ( i=0; i<proclistsize; i++ ){
|
||||||
plist[i] = ompi_proc_find ( &(nlist[i]));
|
ompi_unpack(buf, &name, 1, OMPI_NAME);
|
||||||
|
plist[i] = ompi_proc_find ( &name);
|
||||||
if ( NULL == plist[i] ) {
|
if ( NULL == plist[i] ) {
|
||||||
/* to do: look the process information for this name up */
|
ompi_proc_t *proc = OBJ_NEW(ompi_proc_t);
|
||||||
}
|
proc->proc_name = name;
|
||||||
|
plist[i] = proc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*proclist = plist;
|
*proclist = plist;
|
||||||
return OMPI_SUCCESS;
|
OMPI_THREAD_UNLOCK(&ompi_proc_lock2);
|
||||||
}
|
|
||||||
|
|
||||||
/* These two functions are at the moment trivial */
|
|
||||||
int ompi_proc_get_namebuf_by_name ( ompi_process_name_t **namelist, int namelistsize,
|
|
||||||
char **namebuf, int *namebuflen )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
ompi_process_name_t *nbuf=NULL;
|
|
||||||
|
|
||||||
nbuf = ( ompi_process_name_t *) calloc (namelistsize, sizeof(ompi_process_name_t));
|
|
||||||
if ( NULL == nbuf ) {
|
|
||||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0; i<namelistsize; i++) {
|
|
||||||
nbuf[i] = *(namelist[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
*namebuf = (char *)nbuf;
|
|
||||||
*namebuflen = (namelistsize * sizeof(ompi_process_name_t));
|
|
||||||
|
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ompi_proc_get_namelist ( char *namebuf, int namebuflen,
|
|
||||||
int namelistsize, ompi_process_name_t ***namelist )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
ompi_proc_t *proc;
|
|
||||||
ompi_process_name_t **plist=NULL;
|
|
||||||
ompi_process_name_t *nlist= (ompi_process_name_t *) namebuf;
|
|
||||||
|
|
||||||
plist = (ompi_process_name_t**)calloc(namelistsize,sizeof(ompi_process_name_t *));
|
|
||||||
if ( NULL == plist ) {
|
|
||||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( i=0; i<namelistsize; i++ ){
|
|
||||||
proc = ompi_proc_find ( &(nlist[i]));
|
|
||||||
if ( NULL == plist[i] ) {
|
|
||||||
/* to do: look the process information for this name up */
|
|
||||||
}
|
|
||||||
plist[i] = &(proc->proc_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return OMPI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "datatype/datatype.h"
|
#include "datatype/datatype.h"
|
||||||
#include "threads/mutex.h"
|
#include "threads/mutex.h"
|
||||||
#include "mca/ns/ns.h"
|
#include "mca/ns/ns.h"
|
||||||
|
#include "util/pack.h"
|
||||||
|
|
||||||
extern ompi_class_t ompi_proc_t_class;
|
extern ompi_class_t ompi_proc_t_class;
|
||||||
|
|
||||||
@ -70,42 +70,26 @@ ompi_proc_t * ompi_proc_find ( const ompi_process_name_t* name );
|
|||||||
/**
|
/**
|
||||||
* INPUT: ompi_proc_t **proclist : list of process pointers
|
* INPUT: ompi_proc_t **proclist : list of process pointers
|
||||||
* INPUT: int proclistsize : lenght of the proclist array
|
* INPUT: int proclistsize : lenght of the proclist array
|
||||||
* OUTPUT: char **namebuf : a buffer pointer to an array
|
* IN/OUT: ompi_buffer_t *buf : an ompi_buffer containing the packed names
|
||||||
* of packed ompi_process_name_t objects
|
*
|
||||||
* OUTPUT: size_t *namebuflen : length of namebuf
|
|
||||||
|
|
||||||
* The function takes a list of ompi_proc_t pointers (e.g. as given in groups)
|
* The function takes a list of ompi_proc_t pointers (e.g. as given in groups)
|
||||||
* and returns a buffer, which contains a list of 'packed' ompi_process_name_t
|
* and returns a buffer, which contains a list of 'packed' ompi_process_name_t
|
||||||
* objects, in the same order as provided in proclist.
|
* objects, in the same order as provided in proclist.
|
||||||
* By 'packed' we mean, that the buffer should be able to be sent across
|
* By 'packed' we mean, that the buffer should be able to be sent across
|
||||||
* heterogeneous environments (e.g. it has to be big endian, ilp32 ).
|
* heterogeneous environments (e.g. it has to be big endian, ilp32 ).
|
||||||
* This buffer could be sent using MPI_Send using MPI_BYTE or OOB_Send.
|
* This buffer could be sent using MPI_Send using MPI_BYTE or OOB_send_packed.
|
||||||
*
|
*
|
||||||
* Return values:
|
* Return values:
|
||||||
* OMPI_SUCCESS on success
|
* OMPI_SUCCESS on success
|
||||||
* OMPI_ERR_OUT_OF_RESOURCE buffer could not be allocated
|
|
||||||
* OMPI_ERROR: other errors
|
* OMPI_ERROR: other errors
|
||||||
*/
|
*/
|
||||||
int ompi_proc_get_namebuf_by_proc ( ompi_proc_t **proclist, int proclistsize,
|
int ompi_proc_get_namebuf ( ompi_proc_t **proclist, int proclistsize,
|
||||||
char **namebuf, int *namebuflen );
|
ompi_buffer_t buf);
|
||||||
|
|
||||||
/**
|
|
||||||
* Since ompi_proc_get_namebuf_by_proc allocates the namebuf, we decided to
|
|
||||||
* define a second function to return this buffer. It is up to the implementation,
|
|
||||||
* whether it frees the buffer or reuses it.
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
* OMPI_SUCCESS on success
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
int ompi_proc_namebuf_returnbuf ( char *namebuf );
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INPUT: char *namebuf : buffer containing the opaque, portable
|
* INPUT: ompi_buffer_t buf : ompi_buffer containing the packed names
|
||||||
* form of the process_names
|
|
||||||
* INPUT: size_t namebuflen : length of namebuf
|
|
||||||
* INPUT: int proclistsize : number of expected proc-pointres
|
* INPUT: int proclistsize : number of expected proc-pointres
|
||||||
* OUTPUT: ompi_proc_t ***proclist : list of process pointers
|
* OUTPUT: ompi_proc_t ***proclist : list of process pointers
|
||||||
*
|
*
|
||||||
@ -121,24 +105,7 @@ int ompi_proc_namebuf_returnbuf ( char *namebuf );
|
|||||||
* OMPI_ERROR else
|
* OMPI_ERROR else
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int ompi_proc_get_proclist (char *namebuf, int namebuflen,
|
int ompi_proc_get_proclist (ompi_buffer_t buf, int proclistsize, ompi_proc_t ***proclist);
|
||||||
int proclistsize, ompi_proc_t ***proclist);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* identical to ompi_proc_get_namebuf_by_proc, the input is however a list
|
|
||||||
* of process_name_t structures instead of ompi_proc_t structures. This is
|
|
||||||
* required for some OOB routines.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int ompi_proc_get_namebuf_by_name ( ompi_process_name_t **namelist, int namelistsize,
|
|
||||||
char **namebuf, int *namebuflen );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* similar to ompi_proc_get_proclist, returns however a list of
|
|
||||||
* ompi_process_name_t pointers.
|
|
||||||
*/
|
|
||||||
int ompi_proc_get_namelist ( char *namebuf, int namebuflen,
|
|
||||||
int namelistlen, ompi_process_name_t ***namelist );
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* OMPI_PROC */
|
#endif /* OMPI_PROC */
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user