File: tuning.rst

package info (click to toggle)
rocsolver 6.4.3-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 17,876 kB
  • sloc: cpp: 151,850; python: 2,275; sh: 875; objc: 642; ansic: 402; makefile: 71; xml: 26
file content (468 lines) | stat: -rw-r--r-- 16,594 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
.. meta::
  :description: rocSOLVER documentation and API reference library
  :keywords: rocSOLVER, ROCm, API, documentation

.. _tuning_label:

*******************************
Tuning rocSOLVER performance
*******************************

Some compile-time parameters in rocSOLVER can be modified to tune the performance
of the library functions in a given context (e.g., for a particular matrix size or shape).
A description of these tunable constants is presented in this section.

To facilitate the description, the constants are grouped by the family of functions they affect.
Some aspects of the involved algorithms are also depicted here for the sake of clarity; however,
this section is not intended to be a review of the well-known methods for different matrix computations.
These constants are specific to the rocSOLVER implementation and are only described within that context.

All described constants can be found in ``library/src/include/ideal_sizes.hpp``.
These are not run-time arguments for the associated API functions. The library must be
:ref:`rebuilt from source<linux-install-source>` for any change to take effect.

.. warning::
    The effect of changing a tunable constant on the performance of the library is difficult
    to predict, and such analysis is beyond the scope of this document. Advanced users and
    developers tuning these values should proceed with caution. New values may (or may not)
    improve or worsen the performance of the associated functions.

geqr2/geqrf and geql2/geqlf functions
======================================

The orthogonal factorizations from the left (QR or QL factorizations) are separated into two versions:
blocked and unblocked. The unblocked routines GEQR2 and GEQL2 are based on BLAS Level 2 operations and work by applying
Householder reflectors one column at a time. The blocked routines GEQRF and GEQLF factorize a block of columns at each
step using the unblocked functions (provided the matrix is large enough) and apply the resulting block reflectors to update
the rest of the matrix. The application of the block reflectors is based on matrix-matrix operations (BLAS Level 3), which,
in general, can give better performance on the GPU.

GEQxF_BLOCKSIZE
----------------------
.. doxygendefine:: GEQxF_BLOCKSIZE

GEQxF_GEQx2_SWITCHSIZE
-----------------------
.. doxygendefine:: GEQxF_GEQx2_SWITCHSIZE

(As of the current rocSOLVER release, these constants have not been tuned for any specific cases.)



gerq2/gerqf and gelq2/gelqf functions
========================================

The orthogonal factorizations from the right (RQ or LQ factorizations) are separated into two versions:
blocked and unblocked. The unblocked routines GERQ2 and GELQ2 are based on BLAS Level 2 operations and work by applying
Householder reflectors one row at a time. The blocked routines GERQF and GELQF factorize a block of rows at each
step using the unblocked functions (provided the matrix is large enough) and apply the resulting block reflectors to update
the rest of the matrix. The application of the block reflectors is based on matrix-matrix operations (BLAS Level 3), which,
in general, can give better performance on the GPU.

GExQF_BLOCKSIZE
----------------------
.. doxygendefine:: GExQF_BLOCKSIZE

GExQF_GExQ2_SWITCHSIZE
-----------------------
.. doxygendefine:: GExQF_GExQ2_SWITCHSIZE

(As of the current rocSOLVER release, these constants have not been tuned for any specific cases.)



org2r/orgqr, org2l/orgql, ung2r/ungqr and ung2l/ungql functions
================================================================

The generators of a matrix Q with orthonormal columns (as products of Householder reflectors derived
from the QR or QL factorizations) are also separated into blocked and unblocked versions. The unblocked
routines ORG2R/UNG2R and ORG2L/UNG2L, based on BLAS Level 2 operations, work by accumulating one Householder reflector at a time.
The blocked routines ORGQR/UNGQR and ORGQL/UNGQL multiply a set of reflectors at each step using the unblocked
functions (provided there are enough reflectors to accumulate) and apply the resulting block reflector to update Q.
The application of the block reflectors is based on matrix-matrix operations (BLAS Level 3), which,
in general, can give better performance on the GPU.

xxGQx_BLOCKSIZE
----------------------
.. doxygendefine:: xxGQx_BLOCKSIZE

xxGQx_xxGQx2_SWITCHSIZE
-----------------------
.. doxygendefine:: xxGQx_xxGQx2_SWITCHSIZE

(As of the current rocSOLVER release, these constants have not been tuned for any specific cases.)



orgr2/orgrq, orgl2/orglq, ungr2/ungrq and ungl2/unglq functions
================================================================

The generators of a matrix Q with orthonormal rows (as products of Householder reflectors derived
from the RQ or LQ factorizations) are also separated into blocked and unblocked versions. The unblocked
routines ORGR2/UNGR2 and ORGL2/UNGL2, based on BLAS Level 2 operations, work by accumulating one Householder reflector at a time.
The blocked routines ORGRQ/UNGRQ and ORGLQ/UNGLQ multiply a set of reflectors at each step using the unblocked
functions (provided there are enough reflectors to accumulate) and apply the resulting block reflector to update Q.
The application of the block reflectors is based on matrix-matrix operations (BLAS Level 3), which,
in general, can give better performance on the GPU.

xxGxQ_BLOCKSIZE
----------------------
.. doxygendefine:: xxGxQ_BLOCKSIZE

xxGxQ_xxGxQ2_SWITCHSIZE
-----------------------
.. doxygendefine:: xxGxQ_xxGxQ2_SWITCHSIZE

(As of the current rocSOLVER release, these constants have not been tuned for any specific cases.)



orm2r/ormqr, orm2l/ormql, unm2r/unmqr and unm2l/unmql functions
================================================================

As with the generators of orthonormal/unitary matrices, the routines to multiply a general
matrix C by a matrix Q with orthonormal columns are separated into blocked and unblocked versions.
The unblocked routines ORM2R/UNM2R and ORM2L/UNM2L, based on BLAS Level 2 operations, work by multiplying one Householder
reflector at a time, while the blocked routines ORMQR/UNMQR and ORMQL/UNMQL apply a set of reflectors at each step
(provided there are enough reflectors to start with).
The application of the block reflectors is based on matrix-matrix operations (BLAS Level 3), which,
in general, can give better performance on the GPU.

xxMQx_BLOCKSIZE
----------------------
.. doxygendefine:: xxMQx_BLOCKSIZE

(As of the current rocSOLVER release, this constant has not been tuned for any specific cases.)



ormr2/ormrq, orml2/ormlq, unmr2/unmrq and unml2/unmlq functions
================================================================

As with the generators of orthonormal/unitary matrices, the routines to multiply a general
matrix C by a matrix Q with orthonormal rows are separated into blocked and unblocked versions.
The unblocked routines ORMR2/UNMR2 and ORML2/UNML2, based on BLAS Level 2 operations, work by multiplying one Householder
reflector at a time, while the blocked routines ORMRQ/UNMRQ and ORMLQ/UNMLQ apply a set of reflectors at each step
(provided there are enough reflectors to start with).
The application of the block reflectors is based on matrix-matrix operations (BLAS Level 3), which,
in general, can give better performance on the GPU.

xxMxQ_BLOCKSIZE
----------------------
.. doxygendefine:: xxMxQ_BLOCKSIZE

(As of the current rocSOLVER release, this constant has not been tuned for any specific cases.)



gebd2/gebrd and labrd functions
=================================

The computation of the bidiagonal form of a matrix is separated into blocked and
unblocked versions. The unblocked routine GEBD2 (and the auxiliary LABRD), based on BLAS Level 2 operations,
apply Householder reflections to one column and row at a time. The blocked routine GEBRD reduces a leading block of rows and
columns at each step using the unblocked function LABRD (provided the matrix is large enough), and applies the resulting block reflectors to
update the trailing submatrix. The application of the block reflectors is based on matrix-matrix operations (BLAS Level 3), which,
in general, can give better performance on the GPU.

GEBRD_BLOCKSIZE
---------------------
.. doxygendefine:: GEBRD_BLOCKSIZE

GEBRD_GEBD2_SWITCHSIZE
-----------------------
.. doxygendefine:: GEBRD_GEBD2_SWITCHSIZE

(As of the current rocSOLVER release, these constants have not been tuned for any specific cases.)



bdsqr function
==================

The Singular Value Decomposition of a bidiagonal matrix could be executed with one or multiple thread blocks, and it is
a blocking API that requires synchronization with the host.

BDSQR_SWITCH_SIZE
-------------------
.. doxygendefine:: BDSQR_SWITCH_SIZE

BDSQR_ITERS_PER_SYNC
----------------------
.. doxygendefine:: BDSQR_ITERS_PER_SYNC

(As of the current rocSOLVER release, this constants have not been tuned for any specific cases.)



gesvd function
==================

The Singular Value Decomposition of a matrix A could be sped up for matrices with sufficiently many more rows than
columns (or columns than rows) by starting with a QR factorization (or LQ factorization) of A and working with the
triangular factor afterwards.

THIN_SVD_SWITCH
------------------
.. doxygendefine:: THIN_SVD_SWITCH

(As of the current rocSOLVER release, this constant has not been tuned for any specific cases.)



sytd2/sytrd, hetd2/hetrd and latrd functions
==============================================

The computation of the tridiagonal form of a symmetric/Hermitian matrix is separated into blocked and
unblocked versions. The unblocked routines SYTD2/HETD2 (and the auxiliary LATRD), based on BLAS Level 2 operations,
apply Householder reflections to one column/row at a time. The blocked routine SYTRD reduces a block of rows and columns at
each step using the unblocked function LATRD (provided the matrix is large enough) and applies the resulting block reflector to
update the rest of the matrix. The application of the block reflectors is based on matrix-matrix operations (BLAS Level 3), which,
in general, can give better performance on the GPU.

xxTRD_BLOCKSIZE
----------------------
.. doxygendefine:: xxTRD_BLOCKSIZE

xxTRD_xxTD2_SWITCHSIZE
-----------------------
.. doxygendefine:: xxTRD_xxTD2_SWITCHSIZE

(As of the current rocSOLVER release, these constants have not been tuned for any specific cases.)



sygs2/sygst and hegs2/hegst functions
======================================

The reduction of a symmetric/Hermitian-definite generalized eigenproblem to standard form is separated into
blocked and unblocked versions. The unblocked routines SYGS2/HEGS2 reduce the matrix A
one column/row at a time with vector operations and rank-2 updates (BLAS Level 2). The blocked
routines SYGST/HEGST reduce a leading block of A at each step using the unblocked methods (provided A is large enough)
and update the trailing matrix with BLAS Level 3 operations (matrix products
and rank-2k updates), which, in general, can give better performance on the GPU.

xxGST_BLOCKSIZE
------------------------
.. doxygendefine:: xxGST_BLOCKSIZE

(As of the current rocSOLVER release, this constant has not been tuned for any specific cases.)



syevd, heevd and stedc functions
=====================================

When running SYEVD/HEEVD (or the corresponding batched and strided-batched routines),
the computation of the eigenvectors of the associated tridiagonal matrix
can be sped up using a divide-and-conquer
approach (implemented in STEDC), provided the size of the independent block is large enough.

STEDC_MIN_DC_SIZE
-------------------
.. doxygendefine:: STEDC_MIN_DC_SIZE

(As of the current rocSOLVER release, this constant has not been tuned for any specific cases.)

STEDC_NUM_SPLIT_BLKS
---------------------
.. doxygendefine:: STEDC_NUM_SPLIT_BLKS

(As of the current rocSOLVER release, this constant has not been tuned for any specific cases.)


syevj, heevj, syevdj and heevdj functions
===========================================

The Jacobi eigensolver routines SYEVJ/HEEVJ (or the corresponding batched and strided-batched routines) can
be executed with a single kernel call (for small-size matrices) or with multiple kernel calls (for large-size
matrices). In the former case, the matrix is considered unblocked, Jacobi rotations are applied directly using the
computed cosine and sine values, and the number of iterations/sweeps is controlled on the GPU. In the latter case,
the matrix is partitioned into blocks, Jacobi rotations are accumulated per block (to be applied in separate kernel
calls), and the number of iterations/sweeps is controlled by the CPU (requiring synchronization of the handle stream).

When running SYEVDJ/HEEVDJ (or the corresponding batched and strided-batched routines),
the computation of the eigenvectors of the associated tridiagonal matrix
can be sped up using a divide-and-conquer approach,
provided the size of the independent block is large enough.

SYEVJ_BLOCKED_SWITCH
----------------------
.. doxygendefine:: SYEVJ_BLOCKED_SWITCH

(As of the current rocSOLVER release, this constant has not been tuned for any specific cases.)

SYEVDJ_MIN_DC_SIZE
-------------------
.. doxygendefine:: SYEVDJ_MIN_DC_SIZE

(As of the current rocSOLVER release, this constant has not been tuned for any specific cases.)



potf2/potrf functions
=========================

The Cholesky factorization is separated into blocked (right-looking) and unblocked versions. The unblocked
routine POTF2, based on BLAS Level 2 operations, computes one diagonal element at a time
and scales the corresponding row/column. The blocked routine POTRF factorizes a leading block of rows/columns
at each step using the unblocked algorithm (provided the matrix is large enough) and updates the trailing matrix with BLAS Level 3
operations (symmetric rank-k updates), which, in general, can give better performance on the GPU.

POTRF_BLOCKSIZE
------------------------
.. doxygendefine:: POTRF_BLOCKSIZE

POTRF_POTF2_SWITCHSIZE
------------------------
.. doxygendefine:: POTRF_POTF2_SWITCHSIZE

(As of the current rocSOLVER release, these constants have not been tuned for any specific cases.)



sytf2/sytrf and lasyf functions
=================================

The Bunch-Kaufman factorization is separated into blocked and unblocked versions. The unblocked routine SYTF2
generates one 1-by-1 or 2-by-2 diagonal block at a time and applies a rank-1 update. The blocked routine SYTRF executes
a partial factorization of a given maximum number of diagonal elements (LASYF) at each step (provided the matrix is large enough),
and updates the rest of the matrix with matrix-matrix operations (BLAS Level 3), which, in general, can give better performance on the GPU.

SYTRF_BLOCKSIZE
----------------
.. doxygendefine:: SYTRF_BLOCKSIZE

SYTRF_SYTF2_SWITCHSIZE
-----------------------
.. doxygendefine:: SYTRF_SYTF2_SWITCHSIZE

(As of the current rocSOLVER release, these constants have not been tuned for any specific cases.)












getf2/getrf functions
========================

GETF2_MAX_COLS
---------------

GETF2_MAX_THDS
---------------

GETF2_OPTIM_NGRP
-----------------

GETRF_NUM_INTERVALS
--------------------

GETRF_INTERVALS
----------------

GETRF_BLKSIZES
---------------

GETRF_BATCH_NUM_INTERVALS
----------------------------

GETRF_BATCH_INTERVALS
----------------------

GETRF_BATCH_BLKSIZES
-------------------------

GETRF_NPVT_NUM_INTERVALS
--------------------------

GETRF_NPVT_INTERVALS
----------------------

GETRF_NPVT_BLKSIZES
---------------------

GETRF_NPVT_BATCH_NUM_INTERVALS
-------------------------------

GETRF_NPVT_BATCH_INTERVALS
---------------------------

GETRF_NPVT_BATCH_BLKSIZES
---------------------------




getri function
================

GETRI_MAX_COLS
---------------

GETRI_TINY_SIZE
----------------

GETRI_NUM_INTERVALS
--------------------

GETRI_INTERVALS
----------------

GETRI_BLKSIZES
----------------

GETRI_BATCH_TINY_SIZE
-----------------------

GETRI_BATCH_NUM_INTERVALS
--------------------------

GETRI_BATCH_INTERVALS
------------------------

GETRI_BATCH_BLKSIZES
---------------------


trtri function
=================

TRTRI_MAX_COLS
---------------

TRTRI_NUM_INTERVALS
--------------------

TRTRI_INTERVALS
----------------

TRTRI_BLKSIZES
---------------

TRTRI_BATCH_NUM_INTERVALS
--------------------------

TRTRI_BATCH_INTERVALS
----------------------

TRTRI_BATCH_BLKSIZES
---------------------