1
1

Remove temporary use of global convertor; MPI_PACK and MPI_UNPACK are

now thread-safe.

This commit was SVN r2386.
Этот коммит содержится в:
Jeff Squyres 2004-08-29 22:45:06 +00:00
родитель 6db1034a60
Коммит a2996b2d01
4 изменённых файлов: 10 добавлений и 22 удалений

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

@ -219,7 +219,6 @@ int ompi_ddt_set_args( dt_desc_t* pData,
int ci, int ** i,
int ca, MPI_Aint* a,
int cd, MPI_Datatype* d,int type);
/* VPS: Added */
int ompi_ddt_sndrcv(void *sbuf, int scount, MPI_Datatype sdtype, void *rbuf,
int rcount, MPI_Datatype rdtype, int tag, MPI_Comm comm);

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

@ -131,9 +131,6 @@ ompi_pointer_array_t *ompi_datatype_f_to_c_table = NULL;
int local_sizes[DT_MAX_PREDEFINED];
/* VPS: fake convertor for time being / to provide pack/unpack functions */
ompi_convertor_t* ompi_convertor;
static ompi_convertor_t* pDumpConv = NULL;
#define COPY_DATA_DESC( PDST, PSRC ) \
@ -249,10 +246,6 @@ int ompi_ddt_init( void )
for( i = 0; i < DT_MAX_PREDEFINED; i++ )
local_sizes[i] = basicDatatypes[i].size;
/* VPS: Create a fake convertor. No error checking here now, since
this will be removed sometime */
ompi_convertor = ompi_convertor_create(0,0);
/* Start to populate the f2c index translation table */
ompi_pointer_array_add( ompi_datatype_f_to_c_table, NULL ); /* why not ? */
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_byte );

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

@ -19,9 +19,6 @@
#include "mpi/c/profile/defines.h"
#endif
/* VPS: Just for now, to be removed later */
extern ompi_convertor_t *ompi_convertor;
static const char FUNC_NAME[] = "MPI_Pack";
@ -47,14 +44,15 @@ int MPI_Pack(void *inbuf, int incount, MPI_Datatype datatype,
}
}
local_convertor = ompi_convertor_get_copy(ompi_convertor);
local_convertor = OBJ_NEW(ompi_convertor_t);
ompi_convertor_init_for_send(local_convertor, 0, datatype, incount,
inbuf, 0);
/* how long is the data ? Can we put it in the user buffer */
ompi_convertor_get_packed_size(local_convertor, &size);
if( (outsize - (*position)) < size) {
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
OBJ_RELEASE(local_convertor);
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
}
/* Prepare the iovec withh all informations */
@ -68,10 +66,9 @@ int MPI_Pack(void *inbuf, int incount, MPI_Datatype datatype,
/* Do the actual packing */
rc = ompi_convertor_pack(local_convertor, &invec, 1);
*position += local_convertor->bConverted;
/* All done */
/* Release the convertor. For Open MPI you should simply use
* OBJ_RELEASE.
*/
OBJ_RELEASE(local_convertor);
OMPI_ERRHANDLER_RETURN(rc, comm, MPI_ERR_UNKNOWN, FUNC_NAME);
}

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

@ -50,14 +50,15 @@ int MPI_Unpack(void *inbuf, int insize, int *position,
}
}
local_convertor = ompi_convertor_get_copy(local_convertor);
local_convertor = OBJ_NEW(ompi_convertor_t);
ompi_convertor_init_for_recv(local_convertor, 0, datatype, outcount,
inbuf, 0);
/* how long is the data ? Can we put it in the user buffer */
ompi_convertor_get_packed_size(local_convertor, &size);
if ((outcount - (*position)) < size) {
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
OBJ_RELEASE(local_convertor);
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
}
/* Prepare the iovec withh all informations */
@ -72,10 +73,8 @@ int MPI_Unpack(void *inbuf, int insize, int *position,
rc = ompi_convertor_unpack(local_convertor, &outvec, 1);
*position += local_convertor->bConverted;
/* Release the convertor. For Open MPI you should simply use
* OBJ_RELEASE.
*/
OBJ_RELEASE(local_convertor);
/* All done */
OBJ_RELEASE(local_convertor);
OMPI_ERRHANDLER_RETURN(rc, comm, MPI_ERR_UNKNOWN, FUNC_NAME);
}