[drmaa-wg] C Binding

Roger Brobst rogerb at cadence.com
Wed Jan 12 12:13:27 CST 2005



In a previous e-mail, Daniel Templeton wrote:
> I've started to work on the C binding doc.  
> There's something I've been dying to do since I started with DRMAA, 
> and now that I have my hands on the C spec, I think it's a good 
> time to do it.

Alarming attitude.

It is my understanding that the C spec is being revised with the 
intent of making it a stand-alone document.   Although I would
expect this to entail vast changes to the document, the technical
content should be unchanged.
This will make revision comparisons very difficult.

Please continue to propose changes during your editing cycle
so they can be discussed and potentially incorporated into
the spec after the changes to make it a stand-alone ducument.


> That is namely to fix the drmaa_attr_*_t structures.  
> They are currently unusable.  In order to do anything useful
> with them, we need either a way to get the count of the elements
> in the structure or to reset the cursor to the beginning of the
> list or both.
> 
> 
> Here's are the 6 new functions I propose:
> 
> int drmaa_get_num_attr_names(drmaa_attr_names_t* values, int* count);
> int drmaa_get_num_attr_values(drmaa_attr_values_t* values, int* count);
> int drmaa_get_num_attr_ids(drmaa_attr_ids_t* values, int* count);
> int drmaa_reset_attr_names(drmaa_attr_names_t* values);
> int drmaa_reset_attr_values(drmaa_attr_values_t* values);
> int drmaa_reset_attr_ids(drmaa_attr_ids_t* values);
> 
> I strongly recommend we at least add one set or the other.  My
> preference would be both, but I think the first set is the more
> important.

The drmaa_get_next_* routines provide a mechanism to obtain
every element in the data structure (once).
I would expect many, if not most, callers of these routines
to insert the elements into a data structure which is suitable
for their usage.
I am of the opinion that the existing routines are sufficient
for incrementally constructed data structures.
Although, if the caller is building something like an array, 
there is likely to be a resizing and/or memory copying overhead.

> Does anyone have anything against adding these functions?

I don't think the convenience of the proposed functions
is sufficient to require their implementation.

The agreed upon interface for the drmaa_get_next_* routines
accept a buffer for the primary output value.
 For example:
   int drmaa_get_next_attr_name(drmaa_attr_names_t* values,
                                char *value, size_t value_len);
Thus, the drmaa implementation is not required to retain 
information once it has been provided to the application.

If it is important to iterate over values more than once,
then presumably the DRMAA implementation should retain the
entire set of values.  I'd prefer to let the application
decide when to retain values.

-Roger





More information about the drmaa-wg mailing list