void Trace::pack(void *buf, int bufsize, int *position, MPI_Comm comm){ int len = traceLen(); PMPI_Pack(&len, 1, MPI_INT, buf, bufsize, position, comm); Event *iter = head; while(iter){ iter->pack(buf, bufsize, position, comm); iter = iter->next; } }
void Histogram::pack(void *buf, int bufsize, int *position, MPI_Comm comm){ int type = 1; /* 0 -- ParamValue, 1 -- Histogram */ PMPI_Pack(&type, 1, MPI_INT, buf, bufsize, position, comm); PMPI_Pack(&num_elems, 1, MPI_INT, buf, bufsize, position, comm); PMPI_Pack(&num_bins, 1, MPI_INT, buf, bufsize, position, comm); PMPI_Pack(&max_rank, 1, MPI_INT, buf, bufsize, position, comm); PMPI_Pack(&min_rank, 1, MPI_INT, buf, bufsize, position, comm); PMPI_Pack(&max_value, 1, MPI_DOUBLE, buf, bufsize, position, comm); PMPI_Pack(&min_value, 1, MPI_DOUBLE, buf, bufsize, position, comm); PMPI_Pack(&avg_value, 1, MPI_DOUBLE, buf, bufsize, position, comm); for(unsigned i=0; i<bins.size(); i++) bins[i]->pack(buf, bufsize, position, comm); }
void send_keys(effort_data& effort_log, int dest, MPI_Comm comm) { int bufsize = 0; bufsize += ModuleId::packed_size_id_map(comm); // size of module map bufsize += mpi_packed_size(1, MPI_INT, comm); // number of keys for (effort_data::iterator i=effort_log.begin(); i != effort_log.end(); i++) { bufsize += i->first.packed_size(comm); // size of each key } PMPI_Send(&bufsize, 1, MPI_INT, dest, 0, comm); char buf[bufsize]; int position = 0; ModuleId::pack_id_map(buf, bufsize, &position, comm); int num_keys = effort_log.size(); PMPI_Pack(&num_keys, 1, MPI_INT, buf, bufsize, &position, comm); for (effort_data::iterator i=effort_log.begin(); i != effort_log.end(); i++) { i->first.pack(buf, bufsize, &position, comm); } PMPI_Send(buf, position, MPI_PACKED, dest, 0, comm); }
void ompi_pack_f(char *inbuf, MPI_Fint *incount, MPI_Fint *datatype, char *outbuf, MPI_Fint *outsize, MPI_Fint *position, MPI_Fint *comm, MPI_Fint *ierr) { int c_ierr; MPI_Comm c_comm; MPI_Datatype c_type; OMPI_SINGLE_NAME_DECL(position); c_comm = PMPI_Comm_f2c(*comm); c_type = PMPI_Type_f2c(*datatype); OMPI_SINGLE_FINT_2_INT(position); c_ierr = PMPI_Pack(OMPI_F2C_BOTTOM(inbuf), OMPI_FINT_2_INT(*incount), c_type, outbuf, OMPI_FINT_2_INT(*outsize), OMPI_SINGLE_NAME_CONVERT(position), c_comm); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { OMPI_SINGLE_INT_2_FINT(position); } }
int MPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) { return PMPI_Pack(inbuf, incount, type, outbuf, outcount, position, comm); }