1
1

Roll back Jeff's roll back (r21028) of Iain's changes (r20926, r20941, r20950).

It turns out that the "Intel" interpretation of the MPI spec violates
the Fortran standard (section 14.6.1.1 of the Fortran 95 standard).

This commit was SVN r21225.

The following SVN revision numbers were found above:
  r20926 --> open-mpi/ompi@0a24eadaad
  r20941 --> open-mpi/ompi@045b0e8871
  r20950 --> open-mpi/ompi@73af921c22
  r21028 --> open-mpi/ompi@25249c9843
Этот коммит содержится в:
Iain Bason 2009-05-13 18:32:13 +00:00
родитель 3137001772
Коммит a282cf062c
6 изменённых файлов: 112 добавлений и 42 удалений

Просмотреть файл

@ -251,7 +251,7 @@
MPI_Fint attr_val = translate_to_fortran_mpi1(attribute); \ MPI_Fint attr_val = translate_to_fortran_mpi1(attribute); \
(*((keyval_obj->delete_attr_fn).attr_mpi1_fortran_delete_fn)) \ (*((keyval_obj->delete_attr_fn).attr_mpi1_fortran_delete_fn)) \
(&(((ompi_##type##_t *)object)->attr_##type##_f), \ (&(((ompi_##type##_t *)object)->attr_##type##_f), \
&f_key, &attr_val, (int*)keyval_obj->extra_state, &f_err); \ &f_key, &attr_val, &keyval_obj->extra_state.f_integer, &f_err); \
if (MPI_SUCCESS != OMPI_FINT_2_INT(f_err)) { \ if (MPI_SUCCESS != OMPI_FINT_2_INT(f_err)) { \
if (need_lock) { \ if (need_lock) { \
OPAL_THREAD_UNLOCK(&alock); \ OPAL_THREAD_UNLOCK(&alock); \
@ -264,7 +264,7 @@
MPI_Aint attr_val = translate_to_fortran_mpi2(attribute); \ MPI_Aint attr_val = translate_to_fortran_mpi2(attribute); \
(*((keyval_obj->delete_attr_fn).attr_mpi2_fortran_delete_fn)) \ (*((keyval_obj->delete_attr_fn).attr_mpi2_fortran_delete_fn)) \
(&(((ompi_##type##_t *)object)->attr_##type##_f), \ (&(((ompi_##type##_t *)object)->attr_##type##_f), \
&f_key, (int*)&attr_val, (int*)keyval_obj->extra_state, &f_err); \ &f_key, (int*)&attr_val, &keyval_obj->extra_state.f_address, &f_err); \
if (MPI_SUCCESS != OMPI_FINT_2_INT(f_err)) { \ if (MPI_SUCCESS != OMPI_FINT_2_INT(f_err)) { \
if (need_lock) { \ if (need_lock) { \
OPAL_THREAD_UNLOCK(&alock); \ OPAL_THREAD_UNLOCK(&alock); \
@ -279,7 +279,7 @@
if ((err = (*((keyval_obj->delete_attr_fn).attr_##type##_delete_fn)) \ if ((err = (*((keyval_obj->delete_attr_fn).attr_##type##_delete_fn)) \
((ompi_##type##_t *)object, \ ((ompi_##type##_t *)object, \
key, attr_val, \ key, attr_val, \
keyval_obj->extra_state)) != MPI_SUCCESS) {\ keyval_obj->extra_state.c_ptr)) != MPI_SUCCESS) {\
if (need_lock) { \ if (need_lock) { \
OPAL_THREAD_UNLOCK(&alock); \ OPAL_THREAD_UNLOCK(&alock); \
} \ } \
@ -297,11 +297,11 @@
ompi_fortran_logical_t f_flag; \ ompi_fortran_logical_t f_flag; \
/* MPI-1 Fortran-style */ \ /* MPI-1 Fortran-style */ \
if (0 != (keyval_obj->attr_flag & OMPI_KEYVAL_F77_MPI1)) { \ if (0 != (keyval_obj->attr_flag & OMPI_KEYVAL_F77_MPI1)) { \
MPI_Fint in, out; \ MPI_Fint in, out; \
in = translate_to_fortran_mpi1(in_attr); \ in = translate_to_fortran_mpi1(in_attr); \
(*((keyval_obj->copy_attr_fn).attr_mpi1_fortran_copy_fn)) \ (*((keyval_obj->copy_attr_fn).attr_mpi1_fortran_copy_fn)) \
(&(((ompi_##type##_t *)old_object)->attr_##type##_f), \ (&(((ompi_##type##_t *)old_object)->attr_##type##_f), \
&f_key, (int*)keyval_obj->extra_state, \ &f_key, &keyval_obj->extra_state.f_integer, \
&in, &out, &f_flag, &f_err); \ &in, &out, &f_flag, &f_err); \
if (MPI_SUCCESS != OMPI_FINT_2_INT(f_err)) { \ if (MPI_SUCCESS != OMPI_FINT_2_INT(f_err)) { \
OPAL_THREAD_UNLOCK(&alock); \ OPAL_THREAD_UNLOCK(&alock); \
@ -313,11 +313,11 @@
} \ } \
/* MPI-2 Fortran-style */ \ /* MPI-2 Fortran-style */ \
else { \ else { \
MPI_Aint in, out; \ MPI_Aint in, out; \
in = translate_to_fortran_mpi2(in_attr); \ in = translate_to_fortran_mpi2(in_attr); \
(*((keyval_obj->copy_attr_fn).attr_mpi2_fortran_copy_fn)) \ (*((keyval_obj->copy_attr_fn).attr_mpi2_fortran_copy_fn)) \
(&(((ompi_##type##_t *)old_object)->attr_##type##_f), \ (&(((ompi_##type##_t *)old_object)->attr_##type##_f), \
&f_key, keyval_obj->extra_state, &in, &out, \ &f_key, &keyval_obj->extra_state.f_address, &in, &out, \
&f_flag, &f_err); \ &f_flag, &f_err); \
if (MPI_SUCCESS != OMPI_FINT_2_INT(f_err)) { \ if (MPI_SUCCESS != OMPI_FINT_2_INT(f_err)) { \
OPAL_THREAD_UNLOCK(&alock); \ OPAL_THREAD_UNLOCK(&alock); \
@ -332,7 +332,7 @@
void *in, *out; \ void *in, *out; \
in = translate_to_c(in_attr); \ in = translate_to_c(in_attr); \
if ((err = (*((keyval_obj->copy_attr_fn).attr_##type##_copy_fn)) \ if ((err = (*((keyval_obj->copy_attr_fn).attr_##type##_copy_fn)) \
((ompi_##type##_t *)old_object, key, keyval_obj->extra_state, \ ((ompi_##type##_t *)old_object, key, keyval_obj->extra_state.c_ptr, \
in, &out, &flag, (ompi_##type##_t *)(new_object))) != MPI_SUCCESS) { \ in, &out, &flag, (ompi_##type##_t *)(new_object))) != MPI_SUCCESS) { \
OPAL_THREAD_UNLOCK(&alock); \ OPAL_THREAD_UNLOCK(&alock); \
return err; \ return err; \
@ -438,7 +438,7 @@ ompi_attribute_keyval_construct(ompi_attribute_keyval_t *keyval)
keyval->attr_flag = 0; keyval->attr_flag = 0;
keyval->copy_attr_fn.attr_communicator_copy_fn = NULL; keyval->copy_attr_fn.attr_communicator_copy_fn = NULL;
keyval->delete_attr_fn.attr_communicator_copy_fn = NULL; keyval->delete_attr_fn.attr_communicator_copy_fn = NULL;
keyval->extra_state = NULL; keyval->extra_state.c_ptr = NULL;
keyval->bindings_extra_state = NULL; keyval->bindings_extra_state = NULL;
/* Set the keyval->key value to an invalid value so that we can know /* Set the keyval->key value to an invalid value so that we can know
@ -530,10 +530,12 @@ int ompi_attr_finalize(void)
} }
int ompi_attr_create_keyval(ompi_attribute_type_t type, static int ompi_attr_create_keyval_impl(ompi_attribute_type_t type,
ompi_attribute_fn_ptr_union_t copy_attr_fn, ompi_attribute_fn_ptr_union_t copy_attr_fn,
ompi_attribute_fn_ptr_union_t delete_attr_fn, ompi_attribute_fn_ptr_union_t delete_attr_fn,
int *key, void *extra_state, int flags, int *key,
ompi_attribute_fortran_ptr_t *extra_state,
int flags,
void *bindings_extra_state) void *bindings_extra_state)
{ {
ompi_attribute_keyval_t *keyval; ompi_attribute_keyval_t *keyval;
@ -558,7 +560,7 @@ int ompi_attr_create_keyval(ompi_attribute_type_t type,
keyval->copy_attr_fn = copy_attr_fn; keyval->copy_attr_fn = copy_attr_fn;
keyval->delete_attr_fn = delete_attr_fn; keyval->delete_attr_fn = delete_attr_fn;
keyval->extra_state = extra_state; keyval->extra_state = *extra_state;
keyval->attr_type = type; keyval->attr_type = type;
keyval->attr_flag = flags; keyval->attr_flag = flags;
keyval->key = -1; keyval->key = -1;
@ -582,6 +584,53 @@ int ompi_attr_create_keyval(ompi_attribute_type_t type,
return MPI_SUCCESS; return MPI_SUCCESS;
} }
int ompi_attr_create_keyval(ompi_attribute_type_t type,
ompi_attribute_fn_ptr_union_t copy_attr_fn,
ompi_attribute_fn_ptr_union_t delete_attr_fn,
int *key,
void *extra_state,
int flags,
void *bindings_extra_state)
{
ompi_attribute_fortran_ptr_t es_tmp;
es_tmp.c_ptr = extra_state;
return ompi_attr_create_keyval_impl(type, copy_attr_fn, delete_attr_fn,
key, &es_tmp, flags,
bindings_extra_state);
}
int ompi_attr_create_keyval_fint(ompi_attribute_type_t type,
ompi_attribute_fn_ptr_union_t copy_attr_fn,
ompi_attribute_fn_ptr_union_t delete_attr_fn,
int *key,
MPI_Fint extra_state,
int flags,
void *bindings_extra_state)
{
ompi_attribute_fortran_ptr_t es_tmp;
es_tmp.f_integer = extra_state;
return ompi_attr_create_keyval_impl(type, copy_attr_fn, delete_attr_fn,
key, &es_tmp, flags,
bindings_extra_state);
}
int ompi_attr_create_keyval_aint(ompi_attribute_type_t type,
ompi_attribute_fn_ptr_union_t copy_attr_fn,
ompi_attribute_fn_ptr_union_t delete_attr_fn,
int *key,
MPI_Aint extra_state,
int flags,
void *bindings_extra_state)
{
ompi_attribute_fortran_ptr_t es_tmp;
es_tmp.f_address = extra_state;
return ompi_attr_create_keyval_impl(type, copy_attr_fn, delete_attr_fn,
key, &es_tmp, flags,
bindings_extra_state);
}
int ompi_attr_free_keyval(ompi_attribute_type_t type, int *key, int ompi_attr_free_keyval(ompi_attribute_type_t type, int *key,
bool predefined) bool predefined)

Просмотреть файл

@ -144,6 +144,7 @@ typedef union ompi_attribute_fn_ptr_union_t ompi_attribute_fn_ptr_union_t;
union ompi_attribute_fortran_ptr_t { union ompi_attribute_fortran_ptr_t {
void *c_ptr; void *c_ptr;
MPI_Fint f_integer; MPI_Fint f_integer;
MPI_Aint f_address;
}; };
/** /**
* Convenience typedef * Convenience typedef
@ -162,7 +163,7 @@ struct ompi_attribute_keyval_t {
attribute */ attribute */
ompi_attribute_fn_ptr_union_t delete_attr_fn; /**< Delete function for the ompi_attribute_fn_ptr_union_t delete_attr_fn; /**< Delete function for the
attribute */ attribute */
void *extra_state; /**< Extra state of the attribute */ ompi_attribute_fortran_ptr_t extra_state; /**< Extra state of the attribute */
int key; /**< Keep a track of which key this item belongs to, so that int key; /**< Keep a track of which key this item belongs to, so that
the key can be deleted when this object is destroyed */ the key can be deleted when this object is destroyed */
@ -252,6 +253,26 @@ OMPI_DECLSPEC int ompi_attr_create_keyval(ompi_attribute_type_t type,
int *key, void *extra_state, int flags, int *key, void *extra_state, int flags,
void *bindings_extra_state); void *bindings_extra_state);
/**
* Same as ompi_attr_create_keyval, but extra_state is a Fortran default integer.
*/
OMPI_DECLSPEC int ompi_attr_create_keyval_fint(ompi_attribute_type_t type,
ompi_attribute_fn_ptr_union_t copy_attr_fn,
ompi_attribute_fn_ptr_union_t delete_attr_fn,
int *key, MPI_Fint extra_state, int flags,
void *bindings_extra_state);
/**
* Same as ompi_attr_create_keyval, but extra_state is a Fortran address integer.
*/
OMPI_DECLSPEC int ompi_attr_create_keyval_aint(ompi_attribute_type_t type,
ompi_attribute_fn_ptr_union_t copy_attr_fn,
ompi_attribute_fn_ptr_union_t delete_attr_fn,
int *key, MPI_Aint extra_state, int flags,
void *bindings_extra_state);
/** /**
* Free an attribute keyval * Free an attribute keyval
* @param type Type of attribute (COMM/WIN/DTYPE) (IN) * @param type Type of attribute (COMM/WIN/DTYPE) (IN)

Просмотреть файл

@ -62,9 +62,9 @@ OMPI_GENERATE_F77_BINDINGS (MPI_COMM_CREATE_KEYVAL,
static const char FUNC_NAME[] = "MPI_Comm_create_keyval_f"; static const char FUNC_NAME[] = "MPI_Comm_create_keyval_f";
void mpi_comm_create_keyval_f(ompi_mpi2_fortran_copy_attr_function* comm_copy_attr_fn, void mpi_comm_create_keyval_f(ompi_mpi2_fortran_copy_attr_function* comm_copy_attr_fn,
ompi_mpi2_fortran_delete_attr_function* comm_delete_attr_fn, ompi_mpi2_fortran_delete_attr_function* comm_delete_attr_fn,
MPI_Fint *comm_keyval, MPI_Fint *comm_keyval,
MPI_Aint *extra_state, MPI_Fint *ierr) MPI_Aint *extra_state, MPI_Fint *ierr)
{ {
int ret, c_err; int ret, c_err;
ompi_attribute_fn_ptr_union_t copy_fn; ompi_attribute_fn_ptr_union_t copy_fn;
@ -78,15 +78,15 @@ void mpi_comm_create_keyval_f(ompi_mpi2_fortran_copy_attr_function* comm_copy_at
INTEGER(KIND=MPI_ADDRESS_KIND)-parameter functions (as opposed INTEGER(KIND=MPI_ADDRESS_KIND)-parameter functions (as opposed
to the old MPI-1 INTEGER-parameter functions). */ to the old MPI-1 INTEGER-parameter functions). */
ret = ompi_attr_create_keyval(COMM_ATTR, copy_fn, del_fn, ret = ompi_attr_create_keyval_aint(COMM_ATTR, copy_fn, del_fn,
comm_keyval, extra_state, OMPI_KEYVAL_F77, comm_keyval, *extra_state, OMPI_KEYVAL_F77,
NULL); NULL);
if (MPI_SUCCESS != ret) { if (MPI_SUCCESS != ret) {
c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
MPI_ERR_OTHER, MPI_ERR_OTHER,
FUNC_NAME) FUNC_NAME)
*ierr = OMPI_INT_2_FINT(c_err); *ierr = OMPI_INT_2_FINT(c_err);
} else { } else {
*ierr = OMPI_INT_2_FINT(MPI_SUCCESS); *ierr = OMPI_INT_2_FINT(MPI_SUCCESS);
} }

Просмотреть файл

@ -63,7 +63,7 @@ static const char FUNC_NAME[] = "MPI_keyval_create_f";
void mpi_keyval_create_f(ompi_mpi1_fortran_copy_attr_function* copy_attr_fn, void mpi_keyval_create_f(ompi_mpi1_fortran_copy_attr_function* copy_attr_fn,
ompi_mpi1_fortran_delete_attr_function* delete_attr_fn, ompi_mpi1_fortran_delete_attr_function* delete_attr_fn,
MPI_Fint *keyval, MPI_Fint *extra_state, MPI_Fint *keyval, MPI_Fint *extra_state,
MPI_Fint *ierr) MPI_Fint *ierr)
{ {
int ret, c_err; int ret, c_err;
@ -78,16 +78,16 @@ void mpi_keyval_create_f(ompi_mpi1_fortran_copy_attr_function* copy_attr_fn,
new MPI-2 INTEGER(KIND=MPI_ADDRESS_KIND)-parameter new MPI-2 INTEGER(KIND=MPI_ADDRESS_KIND)-parameter
functions). */ functions). */
ret = ompi_attr_create_keyval(COMM_ATTR, copy_fn, del_fn, ret = ompi_attr_create_keyval_fint(COMM_ATTR, copy_fn, del_fn,
keyval, extra_state, keyval, *extra_state,
OMPI_KEYVAL_F77 | OMPI_KEYVAL_F77_MPI1, OMPI_KEYVAL_F77 | OMPI_KEYVAL_F77_MPI1,
NULL); NULL);
if (MPI_SUCCESS != ret) { if (MPI_SUCCESS != ret) {
c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
MPI_ERR_OTHER, MPI_ERR_OTHER,
FUNC_NAME); FUNC_NAME);
*ierr = OMPI_INT_2_FINT(c_err); *ierr = OMPI_INT_2_FINT(c_err);
} else { } else {
*ierr = OMPI_INT_2_FINT(MPI_SUCCESS); *ierr = OMPI_INT_2_FINT(MPI_SUCCESS);
} }

Просмотреть файл

@ -75,15 +75,15 @@ void mpi_type_create_keyval_f(ompi_mpi2_fortran_copy_attr_function* type_copy_at
INTEGER(KIND=MPI_ADDRESS_KIND)-parameter functions (as opposed INTEGER(KIND=MPI_ADDRESS_KIND)-parameter functions (as opposed
to the old MPI-1 INTEGER-parameter functions). */ to the old MPI-1 INTEGER-parameter functions). */
ret = ompi_attr_create_keyval(TYPE_ATTR, copy_fn, del_fn, ret = ompi_attr_create_keyval_aint(TYPE_ATTR, copy_fn, del_fn,
type_keyval, extra_state, OMPI_KEYVAL_F77, type_keyval, *extra_state, OMPI_KEYVAL_F77,
NULL); NULL);
if (MPI_SUCCESS != ret) { if (MPI_SUCCESS != ret) {
c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
MPI_ERR_OTHER, MPI_ERR_OTHER,
FUNC_NAME); FUNC_NAME);
*ierr = OMPI_INT_2_FINT(c_err); *ierr = OMPI_INT_2_FINT(c_err);
} else { } else {
*ierr = OMPI_INT_2_FINT(MPI_SUCCESS); *ierr = OMPI_INT_2_FINT(MPI_SUCCESS);
} }

Просмотреть файл

@ -77,14 +77,14 @@ void mpi_win_create_keyval_f(ompi_mpi2_fortran_copy_attr_function* win_copy_attr
INTEGER(KIND=MPI_ADDRESS_KIND)-parameter functions (as opposed INTEGER(KIND=MPI_ADDRESS_KIND)-parameter functions (as opposed
to the old MPI-1 INTEGER-parameter functions). */ to the old MPI-1 INTEGER-parameter functions). */
ret = ompi_attr_create_keyval(WIN_ATTR, copy_fn, del_fn, ret = ompi_attr_create_keyval_aint(WIN_ATTR, copy_fn, del_fn,
win_keyval, extra_state, OMPI_KEYVAL_F77, win_keyval, *extra_state, OMPI_KEYVAL_F77,
NULL); NULL);
if (MPI_SUCCESS != ret) { if (MPI_SUCCESS != ret) {
c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER,
FUNC_NAME); FUNC_NAME);
*ierr = OMPI_INT_2_FINT(c_err); *ierr = OMPI_INT_2_FINT(c_err);
} else { } else {
*ierr = OMPI_INT_2_FINT(MPI_SUCCESS); *ierr = OMPI_INT_2_FINT(MPI_SUCCESS);
} }