Hi Rob,
As you perhaps remember, I was porting ROMIO on OpenMPI.
The job is quite finished, I only have a problem with the
allocation/dealocation of Keyval (cb_config_list_keyval in
adio/common/cb_config_list.c).
As the alogorithm runs on MPICH2, I asked for help on the
de...@open-mpi.org
mailing list.
I just received the following answer from George Bosilca.
The solution I found to run ROMIO with OpenMPI is to delete the line:
MPI_Keyval_free(&keyval);
in the function ADIOI_cb_delete_name_array
(romio/adio/common/cb_config_list.c).
Do you have any remarks about that ?
Regards,
Pascal
-------- Message original --------
Sujet: Re: [OMPI devel] Problem with attributes attached to communicators
Date: Thu, 6 Jan 2011 13:15:14 -0500
De: George Bosilca
<bosi...@eecs.utk.edu>
Répondre à: Open MPI Developers
<de...@open-mpi.org>
Pour: Open MPI Developers
<de...@open-mpi.org>
Références:
<4d25daf9.3070...@bull.net>
MPI_Comm_create_keyval and MPI_Comm_free_keyval are the functions you should
use in order to be MPI 2.2 compliant.
Based on my understanding of the MPI standard, your application is incorrect,
and therefore the MPICH behavior is incorrect. The delete function is not there
for you to delete the keyval (!) but to delete the attribute. Here is what the
MPI standard states about this:
Note that it is not erroneous to free an attribute key that is in use, because
the actual free does not transpire until after all references (in other
communicators on the process) to the key have been freed. These references need
to be explictly freed by the program, either via calls to MPI_COMM_DELETE_ATTR
that free one attribute instance, or by calls to MPI_COMM_FREE that free all
attribute instances associated with the freed communicator.
george.
On Jan 6, 2011, at 10:08 , Pascal Deveze wrote:
I have a problem to finish the porting of ROMIO into Open MPI. It is related to
the routines MPI_Comm_dup together with MPI_Keyval_create, MPI_Keyval_free,
MPI_Attr_get and MPI_Attr_put.
Here is a simple program that reproduces my problem:
===========================================
#include <stdio.h>
#include "mpi.h"
int copy_fct(MPI_Comm comm, int keyval, void *extra, void *attr_in, void
**attr_out, int *flag) {
return MPI_SUCCESS;
}
int delete_fct(MPI_Comm comm, int keyval, void *attr_val, void *extra) {
MPI_Keyval_free(&keyval);
return MPI_SUCCESS;
}
int main(int argc, char **argv) {
int i, found, attribute_val=100, keyval = MPI_KEYVAL_INVALID;
MPI_Comm dupcomm;
MPI_Init(&argc,&argv);
for (i=0; i<100;i++) {
/* This simulates the MPI_File_open() */
if (keyval == MPI_KEYVAL_INVALID) {
MPI_Keyval_create((MPI_Copy_function *) copy_fct, (MPI_Delete_function
*) delete_fct, &keyval, NULL);
MPI_Attr_put(MPI_COMM_WORLD, keyval, &attribute_val);
MPI_Comm_dup(MPI_COMM_WORLD, &dupcomm);
}
else {
MPI_Comm_dup(MPI_COMM_WORLD, &dupcomm);
MPI_Attr_get(MPI_COMM_WORLD, keyval, (void *) &attribute_val,
&found);
}
/* This simulates the MPI_File_close() */
MPI_Comm_free(&dupcomm);
}
MPI_Finalize();
===============================================
I run it on only one process and get the error:
*** An error occurred in MPI_Attr_get
*** on communicator MPI_COMM_WORLD
*** MPI_ERR_OTHER: known error not in list
*** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)
I think this error is displayed because keyval does not exist any more.
This programm runs well on MPICH2 (ROMIO is comming with MPICH2).
This programm runs well when delete_fct() does not call MPI_Keyval_free
This programm runs well when I call MPI_Keyval_create with "MPI_NULL_COPY_FN" instead of
"(MPI_Copy_function *) copy_fct" (this is quite strange : copy_fct does nothing !).
I suspect that there could be a bug in OpenMPI: In ompi/attribute/attribute.c
two functions are calling OBJ_RELEASE: ompi_attr_delete and
ompi_attr_free_keyval. So, the
reference count is decremented twice.
Pascal
_______________________________________________
devel mailing list
de...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/devel
_______________________________________________
devel mailing list
de...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/devel