XBT_PUBLIC_DATA( MPI_Datatype ) MPI_INT32_T;
XBT_PUBLIC_DATA( MPI_Datatype ) MPI_INT64_T;
XBT_PUBLIC_DATA( MPI_Datatype ) MPI_UINT8_T;
-#define MPI_BYTE MPI_UINT8_T
+XBT_PUBLIC_DATA( MPI_Datatype ) MPI_BYTE;
XBT_PUBLIC_DATA( MPI_Datatype ) MPI_UINT16_T;
XBT_PUBLIC_DATA( MPI_Datatype ) MPI_UINT32_T;
XBT_PUBLIC_DATA( MPI_Datatype ) MPI_UINT64_T;
XBT_PUBLIC_DATA(MPI_Datatype) MPI_2FLOAT;
XBT_PUBLIC_DATA(MPI_Datatype) MPI_2DOUBLE;
XBT_PUBLIC_DATA(MPI_Datatype) MPI_2LONG;//only for compatibility with Fortran
+
+XBT_PUBLIC_DATA(MPI_Datatype) MPI_REAL4;
+XBT_PUBLIC_DATA(MPI_Datatype) MPI_REAL8;
+XBT_PUBLIC_DATA(MPI_Datatype) MPI_REAL16;
+XBT_PUBLIC_DATA(MPI_Datatype) MPI_COMPLEX8;
+XBT_PUBLIC_DATA(MPI_Datatype) MPI_COMPLEX16;
+XBT_PUBLIC_DATA(MPI_Datatype) MPI_COMPLEX32;
+XBT_PUBLIC_DATA(MPI_Datatype) MPI_INTEGER1;
+XBT_PUBLIC_DATA(MPI_Datatype) MPI_INTEGER2;
+XBT_PUBLIC_DATA(MPI_Datatype) MPI_INTEGER4;
+XBT_PUBLIC_DATA(MPI_Datatype) MPI_INTEGER8;
+XBT_PUBLIC_DATA(MPI_Datatype) MPI_INTEGER16;
+
//for now we only send int values at max
#define MPI_Count int
#define MPI_COUNT MPI_INT
#define MPI_2INTEGER MPI_2LONG
#define MPI_LOGICAL MPI_LONG
#endif
-#define MPI_INTEGER1 MPI_INT
-#define MPI_INTEGER2 MPI_INT16_T
-#define MPI_INTEGER4 MPI_INT32_T
-#define MPI_INTEGER8 MPI_INT64_T
-#define MPI_REAL MPI_FLOAT
-#define MPI_REAL4 MPI_FLOAT
-#define MPI_REAL8 MPI_DOUBLE
-#define MPI_REAL16 MPI_DOUBLE
+
#define MPI_COMPLEX MPI_C_FLOAT_COMPLEX
#define MPI_DOUBLE_COMPLEX MPI_C_DOUBLE_COMPLEX
#define MPI_LOGICAL1 MPI_UINT8_T
#define MPI_CHARACTER MPI_CHAR
#define MPI_DOUBLE_PRECISION MPI_DOUBLE
#define MPI_2DOUBLE_PRECISION MPI_2DOUBLE
-#define MPI_COMPLEX8 MPI_DATATYPE_NULL
-#define MPI_COMPLEX16 MPI_DATATYPE_NULL
-#define MPI_COMPLEX32 MPI_DATATYPE_NULL
+
typedef void MPI_User_function(void *invec, void *inoutvec, int *len,
} s_smpi_subtype_t;
typedef struct s_smpi_mpi_datatype{
+ char* name;
size_t size;
/* this let us know if a serialization is required*/
size_t has_subtype;
int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb,
MPI_Aint * extent);
MPI_Aint smpi_datatype_get_extent(MPI_Datatype datatype);
+void smpi_datatype_get_name(MPI_Datatype datatype, char* name, int* length);
+void smpi_datatype_set_name(MPI_Datatype datatype, char* name);
int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount,
MPI_Datatype recvtype);
#define CREATE_MPI_DATATYPE(name, type) \
static s_smpi_mpi_datatype_t mpi_##name = { \
+ (char*) # name, \
sizeof(type), /* size */ \
0, /*was 1 has_subtype*/ \
0, /* lb */ \
#define CREATE_MPI_DATATYPE_NULL(name) \
static s_smpi_mpi_datatype_t mpi_##name = { \
+ (char*) # name, \
0, /* size */ \
0, /*was 1 has_subtype*/ \
0, /* lb */ \
long double value;
int index;
} long_double_int;
-
+typedef struct {
+ int64_t value;
+ int64_t index;
+} integer128_t;
// Predefined data types
CREATE_MPI_DATATYPE(MPI_CHAR, char);
CREATE_MPI_DATATYPE(MPI_SHORT, short);
CREATE_MPI_DATATYPE(MPI_LONG_DOUBLE, long double);
CREATE_MPI_DATATYPE(MPI_WCHAR, wchar_t);
CREATE_MPI_DATATYPE(MPI_C_BOOL, _Bool);
+CREATE_MPI_DATATYPE(MPI_BYTE, int8_t);
CREATE_MPI_DATATYPE(MPI_INT8_T, int8_t);
CREATE_MPI_DATATYPE(MPI_INT16_T, int16_t);
CREATE_MPI_DATATYPE(MPI_INT32_T, int32_t);
CREATE_MPI_DATATYPE(MPI_2DOUBLE, double_double);
CREATE_MPI_DATATYPE(MPI_2LONG, long_long);
+CREATE_MPI_DATATYPE(MPI_REAL4, float);
+CREATE_MPI_DATATYPE(MPI_REAL8, float);
+CREATE_MPI_DATATYPE(MPI_REAL16, double);
+CREATE_MPI_DATATYPE_NULL(MPI_COMPLEX8);
+CREATE_MPI_DATATYPE_NULL(MPI_COMPLEX16);
+CREATE_MPI_DATATYPE_NULL(MPI_COMPLEX32);
+CREATE_MPI_DATATYPE(MPI_INTEGER1, int);
+CREATE_MPI_DATATYPE(MPI_INTEGER2, int16_t);
+CREATE_MPI_DATATYPE(MPI_INTEGER4, int32_t);
+CREATE_MPI_DATATYPE(MPI_INTEGER8, int64_t);
+CREATE_MPI_DATATYPE(MPI_INTEGER16, integer128_t);
+
CREATE_MPI_DATATYPE(MPI_LONG_DOUBLE_INT, long_double_int);
CREATE_MPI_DATATYPE_NULL(MPI_UB);
memcpy(new_t, datatype, sizeof(s_smpi_mpi_datatype_t));
if (datatype->has_subtype)
memcpy(new_t->substruct, datatype->substruct, sizeof(s_smpi_subtype_t));
+ if(datatype->name)
+ new_t->name = strdup(datatype->name);
return new_t;
}
return datatype->ub - datatype->lb;
}
+void smpi_datatype_get_name(MPI_Datatype datatype, char* name, int* length){
+ *length = strlen(datatype->name);
+ strcpy(name, datatype->name);
+}
+
+void smpi_datatype_set_name(MPI_Datatype datatype, char* name){
+ datatype->name = strdup(name);;
+}
+
int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype)
{
void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int has_subtype,
void *struct_type, int flags){
MPI_Datatype new_t= xbt_new(s_smpi_mpi_datatype_t,1);
+ new_t->name = NULL;
new_t->size = size;
new_t->has_subtype = size>0? has_subtype:0;
new_t->lb = lb;
((s_smpi_subtype_t *)(*type)->substruct)->subtype_free(type);
xbt_free((*type)->substruct);
}
+ if ((*type)->name != NULL){
+ xbt_free((*type)->name);
+ }
xbt_free(*type);
*type = MPI_DATATYPE_NULL;
}
return MPI_SUCCESS;
}
+int PMPI_Type_set_name(MPI_Datatype datatype, char * name)
+{
+ int retval = 0;
+ if (datatype == MPI_DATATYPE_NULL) {
+ retval = MPI_ERR_TYPE;
+ } else if (name == NULL) {
+ retval = MPI_ERR_ARG;
+ } else {
+ smpi_datatype_set_name(datatype, name);
+ retval = MPI_SUCCESS;
+ }
+ return retval;
+}
+int PMPI_Type_get_name(MPI_Datatype datatype, char * name, int* len)
+{
+ int retval = 0;
+
+ if (datatype == MPI_DATATYPE_NULL) {
+ retval = MPI_ERR_TYPE;
+ } else if (name == NULL) {
+ retval = MPI_ERR_ARG;
+ } else {
+ smpi_datatype_get_name(datatype, name, len);
+ retval = MPI_SUCCESS;
+ }
+ return retval;
+}
/* The following calls are not yet implemented and will fail at runtime. */
/* Once implemented, please move them above this notice. */
return MPI_SUCCESS; \
}
-int PMPI_Type_set_name(MPI_Datatype datatype, char * name)
-{
- NOT_YET_IMPLEMENTED
-}
-int PMPI_Type_get_name(MPI_Datatype datatype, char * name, int* len)
-{
- NOT_YET_IMPLEMENTED
-}
int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) {
NOT_YET_IMPLEMENTED
add_executable(typecommit typecommit.c)
add_executable(typefree typefree.c)
add_executable(typelb typelb.c)
-# add_executable(typename typename.c)
+ add_executable(typename typename.c)
# add_executable(unpack unpack.c)
# add_executable(unusual-noncontigs unusual-noncontigs.c)
# add_executable(zero-blklen-vector zero-blklen-vector.c)
target_link_libraries(typecommit 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(typename simgrid mtest_c)
# target_link_libraries(unpack simgrid mtest_c)
# target_link_libraries(unusual-noncontigs simgrid mtest_c)
# target_link_libraries(zero-blklen-vector simgrid mtest_c)
#slice-pack 1
#struct-pack 1
typecommit 1
-#needs MPI_Type_get_name
-#typename 1
+typename 1
typefree 1
zeroparms 1
#getpartelm 2
/* #undef HAVE_MPI_INIT_THREAD */
/* Define if MPI_INTEGER16 is available */
-/* #undef HAVE_MPI_INTEGER16 */
+#define HAVE_MPI_INTEGER16 1
/* Define if MPI-IO (really ROMIO) is included */
//#define HAVE_MPI_IO 1