Skip to content

Commit e3d14bc

Browse files
Merge pull request #202 from DrTimothyAldenDavis/v742
GraphBLAS v7.4.2.beta2: NTHREADS and CHUNK in descriptor is deprecated
2 parents 88c4796 + f5c17f3 commit e3d14bc

File tree

7 files changed

+55
-143
lines changed

7 files changed

+55
-143
lines changed

Config/GraphBLAS.h.in

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -425,16 +425,6 @@ GrB_Info GrB_getVersion // runtime access to C API version number
425425
//
426426
// GrB_INP1: the same as GrB_INP0 but for the second input
427427
//
428-
// GxB_NTHREADS: the maximum number of threads to use in the current method.
429-
// If <= GxB_DEFAULT (which is zero), then the number of threads is
430-
// determined automatically. This is the default value.
431-
//
432-
// GxB_CHUNK: an integer parameter that determines the number of threads to use
433-
// for a small problem. If w is the work to be performed, and chunk is
434-
// the value of this parameter, then the # of threads is limited to floor
435-
// (w/chunk). The default chunk is currently 64K, but this may change in
436-
// the future. If chunk is set to <= GxB_DEFAULT (that is, zero), the
437-
// default is used.
438428
//
439429
// GxB_AxB_METHOD: this is a hint to SuiteSparse:GraphBLAS on which algorithm
440430
// it should use to compute C=A*B, in GrB_mxm, GrB_mxv, and GrB_vxm.
@@ -499,12 +489,9 @@ typedef enum
499489
GrB_INP0 = 2, // descriptor for the first input of a method
500490
GrB_INP1 = 3, // descriptor for the second input of a method
501491

502-
GxB_DESCRIPTOR_NTHREADS = GxB_NTHREADS, // max number of threads to use.
503-
// If <= GxB_DEFAULT, then GraphBLAS selects the number
504-
// of threads automatically.
505-
506-
GxB_DESCRIPTOR_CHUNK = GxB_CHUNK, // chunk size for small problems.
507-
// If <= GxB_DEFAULT, then the default is used.
492+
// setting NTHREADS and CHUNK in the descriptor is deprecated
493+
GxB_DESCRIPTOR_NTHREADS = GxB_NTHREADS, // DEPRECATED
494+
GxB_DESCRIPTOR_CHUNK = GxB_CHUNK, // DEPRECATED
508495

509496
// GPU control (DRAFT: in progress, do not use)
510497
GxB_DESCRIPTOR_GPU_CONTROL = GxB_GPU_CONTROL,
@@ -4089,7 +4076,7 @@ GrB_Info GxB_Matrix_diag // construct a diagonal matrix from a vector
40894076
GrB_Matrix C, // output matrix
40904077
const GrB_Vector v, // input vector
40914078
int64_t k,
4092-
const GrB_Descriptor desc // to specify # of threads
4079+
const GrB_Descriptor desc
40934080
) ;
40944081

40954082
// GxB_Vector_diag extracts a vector v from an input matrix A, which may be
@@ -4481,8 +4468,7 @@ GrB_Info GxB_Global_Option_get_FUNCTION // gets the current global option
44814468

44824469
// GxB_set and GxB_get are generic methods that and set or query the options in
44834470
// a GrB_Matrix, a GrB_Descriptor, or in the global options. They can be used
4484-
// with the following syntax. Note that GxB_NTHREADS can be used for both the
4485-
// global nthreads_max, and for the # of threads in the descriptor.
4471+
// with the following syntax.
44864472

44874473
// To set/get the global options:
44884474
//
@@ -4586,12 +4572,6 @@ GrB_Info GxB_Global_Option_get_FUNCTION // gets the current global option
45864572
// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_DOT) ;
45874573
// GxB_get (GrB_Descriptor d, GrB_AxB_METHOD, GrB_Desc_Value *v) ;
45884574
//
4589-
// GxB_set (GrB_Descriptor d, GxB_NTHREADS, nthreads) ;
4590-
// GxB_get (GrB_Descriptor d, GxB_NTHREADS, int *nthreads) ;
4591-
//
4592-
// GxB_set (GrB_Descriptor d, GxB_CHUNK, double chunk) ;
4593-
// GxB_get (GrB_Descriptor d, GxB_CHUNK, double *chunk) ;
4594-
//
45954575
// GxB_set (GrB_Descriptor d, GxB_SORT, int sort) ;
45964576
// GxB_get (GrB_Descriptor d, GxB_SORT, int *sort) ;
45974577
//
@@ -10964,7 +10944,6 @@ GrB_Info GxB_Matrix_serialize // serialize a GrB_Matrix to a blob
1096410944
// input:
1096510945
GrB_Matrix A, // matrix to serialize
1096610946
const GrB_Descriptor desc // descriptor to select compression method
10967-
// and to control # of threads used
1096810947
) ;
1096910948

1097010949
GrB_Info GrB_Matrix_serialize // serialize a GrB_Matrix to a blob
@@ -10986,7 +10965,6 @@ GrB_Info GxB_Vector_serialize // serialize a GrB_Vector to a blob
1098610965
// input:
1098710966
GrB_Vector u, // vector to serialize
1098810967
const GrB_Descriptor desc // descriptor to select compression method
10989-
// and to control # of threads used
1099010968
) ;
1099110969

1099210970
GrB_Info GrB_Matrix_serializeSize // estimate the size of a blob
@@ -10999,8 +10977,7 @@ GrB_Info GrB_Matrix_serializeSize // estimate the size of a blob
1099910977
) ;
1100010978

1100110979
// The GrB* and GxB* deserialize methods are nearly identical. The GxB*
11002-
// deserialize methods simply add the descriptor, which allows for optional
11003-
// control of the # of threads used to deserialize the blob.
10980+
// deserialize methods simply add the descriptor.
1100410981

1100510982
GrB_Info GxB_Matrix_deserialize // deserialize blob into a GrB_Matrix
1100610983
(
@@ -11013,7 +10990,7 @@ GrB_Info GxB_Matrix_deserialize // deserialize blob into a GrB_Matrix
1101310990
// type of C.
1101410991
const void *blob, // the blob
1101510992
GrB_Index blob_size, // size of the blob
11016-
const GrB_Descriptor desc // to control # of threads used
10993+
const GrB_Descriptor desc
1101710994
) ;
1101810995

1101910996
GrB_Info GrB_Matrix_deserialize // deserialize blob into a GrB_Matrix
@@ -11040,7 +11017,7 @@ GrB_Info GxB_Vector_deserialize // deserialize blob into a GrB_Vector
1104011017
// type of w.
1104111018
const void *blob, // the blob
1104211019
GrB_Index blob_size, // size of the blob
11043-
const GrB_Descriptor desc // to control # of threads used
11020+
const GrB_Descriptor desc
1104411021
) ;
1104511022

1104611023
// GxB_deserialize_type_name extracts the type_name of the GrB_Type of the
@@ -11131,7 +11108,7 @@ GrB_Info GxB_Matrix_reshape // reshape a GrB_Matrix in place
1113111108
bool by_col, // true if reshape by column, false if by row
1113211109
GrB_Index nrows_new, // new number of rows of C
1113311110
GrB_Index ncols_new, // new number of columns of C
11134-
const GrB_Descriptor desc // to control # of threads used
11111+
const GrB_Descriptor desc
1113511112
) ;
1113611113

1113711114
// GxB_Matrix_reshapeDup reshapes a matrix into another matrix.
@@ -11151,7 +11128,7 @@ GrB_Info GxB_Matrix_reshapeDup // reshape a GrB_Matrix into another GrB_Matrix
1115111128
bool by_col, // true if reshape by column, false if by row
1115211129
GrB_Index nrows_new, // number of rows of C
1115311130
GrB_Index ncols_new, // number of columns of C
11154-
const GrB_Descriptor desc // to control # of threads used
11131+
const GrB_Descriptor desc
1115511132
) ;
1115611133

1115711134
//==============================================================================

Doc/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Version 7.4.2, Jan 17, 2023
22

33
* minor change to build system: for SuiteSparse v7.0.0
4+
* deprecation notice: in GraphBLAS v8.0.0, the ability to set the
5+
# of threads, and chunk size, in the descriptor will be removed.
6+
It still appears in v7.x, but will be replaced by a Context object
7+
in v8.0.0.
48

59
Version 7.4.1, Jan 9, 2023
610

Doc/GraphBLAS_UserGuide.pdf

-2.41 KB
Binary file not shown.

Doc/GraphBLAS_UserGuide.tex

Lines changed: 21 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -5163,7 +5163,7 @@ \subsubsection{{\sf GxB\_Matrix\_reshape:} reshape a matrix}
51635163
bool by_col, // true if reshape by column, false if by row
51645164
GrB_Index nrows_new, // new number of rows of C
51655165
GrB_Index ncols_new, // new number of columns of C
5166-
const GrB_Descriptor desc // to control # of threads used
5166+
const GrB_Descriptor desc
51675167
) ;
51685168
\end{verbatim} } \end{mdframed}
51695169

@@ -5217,7 +5217,7 @@ \subsubsection{{\sf GxB\_Matrix\_reshapeDup:} reshape a matrix}
52175217
bool by_col, // true if reshape by column, false if by row
52185218
GrB_Index nrows_new, // number of rows of C
52195219
GrB_Index ncols_new, // number of columns of C
5220-
const GrB_Descriptor desc // to control # of threads used
5220+
const GrB_Descriptor desc
52215221
) ;
52225222
\end{verbatim} } \end{mdframed}
52235223

@@ -5601,7 +5601,6 @@ \subsubsection{{\sf GxB\_Vector\_serialize:} serialize a vector}
56015601
// input:
56025602
GrB_Vector u, // vector to serialize
56035603
const GrB_Descriptor desc // descriptor to select compression method
5604-
// and to control # of threads used
56055604
) ;
56065605
\end{verbatim}
56075606
} \end{mdframed}
@@ -5656,7 +5655,7 @@ \subsubsection{{\sf GxB\_Vector\_deserialize:} deserialize a vector}
56565655
GrB_Type type, // type of the vector w. See GxB_Matrix_deserialize.
56575656
const void *blob, // the blob
56585657
GrB_Index blob_size, // size of the blob
5659-
const GrB_Descriptor desc // to control # of threads used
5658+
const GrB_Descriptor desc
56605659
) ;
56615660
\end{verbatim}
56625661
} \end{mdframed}
@@ -5748,7 +5747,6 @@ \subsubsection{{\sf GxB\_Matrix\_serialize:} serialize a matrix}
57485747
// input:
57495748
GrB_Matrix A, // matrix to serialize
57505749
const GrB_Descriptor desc // descriptor to select compression method
5751-
// and to control # of threads used
57525750
) ;
57535751
\end{verbatim}
57545752
} \end{mdframed}
@@ -5817,7 +5815,7 @@ \subsubsection{{\sf GxB\_Matrix\_deserialize:} deserialize a matrix}
58175815
// type of C.
58185816
const void *blob, // the blob
58195817
GrB_Index blob_size, // size of the blob
5820-
const GrB_Descriptor desc // to control # of threads used
5818+
const GrB_Descriptor desc
58215819
) ;
58225820
\end{verbatim}
58235821
} \end{mdframed}
@@ -7598,16 +7596,14 @@ \subsection{GraphBLAS descriptors: {\sf GrB\_Descriptor}} %=====================
75987596
\begin{mdframed}[userdefinedwidth=6in]
75997597
{\footnotesize
76007598
\begin{verbatim}
7601-
#define GxB_NTHREADS 5 // for both GrB_Desc_field and GxB_Option_field
7599+
#define GxB_NTHREADS 5 // for GxB_Option_field
76027600
#define GxB_CHUNK 7
76037601
typedef enum
76047602
{
76057603
GrB_OUTP = 0, // descriptor for output of a method
76067604
GrB_MASK = 1, // descriptor for the mask input of a method
76077605
GrB_INP0 = 2, // descriptor for the first input of a method
76087606
GrB_INP1 = 3, // descriptor for the second input of a method
7609-
GxB_DESCRIPTOR_NTHREADS = GxB_NTHREADS, // number of threads to use
7610-
GxB_DESCRIPTOR_CHUNK = GxB_CHUNK, // chunk size for small problems
76117607
GxB_AxB_METHOD = 1000, // descriptor for selecting C=A*B algorithm
76127608
GxB_SORT = 35 // control sort in GrB_mxm
76137609
GxB_COMPRESSION = 36, // select compression for serialize
@@ -7775,17 +7771,12 @@ \subsection{GraphBLAS descriptors: {\sf GrB\_Descriptor}} %=====================
77757771

77767772
\end{itemize}
77777773

7778-
\item \verb'GxB_NTHREADS' controls how many threads a method uses.
7779-
By default (if set to zero, or \verb'GxB_DEFAULT'), all available threads
7780-
are used. The maximum available threads is controlled by the global
7781-
setting, which is \verb'omp_get_max_threads ( )' by default. If set to
7782-
some positive integer \verb'nthreads' less than this maximum, at most
7783-
\verb'nthreads' threads will be used. See Section~\ref{omp_parallelism}
7784-
for details.
7774+
\item \verb'GxB_NTHREADS' controls how many threads a method uses, via
7775+
the descriptor, but is deprecated.
7776+
It will be removed from the descriptor entirely in v8.0.0.
77857777

7786-
\item \verb'GxB_CHUNK' is a \verb'double' value that controls how many threads
7787-
a method uses for small problems. See Section~\ref{omp_parallelism} for
7788-
details.
7778+
\item \verb'GxB_CHUNK' is deprecated as used in the descriptor.
7779+
It will be removed from the descriptor entirely in v8.0.0.
77897780

77907781
\item \verb'GxB_SORT' provides a hint to \verb'GrB_mxm', \verb'GrB_mxv',
77917782
\verb'GrB_vxm', and \verb'GrB_reduce' (to vector). These methods can leave
@@ -7894,7 +7885,7 @@ \subsubsection{{\sf GrB\_Descriptor\_set:} set a parameter in a descriptor}
78947885
\verb'GrB_Descriptor_set' sets a descriptor field (\verb'GrB_OUTP',
78957886
\verb'GrB_MASK', \verb'GrB_INP0', \verb'GrB_INP1', or \verb'GxB_AxB_METHOD') to
78967887
a particular value. Use \verb'GxB_Dec_set' to set the value of
7897-
\verb'GxB_NTHREADS', \verb'GxB_CHUNK', and \verb'GxB_SORT'.
7888+
\verb'GxB_SORT'.
78987889
If an error occurs, \verb'GrB_error(&err,desc)' returns details about the error.
78997890

79007891
\vspace{0.2in}
@@ -8046,16 +8037,6 @@ \subsubsection{{\sf GrB\_DESC\_*:} built-in descriptors}
80468037
Attempts to modify them result in an error (\verb'GrB_INVALID_VALUE'); attempts
80478038
to free them are silently ignored.
80488039

8049-
% \verb'GrB_NULL' is the default descriptor, with all settings at their defaults:
8050-
% \verb'OUTP': do not replace the output,
8051-
% \verb'MASK': mask is valued and not complemented,
8052-
% \verb'INP0': first input not transposed, and
8053-
% \verb'INP1': second input not transposed.
8054-
% For these pre-defined descriptors, the
8055-
% \verb'GxB_NTHREADS',
8056-
% \verb'GxB_CHUNK', and
8057-
% \verb'GxB_SORT' settings are at their default values.
8058-
80598040
\vspace{0.2in}
80608041
\noindent
80618042
{\footnotesize
@@ -8394,10 +8375,6 @@ \section{SuiteSparse:GraphBLAS Options} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
83948375
\verb'GrB_MASK' & \verb'GrB_Desc_Value' & mask option \\
83958376
\verb'GrB_INP0' & \verb'GrB_Desc_Value' & transpose input 0 \\
83968377
\verb'GrB_INP1' & \verb'GrB_Desc_Value' & transpose input 1 \\
8397-
\verb'GxB_DESCRIPTOR_NTHREADS' & \verb'int' & number of threads to use \\
8398-
\verb'GxB_NTHREADS' & \verb'int' & number of threads to use \\
8399-
\verb'GxB_DESCRIPTOR_CHUNK' & \verb'double' & chunk size \\
8400-
\verb'GxB_CHUNK' & \verb'double' & chunk size \\
84018378
\verb'GxB_AxB_METHOD' & \verb'int' & method for matrix multiply \\
84028379
\verb'GxB_SORT' & \verb'int' & lazy vs aggressive sort \\
84038380
\verb'GxB_COMPRESSION' & \verb'int' & compression for serialization \\
@@ -8495,10 +8472,6 @@ \section{SuiteSparse:GraphBLAS Options} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84958472
\verb'GrB_MASK' & \verb'GrB_Desc_Value' & mask option \\
84968473
\verb'GrB_INP0' & \verb'GrB_Desc_Value' & transpose input 0 \\
84978474
\verb'GrB_INP1' & \verb'GrB_Desc_Value' & transpose input 1 \\
8498-
\verb'GxB_DESCRIPTOR_NTHREADS' & \verb'int' & number of threads to use \\
8499-
\verb'GxB_NTHREADS' & \verb'int' & number of threads to use \\
8500-
\verb'GxB_DESCRIPTOR_CHUNK' & \verb'double' & chunk size \\
8501-
\verb'GxB_CHUNK' & \verb'double' & chunk size \\
85028475
\verb'GxB_AxB_METHOD' & \verb'int' & method for matrix multiply \\
85038476
\verb'GxB_SORT' & \verb'int' & lazy vs aggressive sort \\
85048477
\verb'GxB_COMPRESSION' & \verb'int' & compression for serialization \\
@@ -8544,19 +8517,9 @@ \subsection{OpenMP parallelism}
85448517
GxB_set (GxB_NTHREADS, nthreads_max) ;
85458518
GxB_set (GxB_CHUNK, (double) 20000) ; \end{verbatim} }
85468519

8547-
\item Per operation: Most GraphBLAS operations take a \verb'GrB_Descriptor'
8548-
input, and this can be modified to set the number of threads and chunk
8549-
size for the operation that uses this descriptor. Note that \verb'chunk'
8550-
is a \verb'double'.
8551-
8552-
{\footnotesize
8553-
\begin{verbatim}
8554-
GrB_Descriptor desc ;
8555-
GrB_Descriptor_new (&desc)
8556-
int nthreads_max = 40 ;
8557-
GxB_set (desc, GxB_NTHREADS, nthreads_max) ;
8558-
double chunk = 20000 ;
8559-
GxB_set (desc, GxB_CHUNK, chunk) ; \end{verbatim} }
8520+
\item Per operation: Setting the number of threads and the chunk
8521+
size in the descriptor is deprecated.
8522+
It will be removed entirely in v8.0.0 from the descriptor.
85608523

85618524
\end{itemize}
85628525

@@ -8568,15 +8531,9 @@ \subsection{OpenMP parallelism}
85688531
The default for \verb'nthreads_max' is the return value from
85698532
\verb'omp_get_max_threads', and the default chunk size is currently 65,536.
85708533

8571-
If a descriptor value for either parameter is left at its default, or set to
8572-
\verb'GxB_DEFAULT', then the global setting is used. This global setting may
8573-
have been modified from its default, and this modified value will be used.
8574-
85758534
For example, suppose \verb'omp_get_max_threads' reports 8 threads. If \newline
85768535
\verb'GxB_set (GxB_NTHREADS, 4)' is used, then the global setting is four
8577-
threads, not eight. If a descriptor is used but its \verb'GxB_NTHREADS' is not
8578-
set, or set to \verb'GxB_DEFAULT', then any operation that uses this descriptor
8579-
will use 4 threads.
8536+
threads, not eight.
85808537

85818538
GraphBLAS may be compiled without OpenMP, by setting \verb'-DNOPENMP=1'.
85828539
The library will be thread-safe, with one exception. \verb'GrB_wait' is
@@ -9145,8 +9102,8 @@ \subsection{{\sf GxB\_Desc\_set:} set a {\sf GrB\_Descriptor} value}
91459102

91469103
This usage is similar to \verb'GrB_Descriptor_set', just with a name that is
91479104
consistent with the other usages of this generic function. Unlike
9148-
\verb'GrB_Descriptor_set', the \verb'field' may also be \verb'GxB_NTHREADS',
9149-
\verb'GxB_CHUNK', \verb'GxB_SORT', \verb'GxB_COMPRESSION', or
9105+
\verb'GrB_Descriptor_set', the \verb'field' may also be
9106+
\verb'GxB_SORT', \verb'GxB_COMPRESSION', or
91509107
\verb'GxB_IMPORT'. Refer to Sections~\ref{descriptor_set}~and~\ref{desc_set}
91519108
for details. If an error occurs, \verb'GrB_error(&err,desc)' returns details
91529109
about the error.
@@ -9333,8 +9290,6 @@ \subsection{{\sf GxB\_Desc\_get:} retrieve a {\sf GrB\_Descriptor} value}
93339290
This usage is the same as \verb'GxB_Desc_get'. The \verb'field' parameter can
93349291
be \verb'GrB_OUTP', \verb'GrB_MASK', \verb'GrB_INP0', \verb'GrB_INP1',
93359292
\verb'GxB_AxB_METHOD',
9336-
\verb'GxB_NTHREADS',
9337-
\verb'GxB_CHUNK',
93389293
\verb'GxB_SORT',
93399294
\verb'GxB_COMPRESSION', or
93409295
\verb'GxB_IMPORT'.
@@ -9458,10 +9413,6 @@ \subsection{Summary of usage of {\sf GxB\_set} and {\sf GxB\_get}}
94589413
GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_SAXPY) ;
94599414
GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_DOT) ;
94609415
GxB_get (GrB_Descriptor d, GrB_AxB_METHOD, GrB_Desc_Value *v) ;
9461-
GxB_set (GrB_Descriptor d, GxB_NTHREADS, int nthreads) ;
9462-
GxB_get (GrB_Descriptor d, GxB_NTHREADS, int *nthreads) ;
9463-
GxB_set (GrB_Descriptor d, GxB_CHUNK, double chunk) ;
9464-
GxB_get (GrB_Descriptor d, GxB_CHUNK, double *chunk) ;
94659416
GxB_set (GrB_Descriptor d, GxB_SORT, sort) ;
94669417
GxB_get (GrB_Descriptor d, GxB_SORT, int *sort) ;
94679418
GxB_set (GrB_Descriptor d, GxB_COMPRESSION, GxB_FAST_IMPORT) ;
@@ -15542,6 +15493,10 @@ \section{Release Notes}
1554215493

1554315494
\begin{itemize}
1554415495
\item minor change to build system: for SuiteSparse v7.0.0.
15496+
\item deprecation notice: in GraphBLAS v8.0.0, the ability to set the
15497+
number of threads, and chunk size, in the descriptor will be removed.
15498+
It still appears in v7.x, but will be replaced by a Context object
15499+
in v8.0.0.
1554515500
\end{itemize}
1554615501

1554715502
\item Version 7.4.1 (Dec 29, 2022)

0 commit comments

Comments
 (0)