Description Traits#
Description traits can be retrieved from a function descriptor using the helper functions provided below.
Trait |
Description |
---|---|
Problem size we intend to solve. |
|
Data type used, either |
|
Precision of the underlying floating-point values used for |
|
Function to be executed. |
|
Arrangement mode of the matrix |
|
Transpose mode of the matrix |
|
Fill mode of the symmetric or Hermitian matrix A - |
|
Side of a matrix multiplication - |
|
Leading dimension of matrix |
|
Target architecture for the underlying computation. |
|
CUDA block dimensions used to run the function. |
|
|
|
|
|
|
|
|
For example, we can use the description traits conveniently in a user code:
#include <cusolverdx.hpp>
using namespace cusolverdx;
using Solver = decltype(Size<64>()
+ Precision<double>()
+ Function<function::potrf>()
+ FillMode<lower>
+ SM<800>()
+ Block());
if(cusolverdx::is_complete_solver<Solver>::value) {
std::cout << "Matrix A (M x N): "
<< cusolverdx::size_of<Solver>::m << " x "
<< cusolverdx::size_of<Solver>::n << std::endl;
}
Size Trait#
// std::tuple<unsigned int, unsigned int, unsigned int>
cusolverdx::size_of<Solver>::value
cusolverdx::size_of_v<Solver>
// unsigned int
cusolverdx::size_of<Solver>::m
cusolverdx::size_of_v_m<Solver>
cusolverdx::size_of<Solver>::n
cusolverdx::size_of_v_n<Solver>
cusolverdx::size_of<Solver>::k
cusolverdx::size_of_v_k<Solver>
size_of
trait gives size of the problem we want to solve, as set by Size Operator.
If the descriptor was not created using a Size Operator, compilation will fail with an error message.
Type Trait#
// cusolverdx::type
cusolverdx::type_of<Solver>::value
cusolverdx::type_of_v<Solver>
Data type (cusolverdx::type::real
or cusolverdx::type::complex
) used in the function, as set by Type Operator.
Precision Trait#
// Precision type
cusolverdx::precision_of<Solver>::a_type
cusolverdx::precision_of_a_t<Solver>
cusolverdx::precision_of<Solver>::x_type
cusolverdx::precision_of_x_t<Solver>
cusolverdx::precision_of<Solver>::b_type
cusolverdx::precision_of_b_t<Solver>
Floating-point precision of the input and output data A
, X
, and B
, as set by Precision Operator. Note that currently cuSolver only supports A
, X
and B
being of the same precision.
Function Trait#
// cusolverdx::function
cusolverdx::function_of<Solver>::value
cusolverdx::function_of_v<Solver>
Function to be executed, as set by Function Operator. If the descriptor was not created using a Function Operator, compilation will fail with an error message.
Arrangement Trait#
// std::tuple<arrangement, arrangement>
cusolverdx::arrangement_of<Solver>::value
cusolverdx::arrangement_of_v<Solver>
// cusolverdx::arrangement
cusolverdx::arrangement_of<Solver>::a
cusolverdx::arrangement_of_v_a<Solver>
cusolverdx::arrangement_of<Solver>::b
cusolverdx::arrangement_of_v_b<Solver>
Arrangement of A
and B
matrices, as set by Arrangement Operator. Output matrix X
is required to have the same memory arrangement as B
.
Transpose Mode Trait#
// cusolverdx::transpose
cusolverdx::transpose_mode_of<Solver>::value
cusolverdx::transpose_mode_of_v<Solver>
Transpose mode of A
matrix, as set by TransposeMode Operator.
Fill Mode Trait#
// cusolverdx::fill_mode
cusolverdx::fill_mode_of<Solver>::value
cusolverdx::fill_mode_of_v<Solver>
Fill mode of a symmetric or Hermitian matrix A
, as set by FillMode Operator.
Side Trait#
// cusolverdx::side
cusolverdx::side_of<Solver>::value
cusolverdx::side_of_v<Solver>
Side of a matrix multiplication, as set by Side Operator.
Diag Trait#
// cusolverdx::diag
cusolverdx::diag_of<Solver>::value
cusolverdx::diag_of_v<Solver>
Indicates whether the diagonal elements of matrix A
are ones or not, as set by Diag Operator.
Leading Dimension Trait#
// std::tuple<unsigned int, unsigned int>
cusolverdx::leading_dimension_of<Solver>::value
cusolverdx::leading_dimension_of_v<Solver>
// unsigned int
cusolverdx::leading_dimension_of<Solver>::a
cusolverdx::leading_dimension_of_v_a<Solver>
cusolverdx::leading_dimension_of<Solver>::b
cusolverdx::leading_dimension_of_v_b<Solver>
Leading dimension of matrices A
and B
in shared memory, as set by LeadingDimension Operator.
SM Trait#
// unsigned int
cusolverdx::sm_of<Solver>::value
cusolverdx::sm_of_v<Solver>
GPU architecture used to run the function, as set by SM Operator. For example, gives 700
for Volta (sm_70).
BlockDim Trait#
// dim3
cusolverdx::block_dim_of<Solver>::value
cusolverdx::block_dim_of_v<Solver>
Block dimensions used to run the function, as set by BlockDim Operator.
is_solver Trait#
// bool
cusolverdx::is_solver<Solver>::value
cusolverdx::is_solver_v<Solver>
Trait is true
if the descriptor is a function description, formed with description operators.
is_solver_execution Trait#
// bool
cusolverdx::is_solver_execution<Solver>::value
cusolverdx::is_solver_execution_v<Solver>
Trait is true
if the descriptor is a function description configured for execution, formed with both description operators and execution operators.
is_complete_solver Trait#
// bool
cusolverdx::is_complete_solver<Solver>::value
cusolverdx::is_complete_solver_v<Solver>
Trait is true
if the descriptor is a complete function description, formed with description operators. The requirement for a complete function descriptor is described here.
Note
Complete in this context means that the descriptor has been formed with all the necessary description operators and it is only missing execution operators to be able to run.
is_complete_solver_execution Trait#
// bool
cusolverdx::is_complete_solver_execution<Solver>::value
cusolverdx::is_complete_solver_execution_v<Solver>
Trait is true
if both is_solver_execution Trait and is_complete_solver Trait are true
.
Note
If is_complete_solver_execution Trait is true
for a function descriptor, then we can use the Execution Methods to execute the function.