return key;
}
+
+
+static void smpi_init_fortran_types(){
+ if(!comm_lookup){
+ comm_lookup = xbt_dict_new_homogeneous(NULL);
+ smpi_comm_c2f(MPI_COMM_WORLD);
+ group_lookup = xbt_dict_new_homogeneous(NULL);
+ request_lookup = xbt_dict_new_homogeneous(NULL);
+ datatype_lookup = xbt_dict_new_homogeneous(NULL);
+ win_lookup = xbt_dict_new_homogeneous(NULL);
+ info_lookup = xbt_dict_new_homogeneous(NULL);
+ smpi_type_c2f(MPI_BYTE);
+ smpi_type_c2f(MPI_CHAR);
+ #if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
+ smpi_type_c2f(MPI_INT);
+ smpi_type_c2f(MPI_INT);
+ #else
+ smpi_type_c2f(MPI_LONG);
+ smpi_type_c2f(MPI_LONG);
+ #endif
+ smpi_type_c2f(MPI_INT8_T);
+ smpi_type_c2f(MPI_INT16_T);
+ smpi_type_c2f(MPI_INT32_T);
+ smpi_type_c2f(MPI_INT64_T);
+ smpi_type_c2f(MPI_FLOAT);
+ smpi_type_c2f(MPI_FLOAT);
+ smpi_type_c2f(MPI_DOUBLE);
+ smpi_type_c2f(MPI_DOUBLE);
+ smpi_type_c2f(MPI_C_FLOAT_COMPLEX);
+ smpi_type_c2f(MPI_C_DOUBLE_COMPLEX);
+ #if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
+ smpi_type_c2f(MPI_2INT);
+ #else
+ smpi_type_c2f(MPI_2LONG);
+ #endif
+ smpi_type_c2f(MPI_UINT8_T);
+ smpi_type_c2f(MPI_UINT16_T);
+ smpi_type_c2f(MPI_UINT32_T);
+ smpi_type_c2f(MPI_UINT64_T);
+ smpi_type_c2f(MPI_2FLOAT);
+ smpi_type_c2f(MPI_2DOUBLE);
+ smpi_type_c2f(MPI_DOUBLE);
+ smpi_type_c2f(MPI_DOUBLE);
+ smpi_type_c2f(MPI_INT);
+ smpi_type_c2f(MPI_DATATYPE_NULL);
+ smpi_type_c2f(MPI_DATATYPE_NULL);
+ smpi_type_c2f(MPI_DATATYPE_NULL);
+ smpi_type_c2f(MPI_DATATYPE_NULL);
+ op_lookup = xbt_dict_new_homogeneous(NULL);
+ smpi_op_c2f(MPI_MAX);
+ smpi_op_c2f(MPI_MIN);
+ smpi_op_c2f(MPI_MAXLOC);
+ smpi_op_c2f(MPI_MINLOC);
+ smpi_op_c2f(MPI_SUM);
+ smpi_op_c2f(MPI_PROD);
+ smpi_op_c2f(MPI_LAND);
+ smpi_op_c2f(MPI_LOR);
+ smpi_op_c2f(MPI_LXOR);
+ smpi_op_c2f(MPI_BAND);
+ smpi_op_c2f(MPI_BOR);
+ smpi_op_c2f(MPI_BXOR);
+ }
+}
+
+
int smpi_comm_c2f(MPI_Comm comm) {
static int comm_id = 0;
char key[KEY_SIZE];
}
MPI_Comm smpi_comm_f2c(int comm) {
+ smpi_init_fortran_types();
if(comm == -2) {
return MPI_COMM_SELF;
}else if(comm==0){
}
MPI_Group smpi_group_f2c(int group) {
+ smpi_init_fortran_types();
if(group == -2) {
return MPI_GROUP_EMPTY;
} else if(group_lookup && group >= 0) {
}
MPI_Request smpi_request_f2c(int req) {
+ smpi_init_fortran_types();
char key[KEY_SIZE];
if(req==MPI_FORTRAN_REQUEST_NULL)return MPI_REQUEST_NULL;
return (MPI_Request)xbt_dict_get(request_lookup, get_key_id(key, req));
}
MPI_Datatype smpi_type_f2c(int datatype) {
+ smpi_init_fortran_types();
char key[KEY_SIZE];
return datatype >= 0
? (MPI_Datatype)xbt_dict_get_or_null(datatype_lookup, get_key(key, datatype))
}
MPI_Op smpi_op_f2c(int op) {
+ smpi_init_fortran_types();
char key[KEY_SIZE];
return op >= 0
? (MPI_Op)xbt_dict_get_or_null(op_lookup, get_key(key, op))
}
MPI_Win smpi_win_f2c(int win) {
+ smpi_init_fortran_types();
char key[KEY_SIZE];
return win >= 0
? (MPI_Win)xbt_dict_get_or_null(win_lookup, get_key(key, win))
}
MPI_Info smpi_info_f2c(int info) {
+ smpi_init_fortran_types();
char key[KEY_SIZE];
return info >= 0
? (MPI_Info)xbt_dict_get_or_null(info_lookup, get_key(key, info))
xbt_dict_remove(info_lookup, get_key(key, info));
}
-static void smpi_init_fortran_types(){
- if(!comm_lookup){
- comm_lookup = xbt_dict_new_homogeneous(NULL);
- smpi_comm_c2f(MPI_COMM_WORLD);
- group_lookup = xbt_dict_new_homogeneous(NULL);
- request_lookup = xbt_dict_new_homogeneous(NULL);
- datatype_lookup = xbt_dict_new_homogeneous(NULL);
- win_lookup = xbt_dict_new_homogeneous(NULL);
- info_lookup = xbt_dict_new_homogeneous(NULL);
- smpi_type_c2f(MPI_BYTE);
- smpi_type_c2f(MPI_CHAR);
- #if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
- smpi_type_c2f(MPI_INT);
- smpi_type_c2f(MPI_INT);
- #else
- smpi_type_c2f(MPI_LONG);
- smpi_type_c2f(MPI_LONG);
- #endif
- smpi_type_c2f(MPI_INT8_T);
- smpi_type_c2f(MPI_INT16_T);
- smpi_type_c2f(MPI_INT32_T);
- smpi_type_c2f(MPI_INT64_T);
- smpi_type_c2f(MPI_FLOAT);
- smpi_type_c2f(MPI_FLOAT);
- smpi_type_c2f(MPI_DOUBLE);
- smpi_type_c2f(MPI_DOUBLE);
- smpi_type_c2f(MPI_C_FLOAT_COMPLEX);
- smpi_type_c2f(MPI_C_DOUBLE_COMPLEX);
- #if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
- smpi_type_c2f(MPI_2INT);
- #else
- smpi_type_c2f(MPI_2LONG);
- #endif
- smpi_type_c2f(MPI_UINT8_T);
- smpi_type_c2f(MPI_UINT16_T);
- smpi_type_c2f(MPI_UINT32_T);
- smpi_type_c2f(MPI_UINT64_T);
- smpi_type_c2f(MPI_2FLOAT);
- smpi_type_c2f(MPI_2DOUBLE);
- smpi_type_c2f(MPI_DOUBLE);
- smpi_type_c2f(MPI_DOUBLE);
- smpi_type_c2f(MPI_INT);
- smpi_type_c2f(MPI_DATATYPE_NULL);
- smpi_type_c2f(MPI_DATATYPE_NULL);
- smpi_type_c2f(MPI_DATATYPE_NULL);
- smpi_type_c2f(MPI_DATATYPE_NULL);
- op_lookup = xbt_dict_new_homogeneous(NULL);
- smpi_op_c2f(MPI_MAX);
- smpi_op_c2f(MPI_MIN);
- smpi_op_c2f(MPI_MAXLOC);
- smpi_op_c2f(MPI_MINLOC);
- smpi_op_c2f(MPI_SUM);
- smpi_op_c2f(MPI_PROD);
- smpi_op_c2f(MPI_LAND);
- smpi_op_c2f(MPI_LOR);
- smpi_op_c2f(MPI_LXOR);
- smpi_op_c2f(MPI_BAND);
- smpi_op_c2f(MPI_BOR);
- smpi_op_c2f(MPI_BXOR);
- }
-}
-
void mpi_init_(int* ierr) {
smpi_init_fortran_types();