GraphBLAS / graphblas-api-c

Other
7 stars 3 forks source link

"conformant" library not well defined #53

Closed DrTimothyAldenDavis closed 2 years ago

DrTimothyAldenDavis commented 2 years ago

"conformant" is not well defined. The draft spec states:

An implementation of the GraphBLAS C API may still call itself “conformant” to this specification if the following conditions hold.

  1. Every method defined in the GraphBLAS specification is supported for at least one combination of input parameters.
  2. This situation must be documented as an implementation defined feature of the implementation of the GraphBLAS.
  3. This situation is caught as an API error (section 2.6) and the parameter GrB_NOT_IMPLEMENTED is returned by the associated method call.

Item (1) is vague. Suppose I wrote a GraphBLAS library that required all Mask inputs to be NULL, and all accum operator inputs to be NULL, and all descriptors to be NULL. Each operation and method would be supported for many combinations of parameters (just no Mask matrix, no accum operator, no GrB_DESC_T0, etc). Then I could call the library conformant, as long as I document it and properly return GrB_NOT_IMPLEMENTED.

tgmattso commented 2 years ago

OK. Help me out here. I don't want to put a number ... X% of functionality must be supported on every method. I want to give implementors flexibility they need to support a diverse range of platforms. But I don't want people to get away with weird stunt implementations that abuse the term "conformant". I could say "the majority of the possible function signatures must be supported" ... but that is the same as saying X=51. What wording do you suggest?

DrTimothyAldenDavis commented 2 years ago

Unsure what language to put here. Perhaps it requires a decision by the C API Committee: if you have a library with any possibility of returning GrB_NOT_IMPLEMENTED, then it is up to the C API Committee to determine if your implementation is conformant.

Here is my statement in my user guide (just added). This is the only case where I ever return GrB_NOT_IMPLEMENTED. As all my "SPEC:" comments in my user guide, this is highlighted in yellow:

SPEC: All methods below use a monoid for the reduction. The Specification also allows reductions using an associative and commutative binary operator. SuiteSparse:GraphBLAS permits the use of a GrB_BinaryOp instead of a GrB_Monoid, but only if the binary operator is built-in and corresponds to a known built-in monoid. For example, the binary operator GrB_PLUS_FP64 can be used, since this is the binary operator of the built-in GrB_PLUS_MONOID_FP64. For other binary ops (including any user-defined ones), GrB_NOT_IMPLEMENTED is returned.

If this is the only place where I can return GrB_NOT_IMPLEMENTED, then does this count as conformant?

DrTimothyAldenDavis commented 2 years ago

GrB_NOT_IMPLEMENTED is well-defined. What is not well defined is the definition of "a conformant library" that might return GrB_NOT_IMPLEMENTED. I revised the title of this issue.

DrTimothyAldenDavis commented 2 years ago

What if a library decided to forgo some of the built-in types, and discarded GrB_INT16 and GrB_UINT16, for example? Those types are not used in any GraphBLAS-based algorithm I'm aware of, so it wouldn't be a big loss. int16_t and uint16_t are uncommon in algorithms in general. Usually a single byte (int8 or uint8) or 32-bit or 64 bit integer are used. Would this be a "conformant library"? I don't think so, myself, but I can imagine some library writers wanting to prune the number of built-in types to reduce the complexity of the implementation.

There are just too many things that a library could leave out. I think making a hard-and-fast rule in the spec to define a "conformant library" is a very difficult thing to do.

tgmattso commented 2 years ago

Yes. that is exactly the problem. We want implementors to have the flexibility they need to support the GraphBLAS. But we cannot get in the "conformance decision" business (as a "proper" standards body, such as the Khronos Group, is).

Maybe the following works ... for a selected subset of types defined in the GraphBLAS specification, a conformant implementation will provide an implementation of every method in chapters 3 and 4 for a majority of the defined cases.

DrTimothyAldenDavis commented 2 years ago

How about "vast majority" ?

DrTimothyAldenDavis commented 2 years ago

The update from Tim M. looks fine to me. Typo on ``conformant?? .

DrTimothyAldenDavis commented 2 years ago

I think we can close this now.

mcmillan03 commented 2 years ago

Fixed closing double quote.

tgmattso commented 2 years ago

The GraphBLAS C API committee has agreed on the final language on this topic. We are done and therefore closing the issue.