Description Traits#
Description traits can be retrieved from a function descriptor using the helper functions provided below.
Trait |
Description |
---|---|
Requested generator. |
|
Number of rounds for the Philox generator. |
|
Target architecture for the underlying computation. |
|
|
|
|
|
|
|
|
For example we can use the description traits conveniently in a user code:
#include <curanddx.hpp>
using RNG = decltype(curanddx::Generator<curanddx::philox4_32>()
+ curanddx::PhiloxRounds<7>()
+ curanddx::SM<800>());
if(curanddx::is_complete_rand<RNG>::value) {
if (curanddx::generator_of_v<RNG> == philox4_32) {
std::cout << "Use Philox generator with " << philox_rounds_of_v<RNG> << " rounds \n";
}
}
generator_of Trait#
// curanddx::generator
curanddx::generator_of<RNG>::value
curanddx::generator_of_v<RNG>
generator_of
trait gives the type of generator that will be used for the RNG operation, as set by Generator Operator.
philox_rounds_of Trait#
// unsigned int
curanddx::philox_rounds_of<RNG>::value
curanddx::philox_rounds_of_v<RNG>
The number of rounds used for the Philox4_32 generator, as set by PhiloxRounds Operator.
sm_of Trait#
// unsigned int
curanddx::sm_of<RNG>::value
curanddx::sm_of_v<RNG>
GPU architecture used to run the function, as set by SM Operator. For example, gives 700
for Volta (sm_70).
is_rand Trait#
// bool
curanddx::is_rand<RNG>::value
curanddx::is_rand_v<RNG>
The trait is true
if the descriptor is a function description, formed with description operators.
is_rand_execution Trait#
// bool
curanddx::is_rand_execution<RNG>::value
curanddx::is_rand_execution_v<RNG>
The trait is true
if the descriptor is a function description configured for execution, formed with both description operators and execution operators.
is_complete_rand Trait#
// bool
curanddx::is_complete_rand<RNG>::value
curanddx::is_complete_rand_v<RNG>
The trait is true
if the descriptor is a complete function description, formed with description operators.
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.
For a cuRANDDx function descriptor to be complete, the following is required:
A single instance of Generator Operator. The default is used if the
Generator
operator is not defined.A single instance of SM Operator.
is_complete_rand_execution Trait#
// bool
curanddx::is_complete_rand_execution<RNG>::value
curanddx::is_complete_rand_execution_v<RNG>
The trait is true
if both is_rand_execution Trait and is_complete_rand Trait are true
.
Note
If is_complete_rand_execution Trait is true
for a function descriptor,
then we can use the Execution Methods to execute the function.