GraphBLAS / graphblas-api-c

Other
7 stars 3 forks source link

BB-27: Descriptors query and default #13

Closed mcmillan03 closed 9 months ago

mcmillan03 commented 3 years ago

Need to be able to query contents of a descriptor, see SuiteSparse 'GxB_Desc_get'.

Need to be able to set a value of a descriptor that need not be the enum type, but any other type; see Suitesparse 'GxB_Desc_set'.

Need 'GxB_DEFAULT' to set a descriptor back to default. Currenlty a descriptor is a write-once-only object.

mcmillan03 commented 3 years ago

I see no problem with the write-only aspect of descriptors and therefore don't perceive a need for this capability.

tgmattso commented 3 years ago

OK. this makes sense and I could see supporting this.

There is a something Tim Davis has asked for repeatedly and that is that every GraphBLAS method should take a descriptor. That would give an implementation a standard way to pass extra information into a method. This makes sense to me though I hate changing the API so radically

DrTimothyAldenDavis commented 3 years ago

Every function needs a descriptor, even GrB_Matrix_nvals.

I have to control parallelism. The BLAS is broken, badly, in this regard. You can't tell DGEMM how many threads to use, so an application that wants to use a parallel BLAS becomes very hard to write if you have multiple application threads calling the BLAS at the same time (say 8 cores, 2 user threads: one calls DGEMM with 5 threads and the other with 3, at the same time).

With the descriptor, I can control this on a per-call basis ... but only if I have a descriptor and not all methods take a descriptor.

The need to read a descriptor is from the following use case: say you have a utility function that does something, taking in a descriptor from its caller to do some work (say "do something with A transpose") but then I want to fiddle with this descriptor to change or its thread count. Maybe I want to read "oh, this descriptor says to use 5 threads inside GraphBLAS, but I want to fork so I will create 2 more descriptors and give 3 threads to one of my threads and 2 to another").

That's why I'd like to read/write a descriptor.

However, I can live with a read-only descriptor (the user application would just carry around its own equivalent, which it can read/write, and then it can make a GrB_descriptor at the last moment, and it can be write-only).

The main problem with descriptors is that not all functions have them, so my control over the parallel use of GraphBLAS is partial and lame.

DrTimothyAldenDavis commented 2 years ago

Adding the descriptor to all methods is another issue: #48.

manoj63 commented 1 year ago
  1. Should this be an options list analogous to command line options in Unix commands.
  2. Any use other than control of parallelism? For example, sharding of large matrices, collocation of data and compute, ...
  3. Should all hints be optional? Default can come from a configuration file created by the library installer.
  4. Can the library ignore the hint. In that case, what message is sent back to the running application, and how (part of status).
jim22k commented 1 year ago

Make extended descriptor a separate issue