1
1
openmpi/src/mpi/c/pack_size.c
George Bosilca 0b2b7cd2c7 Make the compiler happy by comparing similar types.
This commit was SVN r3219.
2004-10-19 23:30:19 +00:00

52 строки
1.5 KiB
C

/*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "mpi.h"
#include "mpi/c/bindings.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_size = PMPI_Pack_size
#endif
#if OMPI_PROFILING_DEFINES
#include "mpi/c/profile/defines.h"
#endif
static const char FUNC_NAME[] = "MPI_Pack_size";
int MPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm,
int *size)
{
int ret;
ompi_convertor_t *local_convertor;
unsigned int length;
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (MPI_COMM_NULL == comm) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
FUNC_NAME);
} else if (NULL == size) {
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
} else 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_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);
OMPI_ERRHANDLER_RETURN(ret, comm, MPI_ERR_UNKNOWN, FUNC_NAME);
}