1
1

Add a bunch of unimplemented functions. We have now the external functions.

This commit was SVN r4477.
Этот коммит содержится в:
George Bosilca 2005-02-22 00:17:31 +00:00
родитель bf44a03b69
Коммит 6640e334dc
5 изменённых файлов: 151 добавлений и 67 удалений

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

@ -62,7 +62,6 @@ int MPI_Pack(void *inbuf, int incount, MPI_Datatype datatype,
inbuf, 0, NULL /*never allocate memory*/);
/* Check for truncation */
ompi_convertor_get_packed_size(local_convertor, &size);
if( (*position + size) > (unsigned int)outsize ) { /* we can cast as we already checked for < 0 */
OBJ_RELEASE(local_convertor);
@ -70,12 +69,10 @@ int MPI_Pack(void *inbuf, int incount, MPI_Datatype datatype,
}
/* Prepare the iovec with all informations */
invec.iov_base = (char*) outbuf + (*position);
invec.iov_len = outsize - (*position);
/* Do the actual packing */
iov_count = 1;
rc = ompi_convertor_pack( local_convertor, &invec, &iov_count,
&size, &freeAfter );
@ -84,7 +81,6 @@ int MPI_Pack(void *inbuf, int incount, MPI_Datatype datatype,
/* All done. Note that the convertor returns 1 upon success, not
OMPI_SUCCESS. */
OMPI_ERRHANDLER_RETURN((rc == 1) ? OMPI_SUCCESS : OMPI_ERROR,
comm, MPI_ERR_UNKNOWN, FUNC_NAME);
}

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

@ -16,8 +16,10 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "communicator/communicator.h"
#include "datatype/datatype.h"
#include "errhandler/errhandler.h"
#include "communicator/communicator.h"
#include "class/ompi_object.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Pack_external = PMPI_Pack_external
@ -34,11 +36,47 @@ int MPI_Pack_external(char *datarep, void *inbuf, int incount,
MPI_Datatype datatype, void *outbuf,
MPI_Aint outsize, MPI_Aint *position)
{
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
}
int rc, freeAfter;
ompi_convertor_t *local_convertor;
struct iovec invec;
unsigned int size, iov_count;
/* This function is not yet implemented */
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ((NULL == inbuf) || (NULL == outbuf) || (NULL == position)) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
} else if (incount < 0) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COUNT, FUNC_NAME);
} else if (outsize < 0) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
} else if (MPI_DATATYPE_NULL == datatype) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME);
}
}
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, FUNC_NAME);
local_convertor = ompi_convertor_get_copy( ompi_mpi_external32_convertor );
ompi_convertor_init_for_send(local_convertor, 0, datatype, incount,
inbuf, 0, NULL /*never allocate memory*/);
/* Check for truncation */
ompi_convertor_get_packed_size( local_convertor, &size );
if( (*position + size) > (unsigned int)outsize ) { /* we can cast as we already checked for < 0 */
OBJ_RELEASE( local_convertor );
return OMPI_ERRHANDLER_INVOKE( MPI_COMM_WORLD, MPI_ERR_TRUNCATE, FUNC_NAME );
}
/* Prepare the iovec with all informations */
invec.iov_base = (char*) outbuf + (*position);
invec.iov_len = outsize - (*position);
/* Do the actual packing */
iov_count = 1;
rc = ompi_convertor_pack( local_convertor, &invec, &iov_count, &size, &freeAfter );
*position += local_convertor->bConverted;
OBJ_RELEASE( local_convertor );
/* All done. Note that the convertor returns 1 upon success, not
OMPI_SUCCESS. */
OMPI_ERRHANDLER_RETURN((rc == 1) ? OMPI_SUCCESS : OMPI_ERROR,
MPI_COMM_WORLD, MPI_ERR_UNKNOWN, FUNC_NAME);
}

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

@ -16,8 +16,10 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "communicator/communicator.h"
#include "class/ompi_object.h"
#include "errhandler/errhandler.h"
#include "communicator/communicator.h"
#include "datatype/datatype.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Pack_external_size = PMPI_Pack_external_size
@ -33,11 +35,25 @@ static const char FUNC_NAME[] = "MPI_Pack_external_size";
int MPI_Pack_external_size(char *datarep, int incount,
MPI_Datatype datatype, MPI_Aint *size)
{
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
}
int ret;
ompi_convertor_t *local_convertor;
unsigned int length;
/* This function is not yet implemented */
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (NULL == size) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
} else if (MPI_DATATYPE_NULL == datatype) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME);
}
}
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, FUNC_NAME);
local_convertor = ompi_convertor_get_copy( ompi_mpi_external32_convertor );
ompi_convertor_init_for_send( local_convertor, 0, datatype, incount,
NULL, 0, NULL /* never allocate memory */ );
ret = ompi_convertor_get_packed_size( local_convertor, &length );
*size = (int)length;
OBJ_RELEASE( local_convertor );
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, FUNC_NAME);
}

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

@ -36,58 +36,55 @@ int MPI_Unpack(void *inbuf, int insize, int *position,
void *outbuf, int outcount, MPI_Datatype datatype,
MPI_Comm comm)
{
int rc, freeAfter;
ompi_convertor_t *local_convertor;
struct iovec outvec;
unsigned int size, iov_count;
int rc, freeAfter;
ompi_convertor_t *local_convertor;
struct iovec outvec;
unsigned int size, iov_count;
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (ompi_comm_invalid(comm)) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
FUNC_NAME);
}
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (ompi_comm_invalid(comm)) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
FUNC_NAME);
}
if ((NULL == inbuf) || (NULL == outbuf) || (NULL == position)) {
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
}
if ((NULL == inbuf) || (NULL == outbuf) || (NULL == position)) {
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
}
if (outcount < 0) {
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COUNT, FUNC_NAME);
if (outcount < 0) {
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COUNT, FUNC_NAME);
}
if (MPI_DATATYPE_NULL == datatype) {
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME);
}
}
if (MPI_DATATYPE_NULL == datatype) {
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME);
}
}
local_convertor = OBJ_NEW(ompi_convertor_t);
ompi_convertor_init_for_recv(local_convertor, 0, datatype, outcount,
outbuf, 0, NULL /* never allocate memory */);
local_convertor = OBJ_NEW(ompi_convertor_t);
ompi_convertor_init_for_recv(local_convertor, 0, datatype, outcount,
outbuf, 0, NULL /* never allocate memory */);
/* Check for truncation */
/* Check for truncation */
ompi_convertor_get_packed_size(local_convertor, &size);
if( (*position + size) > (unsigned int)insize ) {
OBJ_RELEASE(local_convertor);
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TRUNCATE, FUNC_NAME);
}
ompi_convertor_get_packed_size(local_convertor, &size);
if( (*position + size) > (unsigned int)insize ) {
/* Prepare the iovec with all informations */
outvec.iov_base = (char*) inbuf + (*position);
outvec.iov_len = insize - (*position);
/* Do the actual unpacking */
iov_count = 1;
rc = ompi_convertor_unpack( local_convertor, &outvec, &iov_count,
&size, &freeAfter );
*position += local_convertor->bConverted;
OBJ_RELEASE(local_convertor);
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TRUNCATE, FUNC_NAME);
}
/* Prepare the iovec with all informations */
outvec.iov_base = (char*) inbuf + (*position);
outvec.iov_len = insize - (*position);
/* Do the actual unpacking */
iov_count = 1;
rc = ompi_convertor_unpack( local_convertor, &outvec, &iov_count,
&size, &freeAfter );
*position += local_convertor->bConverted;
OBJ_RELEASE(local_convertor);
/* All done. Note that the convertor returns 1 upon success, not
OMPI_SUCCESS. */
OMPI_ERRHANDLER_RETURN((rc == 1) ? OMPI_SUCCESS : OMPI_ERROR,
comm, MPI_ERR_UNKNOWN, FUNC_NAME);
/* All done. Note that the convertor returns 1 upon success, not
OMPI_SUCCESS. */
OMPI_ERRHANDLER_RETURN((rc == 1) ? OMPI_SUCCESS : OMPI_ERROR,
comm, MPI_ERR_UNKNOWN, FUNC_NAME);
}

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

@ -16,8 +16,10 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "communicator/communicator.h"
#include "datatype/datatype.h"
#include "errhandler/errhandler.h"
#include "communicator/communicator.h"
#include "class/ompi_object.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Unpack_external = PMPI_Unpack_external
@ -34,11 +36,46 @@ int MPI_Unpack_external (char *datarep, void *inbuf, MPI_Aint insize,
MPI_Aint *position, void *outbuf, int outcount,
MPI_Datatype datatype)
{
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
}
int rc, freeAfter;
ompi_convertor_t *local_convertor;
struct iovec outvec;
unsigned int size, iov_count;
/* This function is not yet implemented */
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ((NULL == inbuf) || (NULL == outbuf) || (NULL == position)) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
} else if (outcount < 0) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COUNT, FUNC_NAME);
} else if (MPI_DATATYPE_NULL == datatype) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME);
}
}
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, FUNC_NAME);
local_convertor = ompi_convertor_get_copy( ompi_mpi_external32_convertor );
ompi_convertor_init_for_recv( local_convertor, 0, datatype, outcount,
outbuf, 0, NULL /* never allocate memory */ );
/* Check for truncation */
ompi_convertor_get_packed_size(local_convertor, &size);
if( (*position + size) > (unsigned int)insize ) {
OBJ_RELEASE(local_convertor);
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TRUNCATE, FUNC_NAME);
}
/* Prepare the iovec with all informations */
outvec.iov_base = (char*) inbuf + (*position);
outvec.iov_len = insize - (*position);
/* Do the actual unpacking */
iov_count = 1;
rc = ompi_convertor_unpack( local_convertor, &outvec, &iov_count,
&size, &freeAfter );
*position += local_convertor->bConverted;
OBJ_RELEASE(local_convertor);
/* All done. Note that the convertor returns 1 upon success, not
OMPI_SUCCESS. */
OMPI_ERRHANDLER_RETURN((rc == 1) ? OMPI_SUCCESS : OMPI_ERROR,
MPI_COMM_WORLD, MPI_ERR_UNKNOWN, FUNC_NAME);
}