static void MPIPackFun(c4snet_data_t *data, mpi_buf_t *buf) { int vtype = data->vtype, type = data->type; MPIPack(buf, &vtype, MPI_INT, 1); MPIPack(buf, &data->size, MPI_INT, 1); MPIPack(buf, &type, MPI_INT, 1); if (data->vtype == VTYPE_array) { MPIPack(buf, data->data.ptr, TypeToMPIType(data->type), data->size); } else { MPIPack(buf, &data->data, TypeToMPIType(data->type), 1); } }
void SNetDistribPack(void *src, ...) { va_list args; mpi_buf_t *buf; MPI_Datatype type; int count; va_start(args, src); buf = va_arg(args, mpi_buf_t *); type = va_arg(args, MPI_Datatype); count = va_arg(args, int); va_end(args); MPIPack(buf, src, type, count); }
inline static void PackByte(void *buf, int count, char *src) { MPIPack(buf, src, MPI_BYTE, count); }
inline static void PackInt(void *buf, int count, int *src) { MPIPack(buf, src, MPI_INT, count); }
void SNetPackVoid(void *buf, int count, void **src) { MPIPack(buf, src, MPI_VOID_POINTER, count); }
void SNetPackLong(void *buf, int count, long *src) { MPIPack(buf, src, MPI_LONG, count); }
void SNetPackByte(void *buf, int count, char *src) { MPIPack(buf, src, MPI_BYTE, count); }
void SNetPackInt(void *buf, int count, int *src) { MPIPack(buf, src, MPI_INT, count); }