Activate tests for these functions. Somes cases with too complex imbricated datatypes are not supported (yet).
void smpi_datatype_free(MPI_Datatype* type);
void smpi_datatype_commit(MPI_Datatype* datatype);
+int smpi_mpi_unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm);
+int smpi_mpi_pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm);
+
void smpi_empty_status(MPI_Status * status);
MPI_Op smpi_op_new(MPI_User_function * function, int commute);
int smpi_op_is_commute(MPI_Op op);
CREATE_MPI_DATATYPE_NULL(MPI_UB);
CREATE_MPI_DATATYPE_NULL(MPI_LB);
-CREATE_MPI_DATATYPE_NULL(MPI_PACKED);
+CREATE_MPI_DATATYPE(MPI_PACKED, char);
// Internal use only
CREATE_MPI_DATATYPE(MPI_PTR, void*);
else if (sendtype->has_subtype == 0)
{
s_smpi_subtype_t *subtype = recvtype->substruct;
- subtype->unserialize( sendbuf, recvbuf,1, subtype, MPI_REPLACE);
+ subtype->unserialize( sendbuf, recvbuf, recvcount/smpi_datatype_size(recvtype), subtype, MPI_REPLACE);
}
else if (recvtype->has_subtype == 0)
{
s_smpi_subtype_t *subtype = sendtype->substruct;
- subtype->serialize(sendbuf, recvbuf,1, subtype);
+ subtype->serialize(sendbuf, recvbuf, sendcount/smpi_datatype_size(sendtype), subtype);
}else{
s_smpi_subtype_t *subtype = sendtype->substruct;
xbt_free(tmpkey);
return MPI_SUCCESS;
}
+
+int smpi_mpi_pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm){
+ size_t size = smpi_datatype_size(type);
+ if (outcount - *position < incount*size)
+ return MPI_ERR_BUFFER;
+ smpi_datatype_copy(inbuf, incount, type,
+ (char*)outbuf + *position, outcount, MPI_CHAR);
+ *position += incount * size;
+ return MPI_SUCCESS;
+}
+
+int smpi_mpi_unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm){
+ size_t size = smpi_datatype_size(type);
+ if (outcount*size> insize)
+ return MPI_ERR_BUFFER;
+ smpi_datatype_copy((char*)inbuf + *position, insize, MPI_CHAR,
+ outbuf, outcount, type);
+ *position += outcount * size;
+ return MPI_SUCCESS;
+}
+
return MPI_SUCCESS;
}
+int PMPI_Unpack(void* inbuf, int incount, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) {
+ if(incount<0 || outcount < 0 || inbuf==NULL || outbuf==NULL)
+ return MPI_ERR_ARG;
+ if(!is_datatype_valid(type))
+ return MPI_ERR_TYPE;
+ if(comm==MPI_COMM_NULL)
+ return MPI_ERR_COMM;
+ return smpi_mpi_unpack(inbuf, incount, position, outbuf,outcount,type, comm);
+}
+
+int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) {
+ if(incount<0 || outcount < 0|| inbuf==NULL || outbuf==NULL)
+ return MPI_ERR_ARG;
+ if(!is_datatype_valid(type))
+ return MPI_ERR_TYPE;
+ if(comm==MPI_COMM_NULL)
+ return MPI_ERR_COMM;
+ return smpi_mpi_pack(inbuf, incount, type, outbuf,outcount,position, comm);
+}
+
+int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) {
+ if(incount<0)
+ return MPI_ERR_ARG;
+ if(!is_datatype_valid(datatype))
+ return MPI_ERR_TYPE;
+ if(comm==MPI_COMM_NULL)
+ return MPI_ERR_COMM;
+
+ *size=incount*smpi_datatype_size(datatype);
+
+ return MPI_SUCCESS;
+}
+
+
/* The following calls are not yet implemented and will fail at runtime. */
/* Once implemented, please move them above this notice. */
NOT_YET_IMPLEMENTED
}
-int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) {
- NOT_YET_IMPLEMENTED
-}
-
-
int PMPI_Cart_map(MPI_Comm comm_old, int ndims, int* dims, int* periods, int* newrank) {
NOT_YET_IMPLEMENTED
}
-
int PMPI_Graph_create(MPI_Comm comm_old, int nnodes, int* index, int* edges, int reorder, MPI_Comm* comm_graph) {
NOT_YET_IMPLEMENTED
}
NOT_YET_IMPLEMENTED
}
-int PMPI_Unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) {
- NOT_YET_IMPLEMENTED
-}
int PMPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm* comm_out) {
NOT_YET_IMPLEMENTED
NOT_YET_IMPLEMENTED
}
-int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) {
- NOT_YET_IMPLEMENTED
-}
+
int PMPI_Pack_external_size(char *datarep, int incount, MPI_Datatype datatype, MPI_Aint *size){
NOT_YET_IMPLEMENTED
# add_executable(blockindexed-misc blockindexed-misc.c)
add_executable(blockindexed-zero-count blockindexed-zero-count.c)
# add_executable(contents contents.c)
-# add_executable(contigstruct contigstruct.c)
+ add_executable(contigstruct contigstruct.c)
add_executable(contig-zero-count contig-zero-count.c)
add_executable(cxx-types cxx-types.c)
# add_executable(darray-cyclic darray-cyclic.c)
# add_executable(large_type large_type.c)
# add_executable(large_type_sendrec large_type_sendrec.c)
# add_executable(lbub lbub.c)
-# add_executable(localpack localpack.c)
+ add_executable(localpack localpack.c)
add_executable(longdouble longdouble.c)
# add_executable(lots-of-types lots-of-types.c)
# add_executable(pairtype-pack pairtype-pack.c)
add_executable(sendrecvt2 ${CMAKE_CURRENT_SOURCE_DIR}/../util/dtypes.c sendrecvt2.c)
add_executable(sendrecvt4 ${CMAKE_CURRENT_SOURCE_DIR}/../util/dtypes.c sendrecvt4.c)
add_executable(simple-commit simple-commit.c)
-# add_executable(simple-pack simple-pack.c)
+ add_executable(simple-pack simple-pack.c)
# add_executable(simple-pack-external simple-pack-external.c)
add_executable(simple-resized simple-resized.c)
add_executable(simple-size-extent simple-size-extent.c)
# add_executable(struct-empty-el struct-empty-el.c)
add_executable(struct-ezhov struct-ezhov.c)
# add_executable(struct-no-real-types struct-no-real-types.c)
-# add_executable(struct-pack struct-pack.c)
+ add_executable(struct-pack struct-pack.c)
# add_executable(structpack2 structpack2.c)
add_executable(struct-verydeep struct-verydeep.c)
add_executable(struct-zero-count struct-zero-count.c)
# add_executable(subarray-pack subarray-pack.c)
add_executable(tfree tfree.c)
# add_executable(tmatchsize tmatchsize.c)
-# add_executable(transpose-pack transpose-pack.c)
+ add_executable(transpose-pack transpose-pack.c)
add_executable(tresized2 tresized2.c)
add_executable(tresized tresized.c)
# add_executable(triangular-pack triangular-pack.c)
add_executable(typefree typefree.c)
add_executable(typelb typelb.c)
add_executable(typename typename.c)
-# add_executable(unpack unpack.c)
+ add_executable(unpack unpack.c)
# add_executable(unusual-noncontigs unusual-noncontigs.c)
# add_executable(vecblklen vecblklen.c)
# add_executable(zero-blklen-vector zero-blklen-vector.c)
-# add_executable(zeroblks zeroblks.c)
+ add_executable(zeroblks zeroblks.c)
add_executable(zeroparms zeroparms.c)
# target_link_libraries(blockindexed-misc simgrid mtest_c)
target_link_libraries(blockindexed-zero-count simgrid mtest_c)
# target_link_libraries(contents simgrid mtest_c)
-# target_link_libraries(contigstruct simgrid mtest_c)
+ target_link_libraries(contigstruct simgrid mtest_c)
target_link_libraries(contig-zero-count simgrid mtest_c)
target_link_libraries(cxx-types simgrid mtest_c)
# target_link_libraries(darray-cyclic simgrid mtest_c)
# target_link_libraries(large_type simgrid mtest_c)
# target_link_libraries(large_type_sendrec simgrid mtest_c)
# target_link_libraries(lbub simgrid mtest_c)
-# target_link_libraries(localpack simgrid mtest_c)
+ target_link_libraries(localpack simgrid mtest_c)
target_link_libraries(longdouble simgrid mtest_c)
# target_link_libraries(lots-of-types simgrid mtest_c)
# target_link_libraries(pairtype-pack simgrid mtest_c)
target_link_libraries(sendrecvt2 simgrid mtest_c)
target_link_libraries(sendrecvt4 simgrid mtest_c)
target_link_libraries(simple-commit simgrid mtest_c)
-# target_link_libraries(simple-pack simgrid mtest_c)
+ target_link_libraries(simple-pack simgrid mtest_c)
# target_link_libraries(simple-pack-external simgrid mtest_c)
target_link_libraries(simple-resized simgrid mtest_c)
target_link_libraries(simple-size-extent simgrid mtest_c)
# target_link_libraries(struct-empty-el simgrid mtest_c)
target_link_libraries(struct-ezhov simgrid mtest_c)
# target_link_libraries(struct-no-real-types simgrid mtest_c)
-# target_link_libraries(struct-pack simgrid mtest_c)
+ target_link_libraries(struct-pack simgrid mtest_c)
# target_link_libraries(structpack2 simgrid mtest_c)
target_link_libraries(struct-verydeep simgrid mtest_c)
target_link_libraries(struct-zero-count simgrid mtest_c)
# target_link_libraries(subarray-pack simgrid mtest_c)
target_link_libraries(tfree simgrid mtest_c)
# target_link_libraries(tmatchsize simgrid mtest_c)
-# target_link_libraries(transpose-pack simgrid mtest_c)
+ target_link_libraries(transpose-pack simgrid mtest_c)
target_link_libraries(tresized2 simgrid mtest_c)
target_link_libraries(tresized simgrid mtest_c)
# target_link_libraries(triangular-pack simgrid mtest_c)
target_link_libraries(typefree simgrid mtest_c)
target_link_libraries(typelb simgrid mtest_c)
target_link_libraries(typename simgrid mtest_c)
-# target_link_libraries(unpack simgrid mtest_c)
+ target_link_libraries(unpack simgrid mtest_c)
# target_link_libraries(unusual-noncontigs simgrid mtest_c)
# target_link_libraries(vecblklen simgrid mtest_c)
# target_link_libraries(zero-blklen-vector simgrid mtest_c)
-# target_link_libraries(zeroblks simgrid mtest_c)
+ target_link_libraries(zeroblks simgrid mtest_c)
target_link_libraries(zeroparms simgrid mtest_c)
endif()
gaddress 1
#complex games with negative extents...
#lbub 1
-#needs MPI_Pack, MPI_Unpack
-#localpack 1
-#simple-pack 1
+localpack 1
+simple-pack 1
#simple-pack-external 1
-#transpose-pack 1
+transpose-pack 1
#slice-pack 1
-#struct-pack 1
+struct-pack 1
#structpack2 1
typecommit 1
typename 1
#tmatchsize 1
tfree 2
typelb 1
-#needs MPI_Pack_size
-#contigstruct 1
+contigstruct 1
struct-zero-count 1
blockindexed-zero-count 1
-#needs MPI_Pack, MPI_unpack, MPI_Pack_size
+#needs better handling of lb/ub
#blockindexed-misc 1
-#needs MPI_Pack, MPI_unpack, MPI_Pack_size
#indexed-misc 1
#needs MPI_Type_create_subarray
#subarray-pack 1
#hindexed-zeros 1
#lots-of-types 1
#get-elements-pairtype 1
-#unpack 1
+unpack 1
struct-ezhov 1
-#needs MPI_Pack, MPI_Unpack
-#zeroblks 1
+zeroblks 1
struct-derived-zeros 1
struct-verydeep 1
#get-elements 1