MPI Virtual File Driver

Hi

During the last few days, we (JB + I at CSCS) worked on expanding
capabilities of a DSM virtual file driver. With this driver, we write in
parallel by blocks (different datasets) to a shared memory distributed
among several processes (cf. XdmfDsmBuffer). We discovered that
originally in this driver the set_eoa function was called before every
write operation. But we don't want to have this behavior since the write
must be independent.
To fix this, we modified (JB actually) the H5FDmpi.h file to tell HDF
that our driver needs to have H5D_ALLOC_TIME_EARLY instead of
H5D_ALLOC_TIME_LATE by adding a line like:

/* Single macro to check for all file drivers that use MPI */
#define IS_H5FD_MPI(file) \
        (IS_H5FD_MPIO(file) || IS_H5FD_MPIPOSIX(file) || IS_H5FD_DSM(file))

By doing this, our driver has the behavior of an MPI driver, doing only
the set_eoa in structure creation, and it works perfectly.

Since we would prefer not to modify HDF itself, is there another way to
tell HDF that our driver is an MPI driver without modifying this file?
We use hdf5 1.6, is it something which is fixed or better handled in 1.8?

Thanks in advance.

Jerome

···

--
Jérôme Soumagne
CSCS, Swiss National Supercomputing Centre
Galleria 2, Via Cantonale | Tel: +41 (0)91 610 8258
CH-6928 Manno, Switzerland | Fax: +41 (0)91 610 8282

Hi Jerome,

···

On Aug 3, 2009, at 4:10 AM, Jerome Soumagne wrote:

Hi

During the last few days, we (JB + I at CSCS) worked on expanding
capabilities of a DSM virtual file driver. With this driver, we write in
parallel by blocks (different datasets) to a shared memory distributed
among several processes (cf. XdmfDsmBuffer). We discovered that
originally in this driver the set_eoa function was called before every
write operation. But we don't want to have this behavior since the write
must be independent.
To fix this, we modified (JB actually) the H5FDmpi.h file to tell HDF
that our driver needs to have H5D_ALLOC_TIME_EARLY instead of
H5D_ALLOC_TIME_LATE by adding a line like:

/* Single macro to check for all file drivers that use MPI */
#define IS_H5FD_MPI(file) \
       (IS_H5FD_MPIO(file) || IS_H5FD_MPIPOSIX(file) || IS_H5FD_DSM(file))

By doing this, our driver has the behavior of an MPI driver, doing only
the set_eoa in structure creation, and it works perfectly.

Since we would prefer not to modify HDF itself, is there another way to
tell HDF that our driver is an MPI driver without modifying this file?
We use hdf5 1.6, is it something which is fixed or better handled in 1.8?

  Hmm, interesting problem... I'm guessing that this could be addressed by extending the flags that the VFD 'query' callback checks for with a "Allocate Data Storage Early" flag in addition to the others defined. How's that sound to you?

  Quincey

Quincey

Hmm, interesting problem... I'm guessing that this could be addressed by extending the flags that the VFD 'query' callback checks for with a "Allocate Data Storage Early" flag in addition to the others defined. How's that sound to you?

There are actually several places dotted throughout the source where the macro below is used.
#define IS_H5FD_MPI(file) \
       (IS_H5FD_MPIO(file) || IS_H5FD_MPIPOSIX(file) || IS_H5FD_DSM(file))
We may discover that if the macro is replaced with a Flag (ALLOC_EARLY/LATE) set in the driver/dataset features struct, that other breakages may occur. It may be worthwhile to add a flag for the ALLOC, but also one for IS_MPI_DRIVER so that other places wheere the macro is used can be changed appropriately.

[Actually, Since a non-mpi driver uses a struct of the H5FD_class_t variety, and an mpi based driver uses a H5FD_class_mpi_t struct, the information (is MPI=yes/no?) needed by HDF is actually already there, perhaps some typoe check would suffice].

JB

···

--
John Biddiscombe, email:biddisco @ cscs.ch


CSCS, Swiss National Supercomputing Centre | Tel: +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82

Hi John,

Quincey

Hmm, interesting problem... I'm guessing that this could be addressed by extending the flags that the VFD 'query' callback checks for with a "Allocate Data Storage Early" flag in addition to the others defined. How's that sound to you?

There are actually several places dotted throughout the source where the macro below is used.
#define IS_H5FD_MPI(file) \
     (IS_H5FD_MPIO(file) || IS_H5FD_MPIPOSIX(file) || IS_H5FD_DSM(file))
We may discover that if the macro is replaced with a Flag (ALLOC_EARLY/LATE) set in the driver/dataset features struct, that other breakages may occur. It may be worthwhile to add a flag for the ALLOC, but also one for IS_MPI_DRIVER so that other places wheere the macro is used can be changed appropriately.

  Yes, I agree. I think we'll have to audit the locations where the IS_H5FD_MPI() macro is used and determine the meaning behind each and then come up with flags that categorize the behaviors desired. I'll add an item in our issue tracker for this.

[Actually, Since a non-mpi driver uses a struct of the H5FD_class_t variety, and an mpi based driver uses a H5FD_class_mpi_t struct, the information (is MPI=yes/no?) needed by HDF is actually already there, perhaps some typoe check would suffice].

  That structure has changed in the 1.8 release, so I don't think that's sufficient.

  Quincey

···

On Aug 4, 2009, at 2:47 AM, John Biddiscombe wrote:

Quincey

I have been though the code, locating all the places that the macro IS_H5FD_MPI() is used and there are two categories of usage
1) is this an MPI driver (I need communicators or some other information that is based on a yes/no result)
2) Does this driver need ALLOCATE_EARLY

category 1) may in fact consist of sub categories, but I'm not familiar enough with the code to have deciphered the intention, but for my current purposes ...

I have added new Feature keys to H5FDpublic.h
  #define H5FD_FEAT_HAS_MPI 0x00000080
  #define H5FD_FEAT_ALLOCATE_EARLY 0x00000100

and I've gone through every place where the old IS_H5FD_MPI macro was used and replaced the check with either H5F_HAS_FEATURE(x, H5FD_FEAT_HAS_MPI) or H5F_HAS_FEATURE(x, H5FD_FEAT_ALLOCATE_EARLY).

There are still a couple of places where IS_H5FD_MPIO and IS_H5FD_MPIPOSIX are used. I am suspicious of them, but have not changed them.

I have applied the changes to my local branch of the hdf5-v18 git repository and would be immensely grateful if the changes could be picked up in time for the next patch or full release of the 1.8 library.

Attached is a patch which addresses the issue and solves one of my current problems. I'm not yet expert enough with git to know if this is a complete patch which can be applied 'as is', but I could apply my changes to the 1.8.4 git repository that we have setup and are working on.

If this is acceptable, I have another patch request, which I'll ask about at a future date.

JB

vfd-patch (9.14 KB)

···

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of Quincey Koziol
Sent: 04 August 2009 15:11
To: hdf-forum@hdfgroup.org
Subject: Re: [Hdf-forum] MPI Virtual File Driver

Hi John,

On Aug 4, 2009, at 2:47 AM, John Biddiscombe wrote:

> Quincey
>> Hmm, interesting problem... I'm guessing that this could be
>> addressed by extending the flags that the VFD 'query' callback
>> checks for with a "Allocate Data Storage Early" flag in addition to
>> the others defined. How's that sound to you?
>
> There are actually several places dotted throughout the source where
> the macro below is used.
> #define IS_H5FD_MPI(file) \
> (IS_H5FD_MPIO(file) || IS_H5FD_MPIPOSIX(file) ||
> IS_H5FD_DSM(file))
> We may discover that if the macro is replaced with a Flag
> (ALLOC_EARLY/LATE) set in the driver/dataset features struct, that
> other breakages may occur. It may be worthwhile to add a flag for
> the ALLOC, but also one for IS_MPI_DRIVER so that other places
> wheere the macro is used can be changed appropriately.

  Yes, I agree. I think we'll have to audit the locations where the
IS_H5FD_MPI() macro is used and determine the meaning behind each and
then come up with flags that categorize the behaviors desired. I'll
add an item in our issue tracker for this.

> [Actually, Since a non-mpi driver uses a struct of the H5FD_class_t
> variety, and an mpi based driver uses a H5FD_class_mpi_t struct, the
> information (is MPI=yes/no?) needed by HDF is actually already
> there, perhaps some typoe check would suffice].

  That structure has changed in the 1.8 release, so I don't think
that's sufficient.

  Quincey

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Hi John,
  Thanks for the patch, I'll try to review it tomorrow and let you know any feedback I have.

  Quincey

···

On Nov 30, 2009, at 8:39 AM, Biddiscombe, John A. wrote:

Quincey

I have been though the code, locating all the places that the macro IS_H5FD_MPI() is used and there are two categories of usage
1) is this an MPI driver (I need communicators or some other information that is based on a yes/no result)
2) Does this driver need ALLOCATE_EARLY

category 1) may in fact consist of sub categories, but I'm not familiar enough with the code to have deciphered the intention, but for my current purposes ...

I have added new Feature keys to H5FDpublic.h
  #define H5FD_FEAT_HAS_MPI 0x00000080
  #define H5FD_FEAT_ALLOCATE_EARLY 0x00000100

and I've gone through every place where the old IS_H5FD_MPI macro was used and replaced the check with either H5F_HAS_FEATURE(x, H5FD_FEAT_HAS_MPI) or H5F_HAS_FEATURE(x, H5FD_FEAT_ALLOCATE_EARLY).

There are still a couple of places where IS_H5FD_MPIO and IS_H5FD_MPIPOSIX are used. I am suspicious of them, but have not changed them.

I have applied the changes to my local branch of the hdf5-v18 git repository and would be immensely grateful if the changes could be picked up in time for the next patch or full release of the 1.8 library.

Attached is a patch which addresses the issue and solves one of my current problems. I'm not yet expert enough with git to know if this is a complete patch which can be applied 'as is', but I could apply my changes to the 1.8.4 git repository that we have setup and are working on.

If this is acceptable, I have another patch request, which I'll ask about at a future date.

JB

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of Quincey Koziol
Sent: 04 August 2009 15:11
To: hdf-forum@hdfgroup.org
Subject: Re: [Hdf-forum] MPI Virtual File Driver

Hi John,

On Aug 4, 2009, at 2:47 AM, John Biddiscombe wrote:

Quincey

Hmm, interesting problem... I'm guessing that this could be
addressed by extending the flags that the VFD 'query' callback
checks for with a "Allocate Data Storage Early" flag in addition to
the others defined. How's that sound to you?

There are actually several places dotted throughout the source where
the macro below is used.
#define IS_H5FD_MPI(file) \
    (IS_H5FD_MPIO(file) || IS_H5FD_MPIPOSIX(file) ||
IS_H5FD_DSM(file))
We may discover that if the macro is replaced with a Flag
(ALLOC_EARLY/LATE) set in the driver/dataset features struct, that
other breakages may occur. It may be worthwhile to add a flag for
the ALLOC, but also one for IS_MPI_DRIVER so that other places
wheere the macro is used can be changed appropriately.

  Yes, I agree. I think we'll have to audit the locations where the
IS_H5FD_MPI() macro is used and determine the meaning behind each and
then come up with flags that categorize the behaviors desired. I'll
add an item in our issue tracker for this.

[Actually, Since a non-mpi driver uses a struct of the H5FD_class_t
variety, and an mpi based driver uses a H5FD_class_mpi_t struct, the
information (is MPI=yes/no?) needed by HDF is actually already
there, perhaps some typoe check would suffice].

  That structure has changed in the 1.8 release, so I don't think
that's sufficient.

  Quincey

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

<vfd-patch>_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Quincey

I ran tests and found that my patch caused some to fail. It turned out I cut'n'pasted badly when I added the feature flags checks. I've fixed the problem and now all tests (that pass with the original) now pass with the modified source.

Please find attached the correct patch, should you get time to look at it.

thanks

JB

patch.txt (8.78 KB)

···

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of Quincey Koziol
Sent: 01 December 2009 15:35
To: hdf-forum@hdfgroup.org
Subject: Re: [Hdf-forum] MPI Virtual File Driver

Hi John,
  Thanks for the patch, I'll try to review it tomorrow and let you know
any feedback I have.

  Quincey

On Nov 30, 2009, at 8:39 AM, Biddiscombe, John A. wrote:

> Quincey
>
> I have been though the code, locating all the places that the macro
IS_H5FD_MPI() is used and there are two categories of usage
> 1) is this an MPI driver (I need communicators or some other information
that is based on a yes/no result)
> 2) Does this driver need ALLOCATE_EARLY
>
> category 1) may in fact consist of sub categories, but I'm not familiar
enough with the code to have deciphered the intention, but for my current
purposes ...
>
> I have added new Feature keys to H5FDpublic.h
> #define H5FD_FEAT_HAS_MPI 0x00000080
> #define H5FD_FEAT_ALLOCATE_EARLY 0x00000100
>
> and I've gone through every place where the old IS_H5FD_MPI macro was used
and replaced the check with either H5F_HAS_FEATURE(x, H5FD_FEAT_HAS_MPI) or
H5F_HAS_FEATURE(x, H5FD_FEAT_ALLOCATE_EARLY).
>
> There are still a couple of places where IS_H5FD_MPIO and IS_H5FD_MPIPOSIX
are used. I am suspicious of them, but have not changed them.
>
> I have applied the changes to my local branch of the hdf5-v18 git
repository and would be immensely grateful if the changes could be picked up
in time for the next patch or full release of the 1.8 library.
>
> Attached is a patch which addresses the issue and solves one of my current
problems. I'm not yet expert enough with git to know if this is a complete
patch which can be applied 'as is', but I could apply my changes to the
1.8.4 git repository that we have setup and are working on.
>
> If this is acceptable, I have another patch request, which I'll ask about
at a future date.
>
> JB
>
>
>> -----Original Message-----
>> From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-
bounces@hdfgroup.org]
>> On Behalf Of Quincey Koziol
>> Sent: 04 August 2009 15:11
>> To: hdf-forum@hdfgroup.org
>> Subject: Re: [Hdf-forum] MPI Virtual File Driver
>>
>> Hi John,
>>
>> On Aug 4, 2009, at 2:47 AM, John Biddiscombe wrote:
>>
>>> Quincey
>>>> Hmm, interesting problem... I'm guessing that this could be
>>>> addressed by extending the flags that the VFD 'query' callback
>>>> checks for with a "Allocate Data Storage Early" flag in addition to
>>>> the others defined. How's that sound to you?
>>>
>>> There are actually several places dotted throughout the source where
>>> the macro below is used.
>>> #define IS_H5FD_MPI(file) \
>>> (IS_H5FD_MPIO(file) || IS_H5FD_MPIPOSIX(file) ||
>>> IS_H5FD_DSM(file))
>>> We may discover that if the macro is replaced with a Flag
>>> (ALLOC_EARLY/LATE) set in the driver/dataset features struct, that
>>> other breakages may occur. It may be worthwhile to add a flag for
>>> the ALLOC, but also one for IS_MPI_DRIVER so that other places
>>> wheere the macro is used can be changed appropriately.
>>
>> Yes, I agree. I think we'll have to audit the locations where the
>> IS_H5FD_MPI() macro is used and determine the meaning behind each and
>> then come up with flags that categorize the behaviors desired. I'll
>> add an item in our issue tracker for this.
>>
>>> [Actually, Since a non-mpi driver uses a struct of the H5FD_class_t
>>> variety, and an mpi based driver uses a H5FD_class_mpi_t struct, the
>>> information (is MPI=yes/no?) needed by HDF is actually already
>>> there, perhaps some typoe check would suffice].
>>
>> That structure has changed in the 1.8 release, so I don't think
>> that's sufficient.
>>
>> Quincey
>>
>>
>> _______________________________________________
>> Hdf-forum is for HDF software users discussion.
>> Hdf-forum@hdfgroup.org
>> http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
> <vfd-patch>_______________________________________________
> Hdf-forum is for HDF software users discussion.
> Hdf-forum@hdfgroup.org
> http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Hi John,

Quincey

I ran tests and found that my patch caused some to fail. It turned out I cut'n'pasted badly when I added the feature flags checks. I've fixed the problem and now all tests (that pass with the original) now pass with the modified source.

Please find attached the correct patch, should you get time to look at it.

  Thanks for the corrections. I'm working on getting a "real" policy for accepting patches into place internally and then I'll get the code into the repository. Along those lines, can you check if there will be any difficulties on your side getting an intellectual property release for assigning ownership of your changes to the HDF Group?

  Quincey

···

On Dec 4, 2009, at 7:49 AM, Biddiscombe, John A. wrote:

thanks

JB

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of Quincey Koziol
Sent: 01 December 2009 15:35
To: hdf-forum@hdfgroup.org
Subject: Re: [Hdf-forum] MPI Virtual File Driver

Hi John,
  Thanks for the patch, I'll try to review it tomorrow and let you know
any feedback I have.

  Quincey

On Nov 30, 2009, at 8:39 AM, Biddiscombe, John A. wrote:

Quincey

I have been though the code, locating all the places that the macro

IS_H5FD_MPI() is used and there are two categories of usage

1) is this an MPI driver (I need communicators or some other information

that is based on a yes/no result)

2) Does this driver need ALLOCATE_EARLY

category 1) may in fact consist of sub categories, but I'm not familiar

enough with the code to have deciphered the intention, but for my current
purposes ...

I have added new Feature keys to H5FDpublic.h
  #define H5FD_FEAT_HAS_MPI 0x00000080
  #define H5FD_FEAT_ALLOCATE_EARLY 0x00000100

and I've gone through every place where the old IS_H5FD_MPI macro was used

and replaced the check with either H5F_HAS_FEATURE(x, H5FD_FEAT_HAS_MPI) or
H5F_HAS_FEATURE(x, H5FD_FEAT_ALLOCATE_EARLY).

There are still a couple of places where IS_H5FD_MPIO and IS_H5FD_MPIPOSIX

are used. I am suspicious of them, but have not changed them.

I have applied the changes to my local branch of the hdf5-v18 git

repository and would be immensely grateful if the changes could be picked up
in time for the next patch or full release of the 1.8 library.

Attached is a patch which addresses the issue and solves one of my current

problems. I'm not yet expert enough with git to know if this is a complete
patch which can be applied 'as is', but I could apply my changes to the
1.8.4 git repository that we have setup and are working on.

If this is acceptable, I have another patch request, which I'll ask about

at a future date.

JB

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-

bounces@hdfgroup.org]

On Behalf Of Quincey Koziol
Sent: 04 August 2009 15:11
To: hdf-forum@hdfgroup.org
Subject: Re: [Hdf-forum] MPI Virtual File Driver

Hi John,

On Aug 4, 2009, at 2:47 AM, John Biddiscombe wrote:

Quincey

Hmm, interesting problem... I'm guessing that this could be
addressed by extending the flags that the VFD 'query' callback
checks for with a "Allocate Data Storage Early" flag in addition to
the others defined. How's that sound to you?

There are actually several places dotted throughout the source where
the macro below is used.
#define IS_H5FD_MPI(file) \
   (IS_H5FD_MPIO(file) || IS_H5FD_MPIPOSIX(file) ||
IS_H5FD_DSM(file))
We may discover that if the macro is replaced with a Flag
(ALLOC_EARLY/LATE) set in the driver/dataset features struct, that
other breakages may occur. It may be worthwhile to add a flag for
the ALLOC, but also one for IS_MPI_DRIVER so that other places
wheere the macro is used can be changed appropriately.

  Yes, I agree. I think we'll have to audit the locations where the
IS_H5FD_MPI() macro is used and determine the meaning behind each and
then come up with flags that categorize the behaviors desired. I'll
add an item in our issue tracker for this.

[Actually, Since a non-mpi driver uses a struct of the H5FD_class_t
variety, and an mpi based driver uses a H5FD_class_mpi_t struct, the
information (is MPI=yes/no?) needed by HDF is actually already
there, perhaps some typoe check would suffice].

  That structure has changed in the 1.8 release, so I don't think
that's sufficient.

  Quincey

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

<vfd-patch>_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

<patch.txt>_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Quincey

  Thanks for the corrections. I'm working on getting a "real" policy
for accepting patches into place internally and then I'll get the code into
the repository. Along those lines, can you check if there will be any
difficulties on your side getting an intellectual property release for
assigning ownership of your changes to the HDF Group?

There is no difficulty transferring IP for the patches. Please consider them yours to use as you wish.

···

====

With regard to the VFD interface. We are using a custom driver (Originally from Jerry Clarke) implementing a DSM interface, all is well except that we must compile the driver into the HDF source code due to the MPI hooks etc. The patch you already have removes most of the need for this, but there is one place left, which is in

int H5FD_term_interface(void) {
....
#ifdef H5_HAVE_DSM
                H5FD_dsm_term();
#endif
...
}

where we have added the 3 lines above.

In fact the only thing that the H5FD_dsm_term call does is set

// The driver identification number, initialized at runtime
static hid_t H5FD_DSM_g = 0;

to zero so that any future attempts to reference it will trigger the init code once again if necessary and not try to use a handle that has been destroyed.

As far as I can determine, the only time that the H5fd_term_interface function is called is when H5close is called. At this point, all the handles to file drivers are closed, and each driver has it's terminate function called, which sets this variable back to zero.

If I could remove this one function from H5FD.c, then it would be possible to supply a completely user defined file driver, without need to modify the core sources at all.

The trouble is the obvious thing to do is ...
Add a function to the file driver class struct, which would be called during H5FD_term_interface to set the static H5FD_DSM_g to zero - but we can't do this, because when we reach the point in H5FD_term_interface where H5FD_dsm_term() is called, the handle to the driver has already been closed, and we've invalidate the memory, so the function pointer to callback is not valid.

One idea that occurred to me is that since each driver maintains a static handle of the type
static hid_t H5FD_DSM_g = 0; or
static hid_t H5FD_MPIO_g = 0; or
then the address of this global file driver storage handle could be passed as a member of the main driver class structure, and it could be set to zero by the H5FD code itself. This would then remove the need for the cleanup which is at present in H5FD.c.

#ifdef H5_HAVE_DIRECT
                H5FD_direct_term();
#endif
                H5FD_log_term();
                H5FD_stdio_term();
#ifdef H5_HAVE_WINDOWS
                H5FD_windows_term();
#endif
                H5FD_family_term();
                H5FD_core_term();
                H5FD_multi_term();
#ifdef H5_HAVE_PARALLEL
                H5FD_mpio_term();
                H5FD_mpiposix_term();
#ifdef H5_HAVE_DSM
                H5FD_dsm_term(); <- our extra one
#endif
#endif /* H5_HAVE_PARALLEL */

I don't know if there is ever a need for the library to maintain more than one handle to a particular file driver. I have a suspicion that the use of static vars like H5_DSM_g and H5_MPIO_g means that only one is ever maintained at a time. If this is the case, then separating these global/static handles out and passing in the global handle would work alright - though quite when to zero it out is not yet obvious to me, (the handles seem to be freed in a call to H5I_clear_type, but this handles handles of al types and not just file drivers, so how we know to zero out the var requires thought).

Anyway. I am looking for a way to cleanly clear up the driver interface, and open/close repeatedly the handles etc, without causing problems or requiring the driver to be linked in. If you have suggestions, please make them and I'll see if I can create a patch.

thanks

JB

Any thoughts from "The HDFGroup" about having your bug tracker and SCM
repository at least readable from the internet? Might make accepting
patches a bit easier, or maybe setting up an official git mirror of
your internal SCM somewhere like gitorious or github?

···

_________________________________________________________
Mike Jackson mike.jackson@bluequartz.net

On Fri, Dec 4, 2009 at 11:21 AM, Quincey Koziol <koziol@hdfgroup.org> wrote:

Hi John,

On Dec 4, 2009, at 7:49 AM, Biddiscombe, John A. wrote:

Quincey

I ran tests and found that my patch caused some to fail. It turned out I cut'n'pasted badly when I added the feature flags checks. I've fixed the problem and now all tests (that pass with the original) now pass with the modified source.

Please find attached the correct patch, should you get time to look at it.

   Thanks for the corrections\.  I&#39;m working on getting a &quot;real&quot; policy for accepting patches into place internally and then I&#39;ll get the code into the repository\.  Along those lines, can you check if there will be any difficulties on your side getting an intellectual property release for assigning ownership of your changes to the HDF Group?

   Quincey

thanks

JB

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of Quincey Koziol
Sent: 01 December 2009 15:35
To: hdf-forum@hdfgroup.org
Subject: Re: [Hdf-forum] MPI Virtual File Driver

Hi John,
Thanks for the patch, I'll try to review it tomorrow and let you know
any feedback I have.

 Quincey

On Nov 30, 2009, at 8:39 AM, Biddiscombe, John A. wrote:

Quincey

I have been though the code, locating all the places that the macro

IS_H5FD_MPI() is used and there are two categories of usage

1) is this an MPI driver (I need communicators or some other information

that is based on a yes/no result)

2) Does this driver need ALLOCATE_EARLY

category 1) may in fact consist of sub categories, but I'm not familiar

enough with the code to have deciphered the intention, but for my current
purposes ...

I have added new Feature keys to H5FDpublic.h
#define H5FD_FEAT_HAS_MPI 0x00000080
#define H5FD_FEAT_ALLOCATE_EARLY 0x00000100

and I've gone through every place where the old IS_H5FD_MPI macro was used

and replaced the check with either H5F_HAS_FEATURE(x, H5FD_FEAT_HAS_MPI) or
H5F_HAS_FEATURE(x, H5FD_FEAT_ALLOCATE_EARLY).

There are still a couple of places where IS_H5FD_MPIO and IS_H5FD_MPIPOSIX

are used. I am suspicious of them, but have not changed them.

I have applied the changes to my local branch of the hdf5-v18 git

repository and would be immensely grateful if the changes could be picked up
in time for the next patch or full release of the 1.8 library.

Attached is a patch which addresses the issue and solves one of my current

problems. I'm not yet expert enough with git to know if this is a complete
patch which can be applied 'as is', but I could apply my changes to the
1.8.4 git repository that we have setup and are working on.

If this is acceptable, I have another patch request, which I'll ask about

at a future date.

JB

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-

bounces@hdfgroup.org]

On Behalf Of Quincey Koziol
Sent: 04 August 2009 15:11
To: hdf-forum@hdfgroup.org
Subject: Re: [Hdf-forum] MPI Virtual File Driver

Hi John,

On Aug 4, 2009, at 2:47 AM, John Biddiscombe wrote:

Quincey

Hmm, interesting problem... I'm guessing that this could be
addressed by extending the flags that the VFD 'query' callback
checks for with a "Allocate Data Storage Early" flag in addition to
the others defined. How's that sound to you?

There are actually several places dotted throughout the source where
the macro below is used.
#define IS_H5FD_MPI(file) \
(IS_H5FD_MPIO(file) || IS_H5FD_MPIPOSIX(file) ||
IS_H5FD_DSM(file))
We may discover that if the macro is replaced with a Flag
(ALLOC_EARLY/LATE) set in the driver/dataset features struct, that
other breakages may occur. It may be worthwhile to add a flag for
the ALLOC, but also one for IS_MPI_DRIVER so that other places
wheere the macro is used can be changed appropriately.

Yes, I agree. I think we'll have to audit the locations where the
IS_H5FD_MPI() macro is used and determine the meaning behind each and
then come up with flags that categorize the behaviors desired. I'll
add an item in our issue tracker for this.

[Actually, Since a non-mpi driver uses a struct of the H5FD_class_t
variety, and an mpi based driver uses a H5FD_class_mpi_t struct, the
information (is MPI=yes/no?) needed by HDF is actually already
there, perhaps some typoe check would suffice].

That structure has changed in the 1.8 release, so I don't think
that's sufficient.

Quincey

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

<vfd-patch>_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

<patch.txt>_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Mike and All,

Thank you for your excellent questions.

We have been considering different options for improving the way we work with this wonderful community, and access to our SVN and bug tracker database are among them. gitorious or github indeed look like very interesting tools and could be very helpful. Other suggestions are more than welcome!

About accepting patches: we appreciate very much the patches our users provide and try to do our best to incorporate the changes in a timely manner.

Unfortunately incorporating patches sometimes takes more time than desired, or cannot be done at all. Patches require a substantial effort from our group; it is NOT just a 5-minutes task to apply submitted diffs. We need to make sure that patch is correct, portable, maintainable and written according to our internal standards, to name a few. When we receive a patch (or any other bug report), we carefully consider it and prioritize it. Data corruption bugs and backward/forward compatibility bugs have the highest priority. The rest of the requests are prioritized according to many factors, and our contractual obligations are among them.

We hope that better documentation, and availability of the documents (many of them to be written :wink: on "How can I help with the HDF5 software testing and porting?", "How to submit a patch?", "How to report a bug?", "Software engineering at The HDF Group", "HDF5 coding standards", "HDF5 configure explained", etc,. will help to address the issues discussed on this forum and will help The HDF Group to be more efficient in its work with the community.

We hope we can get some very good ideas on what is required for the community to be more involved with the HDF5 development and maintenance from the Cmake work that is under way.

Thank you and have a wonderful weekend!

Elena

Will go under my official title this time :wink:

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal
Director of Technical Services and Operations
The HDF Group
1901 S. First St., Suite C-2
Champaign, IL 61820


(217)333-0238 (office)
(217)333-9049 (fax)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Any thoughts from "The HDFGroup" about having your bug tracker and SCM
repository at least readable from the internet? Might make accepting
patches a bit easier, or maybe setting up an official git mirror of
your internal SCM somewhere like gitorious or github?

_________________________________________________________
Mike Jackson mike.jackson@bluequartz.net

On Fri, Dec 4, 2009 at 11:21 AM, Quincey Koziol <koziol@hdfgroup.org> wrote:

Hi John,

On Dec 4, 2009, at 7:49 AM, Biddiscombe, John A. wrote:

Quincey

I ran tests and found that my patch caused some to fail. It turned out I cut'n'pasted badly when I added the feature flags checks. I've fixed the problem and now all tests (that pass with the original) now pass with the modified source.

Please find attached the correct patch, should you get time to look at it.

       Thanks for the corrections. I'm working on getting a "real" policy for accepting patches into place internally and then I'll get the code into the repository. Along those lines, can you check if there will be any difficulties on your side getting an intellectual property release for assigning ownership of your changes to the HDF Group?

       Quincey

thanks

JB

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of Quincey Koziol
Sent: 01 December 2009 15:35
To: hdf-forum@hdfgroup.org
Subject: Re: [Hdf-forum] MPI Virtual File Driver

Hi John,
     Thanks for the patch, I'll try to review it tomorrow and let you know
any feedback I have.

     Quincey

On Nov 30, 2009, at 8:39 AM, Biddiscombe, John A. wrote:

Quincey

I have been though the code, locating all the places that the macro

IS_H5FD_MPI() is used and there are two categories of usage

1) is this an MPI driver (I need communicators or some other information

that is based on a yes/no result)

2) Does this driver need ALLOCATE_EARLY

category 1) may in fact consist of sub categories, but I'm not familiar

enough with the code to have deciphered the intention, but for my current
purposes ...

I have added new Feature keys to H5FDpublic.h
    #define H5FD_FEAT_HAS_MPI 0x00000080
    #define H5FD_FEAT_ALLOCATE_EARLY 0x00000100

and I've gone through every place where the old IS_H5FD_MPI macro was used

and replaced the check with either H5F_HAS_FEATURE(x, H5FD_FEAT_HAS_MPI) or
H5F_HAS_FEATURE(x, H5FD_FEAT_ALLOCATE_EARLY).

There are still a couple of places where IS_H5FD_MPIO and IS_H5FD_MPIPOSIX

are used. I am suspicious of them, but have not changed them.

I have applied the changes to my local branch of the hdf5-v18 git

repository and would be immensely grateful if the changes could be picked up
in time for the next patch or full release of the 1.8 library.

Attached is a patch which addresses the issue and solves one of my current

problems. I'm not yet expert enough with git to know if this is a complete
patch which can be applied 'as is', but I could apply my changes to the
1.8.4 git repository that we have setup and are working on.

If this is acceptable, I have another patch request, which I'll ask about

at a future date.

JB

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-

bounces@hdfgroup.org]

On Behalf Of Quincey Koziol
Sent: 04 August 2009 15:11
To: hdf-forum@hdfgroup.org
Subject: Re: [Hdf-forum] MPI Virtual File Driver

Hi John,

On Aug 4, 2009, at 2:47 AM, John Biddiscombe wrote:

Quincey

Hmm, interesting problem... I'm guessing that this could be
addressed by extending the flags that the VFD 'query' callback
checks for with a "Allocate Data Storage Early" flag in addition to
the others defined. How's that sound to you?

There are actually several places dotted throughout the source where
the macro below is used.
#define IS_H5FD_MPI(file) \
   (IS_H5FD_MPIO(file) || IS_H5FD_MPIPOSIX(file) ||
IS_H5FD_DSM(file))
We may discover that if the macro is replaced with a Flag
(ALLOC_EARLY/LATE) set in the driver/dataset features struct, that
other breakages may occur. It may be worthwhile to add a flag for
the ALLOC, but also one for IS_MPI_DRIVER so that other places
wheere the macro is used can be changed appropriately.

   Yes, I agree. I think we'll have to audit the locations where the
IS_H5FD_MPI() macro is used and determine the meaning behind each and
then come up with flags that categorize the behaviors desired. I'll
add an item in our issue tracker for this.

[Actually, Since a non-mpi driver uses a struct of the H5FD_class_t
variety, and an mpi based driver uses a H5FD_class_mpi_t struct, the
information (is MPI=yes/no?) needed by HDF is actually already
there, perhaps some typoe check would suffice].

   That structure has changed in the 1.8 release, so I don't think
that's sufficient.

   Quincey

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

<vfd-patch>_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

<patch.txt>_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Hi John,

Quincey

  Thanks for the corrections. I'm working on getting a "real" policy
for accepting patches into place internally and then I'll get the code into
the repository. Along those lines, can you check if there will be any
difficulties on your side getting an intellectual property release for
assigning ownership of your changes to the HDF Group?

There is no difficulty transferring IP for the patches. Please consider them yours to use as you wish.

  OK, when we've got a draft of the IP transfer process ready I'll send you the form to sign & return.

====

With regard to the VFD interface. We are using a custom driver (Originally from Jerry Clarke) implementing a DSM interface, all is well except that we must compile the driver into the HDF source code due to the MPI hooks etc. The patch you already have removes most of the need for this, but there is one place left, which is in

int H5FD_term_interface(void) {
....
#ifdef H5_HAVE_DSM
               H5FD_dsm_term();
#endif
...
}

where we have added the 3 lines above.

In fact the only thing that the H5FD_dsm_term call does is set

// The driver identification number, initialized at runtime
static hid_t H5FD_DSM_g = 0;

to zero so that any future attempts to reference it will trigger the init code once again if necessary and not try to use a handle that has been destroyed.

As far as I can determine, the only time that the H5fd_term_interface function is called is when H5close is called. At this point, all the handles to file drivers are closed, and each driver has it's terminate function called, which sets this variable back to zero.

If I could remove this one function from H5FD.c, then it would be possible to supply a completely user defined file driver, without need to modify the core sources at all.

  That's the goal with the VFD interface, so we want to help you move in that direction.

The trouble is the obvious thing to do is ...
Add a function to the file driver class struct, which would be called during H5FD_term_interface to set the static H5FD_DSM_g to zero - but we can't do this, because when we reach the point in H5FD_term_interface where H5FD_dsm_term() is called, the handle to the driver has already been closed, and we've invalidate the memory, so the function pointer to callback is not valid.

  That's the right solution, yes. We can change the order that the interfaces are shut down at library termination so this problem doesn't happen.

One idea that occurred to me is that since each driver maintains a static handle of the type
static hid_t H5FD_DSM_g = 0; or
static hid_t H5FD_MPIO_g = 0; or
then the address of this global file driver storage handle could be passed as a member of the main driver class structure, and it could be set to zero by the H5FD code itself. This would then remove the need for the cleanup which is at present in H5FD.c.

#ifdef H5_HAVE_DIRECT
               H5FD_direct_term();
#endif
               H5FD_log_term();
               H5FD_stdio_term();
#ifdef H5_HAVE_WINDOWS
               H5FD_windows_term();
#endif
               H5FD_family_term();
               H5FD_core_term();
               H5FD_multi_term();
#ifdef H5_HAVE_PARALLEL
               H5FD_mpio_term();
               H5FD_mpiposix_term();
#ifdef H5_HAVE_DSM
               H5FD_dsm_term(); <- our extra one
#endif
#endif /* H5_HAVE_PARALLEL */

I don't know if there is ever a need for the library to maintain more than one handle to a particular file driver. I have a suspicion that the use of static vars like H5_DSM_g and H5_MPIO_g means that only one is ever maintained at a time. If this is the case, then separating these global/static handles out and passing in the global handle would work alright - though quite when to zero it out is not yet obvious to me, (the handles seem to be freed in a call to H5I_clear_type, but this handles handles of al types and not just file drivers, so how we know to zero out the var requires thought).

Anyway. I am looking for a way to cleanly clear up the driver interface, and open/close repeatedly the handles etc, without causing problems or requiring the driver to be linked in. If you have suggestions, please make them and I'll see if I can create a patch.

  As you say, this way is prone to difficulty.

  I'd lean toward adding a new VFD 'term' callback to the H5FD_class_t (in the 1.10.0 release) and adjusting the way the library shuts down, so that it gets invoked at the correct time. If you'd like to look into providing a patch for this, you can look at the H5_term_library() code in src/H5.c and decide if the order of the interface shutdowns needs to change (or maybe a new shutdown call needs to be inserted).

  Thanks,
    Quincey

···

On Dec 4, 2009, at 10:56 AM, Biddiscombe, John A. wrote:

Quicey

> Add a function to the file driver class struct, which would be called
during H5FD_term_interface to set the static H5FD_DSM_g to zero - but we
can't do this, because when we reach the point in H5FD_term_interface where
H5FD_dsm_term() is called, the handle to the driver has already been closed,
and we've invalidate the memory, so the function pointer to callback is not
valid.

  That's the right solution, yes. We can change the order that the
interfaces are shut down at library termination so this problem doesn't
happen.

I've added a terminate function pointer to the H5FD_class_t structure and modified all the file drivers accordingly. All is well.

However, H5_term_library iterates over all the libraries and shuts them down, when H5FD is closed down, the handles outstanding are counted up and iterated over and the reference counts checked to ensure they're safe to delete.
When the ref count is 1, and it's safe to delete the handle, the handle->free function is called. In the case of the H5I_VFL handle type, the H5FD_class_t free function is called, and the class object is freed - along with all the function pointers it holds.
We must therefore call our FD class terminate function just before this point, so what I've done is added the following to H5I.c inside the H5I_clear_type(...) function.

// If our object is a Virtual File Driver class, then before destroying it,
// we must tell the driver to clean up its singleton(s)
if (type==H5I_VFL) {
  H5FD_class_t *cls = (H5FD_class_t *)(cur->obj_ptr);
  if (cls && cls->terminate) cls->terminate();
}

This seems to work nicely. The terminate function is called immediately before the class structure is freed, and everyone is happy. (Note that the H5FD_class_t free function doesn't do much, could we tag our terminate inside that to save one callback?)

The trouble is, that I have no idea if this is a 'good' solution. My knowledge of the rest of the HDF5 internals is still minimal, so if this has other side effects I don't know. It seems to work and have no downside (other than an otherwise irrelevant check in every single call to H5I_clear_type - frequently called?).

Inside H5FD.c there is no longer any need for the code (below) because the term functions for each driver have been called during the H5I cleaning. File drivers can now be independent and linked in at run time.

I welcome your thoughts.

JB

···

=======
            /* Reset the VFL drivers, if they've been closed */
            if(H5I_nmembers(H5I_VFL)==0) {
                H5FD_sec2_term();
#ifdef H5_HAVE_DIRECT
                H5FD_direct_term();
#endif
                H5FD_log_term();
                H5FD_stdio_term();
#ifdef H5_HAVE_WINDOWS
                H5FD_windows_term();
#endif
                H5FD_family_term();
                H5FD_core_term();
                H5FD_multi_term();
#ifdef H5_HAVE_PARALLEL
                H5FD_mpio_term();
                H5FD_mpiposix_term();
#ifdef H5_HAVE_DSM
                H5FD_dsm_term();
#endif

Hi John,

Quincey

Add a function to the file driver class struct, which would be called

during H5FD_term_interface to set the static H5FD_DSM_g to zero - but we
can't do this, because when we reach the point in H5FD_term_interface where
H5FD_dsm_term() is called, the handle to the driver has already been closed,
and we've invalidate the memory, so the function pointer to callback is not
valid.

  That's the right solution, yes. We can change the order that the
interfaces are shut down at library termination so this problem doesn't
happen.

I've added a terminate function pointer to the H5FD_class_t structure and modified all the file drivers accordingly. All is well.

  Super!

However, H5_term_library iterates over all the libraries and shuts them down, when H5FD is closed down, the handles outstanding are counted up and iterated over and the reference counts checked to ensure they're safe to delete.
When the ref count is 1, and it's safe to delete the handle, the handle->free function is called. In the case of the H5I_VFL handle type, the H5FD_class_t free function is called, and the class object is freed - along with all the function pointers it holds.
We must therefore call our FD class terminate function just before this point, so what I've done is added the following to H5I.c inside the H5I_clear_type(...) function.

// If our object is a Virtual File Driver class, then before destroying it,
// we must tell the driver to clean up its singleton(s)
if (type==H5I_VFL) {
H5FD_class_t *cls = (H5FD_class_t *)(cur->obj_ptr);
if (cls && cls->terminate) cls->terminate();
}

This seems to work nicely. The terminate function is called immediately before the class structure is freed, and everyone is happy. (Note that the H5FD_class_t free function doesn't do much, could we tag our terminate inside that to save one callback?)

  No, the free callback in the H5FD_class_t struct is for releasing memory in the file.

The trouble is, that I have no idea if this is a 'good' solution. My knowledge of the rest of the HDF5 internals is still minimal, so if this has other side effects I don't know. It seems to work and have no downside (other than an otherwise irrelevant check in every single call to H5I_clear_type - frequently called?).

Inside H5FD.c there is no longer any need for the code (below) because the term functions for each driver have been called during the H5I cleaning. File drivers can now be independent and linked in at run time.

I welcome your thoughts.

  Hmm, I'd rather not mangle the H5I_clear_type() routine that way. Can you modify the H5FD_free_cls() routine to call the new terminate callback that you've added? That would fit perfectly with the library's design.

  Quincey

···

On Jan 14, 2010, at 6:56 AM, Biddiscombe, John A. wrote:

JB

=======
           /* Reset the VFL drivers, if they've been closed */
           if(H5I_nmembers(H5I_VFL)==0) {
               H5FD_sec2_term();
#ifdef H5_HAVE_DIRECT
               H5FD_direct_term();
#endif
               H5FD_log_term();
               H5FD_stdio_term();
#ifdef H5_HAVE_WINDOWS
               H5FD_windows_term();
#endif
               H5FD_family_term();
               H5FD_core_term();
               H5FD_multi_term();
#ifdef H5_HAVE_PARALLEL
               H5FD_mpio_term();
               H5FD_mpiposix_term();
#ifdef H5_HAVE_DSM
               H5FD_dsm_term();
#endif

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Quincey

so what I've done is added the following to H5I.c inside the

H5I_clear_type(...) function.

    Hmm, I'd rather not mangle the H5I_clear_type() routine that way.

Can you modify the H5FD_free_cls() routine to call the new terminate

callback that you've added? That would fit perfectly with the library's

design.

No problem. I see now that inside H5I_clear_type, where I added the following line

if (cls && cls->terminate) cls->terminate();

The very next line is the free class call. By moving the line above into the free class, we remove pollution of H5I and it works exactly as before. It's good. All is done.

Only one thing remains. Inside H5FD_term_interface, there used to be a large number of class terminate calls, which are no longer needed, but once removed, we are left with the small remnant below. This is ok, but you'll see that there's an outer check for 'if nmembers>0 then clear type(VFL)', and once they're cleared, there used to be 'if nmembers>0 terminate each class (= reset VFL drivers)' - this check is still there, but there's no code inside it. Question is : Does there need to be some error check or can we just delete the second if nmembers>0 call. Since H5I_clear_type should call free_cls which in turn calls terminate, the only possibility is a potential check of 'did the class terminate correctly (is nmembers>0 still?) if not show an error' but a) is it possible to check, b) do we really care, by now the class structure should have been freed anyway, so next time anyone attempts to use it an error would occur anyway. I assume we just delete the second check. Yes?

JB

int H5FD_term_interface(void)

{

    int n = 0;

    FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_term_interface)

    if(H5_interface_initialize_g) {

      if((n=H5I_nmembers(H5I_VFL))!=0) {

          H5I_clear_type(H5I_VFL, FALSE, FALSE);

            /* Reset the VFL drivers, if they've been closed */

            if(H5I_nmembers(H5I_VFL)==0) {

            } /* end if */

      } else {

          H5I_dec_type_ref(H5I_VFL);

          H5_interface_initialize_g = 0;

          n = 1; /*H5I*/

      }

    }

    FUNC_LEAVE_NOAPI(n)

}

Hi John,

Quincey

>> so what I've done is added the following to H5I.c inside the
>> H5I_clear_type(...) function.

> Hmm, I'd rather not mangle the H5I_clear_type() routine that way.
> Can you modify the H5FD_free_cls() routine to call the new terminate
> callback that you've added? That would fit perfectly with the library's
> design.

No problem. I see now that inside H5I_clear_type, where I added the following line

if (cls && cls->terminate) cls->terminate();

The very next line is the free class call. By moving the line above into the free class, we remove pollution of H5I and it works exactly as before. It's good. All is done.

Only one thing remains. Inside H5FD_term_interface, there used to be a large number of class terminate calls, which are no longer needed, but once removed, we are left with the small remnant below. This is ok, but you'll see that there's an outer check for 'if nmembers>0 then clear type(VFL)', and once they're cleared, there used to be 'if nmembers>0 terminate each class (= reset VFL drivers)' - this check is still there, but there's no code inside it. Question is : Does there need to be some error check or can we just delete the second if nmembers>0 call. Since H5I_clear_type should call free_cls which in turn calls terminate, the only possibility is a potential check of 'did the class terminate correctly (is nmembers>0 still?) if not show an error' but a) is it possible to check, b) do we really care, by now the class structure should have been freed anyway, so next time anyone attempts to use it an error would occur anyway. I assume we just delete the second check. Yes?

  Yes, you are correct - you can remove the second check.

  I'm really happy that you've extended things in this direction. As soon as we've got our policy for accepting patches and transferring IP re-done, I'll get it right over to you and we can merge your changes into the repository for the next release (1.10.0).

  Thanks!
    Quincey

···

On Jan 20, 2010, at 2:23 AM, Biddiscombe, John A. wrote:

JB

int H5FD_term_interface(void)
{
    int n = 0;
    FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_term_interface)
    if(H5_interface_initialize_g) {
      if((n=H5I_nmembers(H5I_VFL))!=0) {
          H5I_clear_type(H5I_VFL, FALSE, FALSE);
            /* Reset the VFL drivers, if they've been closed */
            if(H5I_nmembers(H5I_VFL)==0) {
            } /* end if */
      } else {
          H5I_dec_type_ref(H5I_VFL);
          H5_interface_initialize_g = 0;
          n = 1; /*H5I*/
      }
    }
    FUNC_LEAVE_NOAPI(n)
}

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Quincey

            I'm really happy that you've extended things in this direction. As soon as we've got our policy for accepting patches and transferring IP re-done, I'll get it right over to you and we can merge your changes into the repository for the next release (1.10.0).

Excellent. My Pleasure. (Any idea of timeline for 1.10 - did I hear March mentioned some time ago?)

In my local git clone of the hdf5-cmake git repository, I've created a VFD branch, which contains the changes I've made for all the file driver stuff. Currently I'm manually keeping this synchronized with the hdf5-cmake branch. Once you're happy to merge/contribute into your repository, if you're tracking the hdf5-cmake repo, then it should be as simple as a patch from that branch to get all the changes. (I'll see if I can push my entire branch into the public hdf5-cmake repo - not sure how to do that, but it must be possible)

JB

Hi John,

Quincey

> I'm really happy that you've extended things in this direction. As soon as we've got our policy for accepting patches and transferring IP re-done, I'll get it right over to you and we can merge your changes into the repository for the next release (1.10.0).

Excellent. My Pleasure. (Any idea of timeline for 1.10 – did I hear March mentioned some time ago?)

  No, definitely not March. :slight_smile: I think we'll make it before the end of 2010, but it _could_ slip to '11... We _have_ to get some more backward/forward features in place before the next major release and I'm not certain exactly how long those will take to implement.

In my local git clone of the hdf5-cmake git repository, I’ve created a VFD branch, which contains the changes I’ve made for all the file driver stuff. Currently I’m manually keeping this synchronized with the hdf5-cmake branch. Once you’re happy to merge/contribute into your repository, if you’re tracking the hdf5-cmake repo, then it should be as simple as a patch from that branch to get all the changes. (I’ll see if I can push my entire branch into the public hdf5-cmake repo – not sure how to do that, but it must be possible)

  We'll need a patch that just implements this change, relative to the head of the HDF5 subversion 'trunk', so as long as you can extract that, it's not a worry to me. Elena's working on a procedure for creating "contributed feature" branches in our subversion repository, so eventually you'll be able to migrate your patches to a subversion repository that we can run through our daily regression tests during development, etc.

  Quincey

···

On Jan 20, 2010, at 7:25 AM, Biddiscombe, John A. wrote: