hip.hiprand#
(No short description)
- Attributes:
- HIPRAND_VERSION (
int): Macro constant.
- HIPRAND_DEFAULT_MAX_BLOCK_SIZE (
int): Macro constant.
- HIPRAND_DEFAULT_MIN_WARPS_PER_EU (
int): Macro constant.
- rocrand_discrete_distribution:
alias of
rocrand_discrete_distribution_st- rocrand_generator:
alias of
rocrand_generator_base_type- hiprandGenerator_st:
alias of
rocrand_generator_base_type- hiprandDiscreteDistribution_st:
alias of
rocrand_discrete_distribution_st- hiprandGenerator_t:
alias of
rocrand_generator_base_type- hiprandDiscreteDistribution_t:
alias of
rocrand_discrete_distribution_st- hiprandStatus_t:
alias of
hiprandStatus- hiprandRngType_t:
alias of
hiprandRngType- hiprandDirectionVectorSet_t:
alias of
hiprandDirectionVectorSet
- HIPRAND_VERSION (
- class hip.hiprand.uint4(*args, **kwargs)#
Bases:
PointerPython wrapper for cdef class chiprand.uint4.
Python wrapper for cdef class chiprand.uint4.
If this type is initialized via its
__init__method, it allocates a member of the underlying C type and destroys it again if the wrapper type is deallocated.This type also serves as adapter when appearing as argument type in a function signature. In this case, the type can further be initialized from a number of Python objects:
None:This will set the
self._ptrattribute toNULL.int:Interprets the integer value as pointer address and writes it to
self._ptr. No ownership is transferred.-
Takes the pointer address
pyobj.valueand writes it toself._ptr. No ownership is transferred. objectthat implements the CUDA Array Interface protocol:Takes the integer-valued pointer address, i.e. the first entry of the
datatuple frompyobj’s member__cuda_array_interface__and writes it toself._ptr.objectthat implements the Python buffer protocol:If the object represents a simple contiguous array, writes the
Py_bufferassociated withpyobjtoself._py_buffer, sets theself._py_buffer_acquiredflag toTrue, and writesself._py_buffer.bufto the data pointerself._ptr.-
Takes the pointer address
pyobj._ptrand writes it toself._ptr. No ownership is transferred.
Type checks are performed in the above order.
- C Attributes:
- _ptr (C type
void *, protected): Stores a pointer to the data of the original Python object.
- _is_ptr_owner (C type
bint, protected): If this wrapper is the owner of the underlying data.
- _py_buffer (C type ``Py_buffer`, protected):
Stores a pointer to the data of the original Python object.
- _py_buffer_acquired (C type
bint, protected): Stores a pointer to the data of the original Python object.
- _ptr (C type
- static PROPERTIES()#
- __getitem__(key, /)#
Return self[key].
- __init__()#
Constructor type uint4.
Constructor for type uint4.
- as_c_void_p(self)#
Returns the data’s address as
ctypes.c_void_pNote:Implemented as function to not collide with autogenerated property names.
- c_sizeof(self)#
Returns the size of the underlying C type in bytes. Note:
Implemented as function to not collide with autogenerated property names.
- createRef(self) Pointer#
Creates are reference to this pointer.
Returns a
Pointerthat stores the address of this `~.Pointer’s data pointer.- Note:
No ownership information is transferred.
- static fromObj(pyobj)#
Creates a uint4 from a Python object.
Derives a uint4 from the given Python object
pyobj. In casepyobjis itself anuint4reference, this method returns it directly. No newuint4is created in this case.
- get_w(self, i)#
Get value
wof(<chiprand.uint4*>self._ptr)[i].
- get_x(self, i)#
Get value
xof(<chiprand.uint4*>self._ptr)[i].
- get_y(self, i)#
Get value
yof(<chiprand.uint4*>self._ptr)[i].
- get_z(self, i)#
Get value
zof(<chiprand.uint4*>self._ptr)[i].
- is_ptr_null#
If data pointer is NULL.
- set_w(self, i, unsigned int value)#
Set value
wof(<chiprand.uint4*>self._ptr)[i].
- set_x(self, i, unsigned int value)#
Set value
xof(<chiprand.uint4*>self._ptr)[i].
- set_y(self, i, unsigned int value)#
Set value
yof(<chiprand.uint4*>self._ptr)[i].
- set_z(self, i, unsigned int value)#
Set value
zof(<chiprand.uint4*>self._ptr)[i].
- w#
(undocumented)
- x#
(undocumented)
- y#
(undocumented)
- z#
(undocumented)
- class hip.hiprand.rocrand_discrete_distribution_st(*args, **kwargs)#
Bases:
PointerPython wrapper for cdef class chiprand.rocrand_discrete_distribution_st.
Python wrapper for cdef class chiprand.rocrand_discrete_distribution_st.
If this type is initialized via its
__init__method, it allocates a member of the underlying C type and destroys it again if the wrapper type is deallocated.This type also serves as adapter when appearing as argument type in a function signature. In this case, the type can further be initialized from a number of Python objects:
None:This will set the
self._ptrattribute toNULL.int:Interprets the integer value as pointer address and writes it to
self._ptr. No ownership is transferred.-
Takes the pointer address
pyobj.valueand writes it toself._ptr. No ownership is transferred. objectthat implements the CUDA Array Interface protocol:Takes the integer-valued pointer address, i.e. the first entry of the
datatuple frompyobj’s member__cuda_array_interface__and writes it toself._ptr.objectthat implements the Python buffer protocol:If the object represents a simple contiguous array, writes the
Py_bufferassociated withpyobjtoself._py_buffer, sets theself._py_buffer_acquiredflag toTrue, and writesself._py_buffer.bufto the data pointerself._ptr.-
Takes the pointer address
pyobj._ptrand writes it toself._ptr. No ownership is transferred.
Type checks are performed in the above order.
- C Attributes:
- _ptr (C type
void *, protected): Stores a pointer to the data of the original Python object.
- _is_ptr_owner (C type
bint, protected): If this wrapper is the owner of the underlying data.
- _py_buffer (C type ``Py_buffer`, protected):
Stores a pointer to the data of the original Python object.
- _py_buffer_acquired (C type
bint, protected): Stores a pointer to the data of the original Python object.
- _ptr (C type
- static PROPERTIES()#
- __getitem__(key, /)#
Return self[key].
- __init__()#
Constructor type rocrand_discrete_distribution_st.
Constructor for type rocrand_discrete_distribution_st.
- alias#
Alias table Note:
Setting this alias can be dangerous if the underlying pointer is from a python object that is later on garbage collected.
- as_c_void_p(self)#
Returns the data’s address as
ctypes.c_void_pNote:Implemented as function to not collide with autogenerated property names.
- c_sizeof(self)#
Returns the size of the underlying C type in bytes. Note:
Implemented as function to not collide with autogenerated property names.
- cdf#
Cumulative distribution function Note:
Setting this cdf can be dangerous if the underlying pointer is from a python object that is later on garbage collected.
- createRef(self) Pointer#
Creates are reference to this pointer.
Returns a
Pointerthat stores the address of this `~.Pointer’s data pointer.- Note:
No ownership information is transferred.
- static fromObj(pyobj)#
Creates a rocrand_discrete_distribution_st from a Python object.
Derives a rocrand_discrete_distribution_st from the given Python object
pyobj. In casepyobjis itself anrocrand_discrete_distribution_streference, this method returns it directly. No newrocrand_discrete_distribution_stis created in this case.
- get_alias(self, i)#
Get value
aliasof(<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].
- get_cdf(self, i)#
Get value
cdfof(<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].
- get_offset(self, i)#
Get value
offsetof(<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].
- get_probability(self, i)#
Get value
probabilityof(<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].
- get_size(self, i)#
Get value
sizeof(<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].
- is_ptr_null#
If data pointer is NULL.
- offset#
The distribution can be offset
- probability#
Probability data for the alias table Note:
Setting this probability can be dangerous if the underlying pointer is from a python object that is later on garbage collected.
- set_alias(self, i, value)#
Set value
aliasof(<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].- Note:
This can be dangerous if the pointer is from a python object that is later on garbage collected.
- set_cdf(self, i, value)#
Set value
cdfof(<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].- Note:
This can be dangerous if the pointer is from a python object that is later on garbage collected.
- set_offset(self, i, unsigned int value)#
Set value
offsetof(<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].
- set_probability(self, i, value)#
Set value
probabilityof(<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].- Note:
This can be dangerous if the pointer is from a python object that is later on garbage collected.
- set_size(self, i, unsigned int value)#
Set value
sizeof(<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].
- size#
Number of entries in the probability table
- hip.hiprand.rocrand_discrete_distribution#
alias of
rocrand_discrete_distribution_st
- class hip.hiprand.rocrand_generator_base_type#
Bases:
PointerPython wrapper for cdef class chiprand.rocrand_generator_base_type.
Python wrapper for cdef class chiprand.rocrand_generator_base_type.
If this type is initialized via its
__init__method, it allocates a member of the underlying C type and destroys it again if the wrapper type is deallocated.This type also serves as adapter when appearing as argument type in a function signature. In this case, the type can further be initialized from a number of Python objects:
None:This will set the
self._ptrattribute toNULL.int:Interprets the integer value as pointer address and writes it to
self._ptr. No ownership is transferred.-
Takes the pointer address
pyobj.valueand writes it toself._ptr. No ownership is transferred. objectthat implements the CUDA Array Interface protocol:Takes the integer-valued pointer address, i.e. the first entry of the
datatuple frompyobj’s member__cuda_array_interface__and writes it toself._ptr.objectthat implements the Python buffer protocol:If the object represents a simple contiguous array, writes the
Py_bufferassociated withpyobjtoself._py_buffer, sets theself._py_buffer_acquiredflag toTrue, and writesself._py_buffer.bufto the data pointerself._ptr.-
Takes the pointer address
pyobj._ptrand writes it toself._ptr. No ownership is transferred.
Type checks are performed in the above order.
- C Attributes:
- _ptr (C type
void *, protected): Stores a pointer to the data of the original Python object.
- _is_ptr_owner (C type
bint, protected): If this wrapper is the owner of the underlying data.
- _py_buffer (C type ``Py_buffer`, protected):
Stores a pointer to the data of the original Python object.
- _py_buffer_acquired (C type
bint, protected): Stores a pointer to the data of the original Python object.
- _ptr (C type
- static PROPERTIES()#
- __getitem__(key, /)#
Return self[key].
- __init__()#
Constructor.
- as_c_void_p(self)#
Returns the data’s address as
ctypes.c_void_pNote:Implemented as function to not collide with autogenerated property names.
- createRef(self) Pointer#
Creates are reference to this pointer.
Returns a
Pointerthat stores the address of this `~.Pointer’s data pointer.- Note:
No ownership information is transferred.
- static fromObj(pyobj)#
Creates a rocrand_generator_base_type from a Python object.
Derives a rocrand_generator_base_type from the given Python object
pyobj. In casepyobjis itself anrocrand_generator_base_typereference, this method returns it directly. No newrocrand_generator_base_typeis created in this case.
- is_ptr_null#
If data pointer is NULL.
- hip.hiprand.rocrand_generator#
alias of
rocrand_generator_base_type
- class hip.hiprand.rocrand_status(value)#
Bases:
_rocrand_status__BaserocRAND function call status type
- Attributes:
- ROCRAND_STATUS_SUCCESS:
No errors
- ROCRAND_STATUS_VERSION_MISMATCH:
Header file and linked library version do not match
- ROCRAND_STATUS_NOT_CREATED:
Generator was not created using rocrand_create_generator
- ROCRAND_STATUS_ALLOCATION_FAILED:
Memory allocation failed during execution
- ROCRAND_STATUS_TYPE_ERROR:
Generator type is wrong
- ROCRAND_STATUS_OUT_OF_RANGE:
Argument out of range
- ROCRAND_STATUS_LENGTH_NOT_MULTIPLE:
Requested size is not a multiple of quasirandom generator’s dimension, or requested size is not even (see rocrand_generate_normal()), or pointer is misaligned (see rocrand_generate_normal())
- ROCRAND_STATUS_DOUBLE_PRECISION_REQUIRED:
GPU does not have double precision
- ROCRAND_STATUS_LAUNCH_FAILURE:
Kernel launch failure
- ROCRAND_STATUS_INTERNAL_ERROR:
Internal library error
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- static ctypes_type()#
The type of the enum constants as ctypes type.
- ROCRAND_STATUS_SUCCESS = 0#
- ROCRAND_STATUS_VERSION_MISMATCH = 100#
- ROCRAND_STATUS_NOT_CREATED = 101#
- ROCRAND_STATUS_ALLOCATION_FAILED = 102#
- ROCRAND_STATUS_TYPE_ERROR = 103#
- ROCRAND_STATUS_OUT_OF_RANGE = 104#
- ROCRAND_STATUS_LENGTH_NOT_MULTIPLE = 105#
- ROCRAND_STATUS_DOUBLE_PRECISION_REQUIRED = 106#
- ROCRAND_STATUS_LAUNCH_FAILURE = 107#
- ROCRAND_STATUS_INTERNAL_ERROR = 108#
- class hip.hiprand.rocrand_rng_type(value)#
Bases:
_rocrand_rng_type__BaserocRAND generator type
- Attributes:
- ROCRAND_RNG_PSEUDO_DEFAULT:
Default pseudorandom generator
- ROCRAND_RNG_PSEUDO_XORWOW:
XORWOW pseudorandom generator
- ROCRAND_RNG_PSEUDO_MRG32K3A:
MRG32k3a pseudorandom generator
- ROCRAND_RNG_PSEUDO_MTGP32:
Mersenne Twister MTGP32 pseudorandom generator
- ROCRAND_RNG_PSEUDO_PHILOX4_32_10:
PHILOX-4x32-10 pseudorandom generator
- ROCRAND_RNG_PSEUDO_MRG31K3P:
MRG31k3p pseudorandom generator
- ROCRAND_RNG_PSEUDO_LFSR113:
LFSR113 pseudorandom generator
- ROCRAND_RNG_PSEUDO_MT19937:
Mersenne Twister MT19937 pseudorandom generator
- ROCRAND_RNG_PSEUDO_THREEFRY2_32_20:
(undocumented)
- ROCRAND_RNG_PSEUDO_THREEFRY2_64_20:
(undocumented)
- ROCRAND_RNG_PSEUDO_THREEFRY4_32_20:
(undocumented)
- ROCRAND_RNG_PSEUDO_THREEFRY4_64_20:
(undocumented)
- ROCRAND_RNG_QUASI_DEFAULT:
Default quasirandom generator
- ROCRAND_RNG_QUASI_SOBOL32:
Sobol32 quasirandom generator
- ROCRAND_RNG_QUASI_SCRAMBLED_SOBOL32:
Scrambled Sobol32 quasirandom generator
- ROCRAND_RNG_QUASI_SOBOL64:
Sobol64 quasirandom generator
- ROCRAND_RNG_QUASI_SCRAMBLED_SOBOL64:
Scrambled Sobol64 quasirandom generator
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- static ctypes_type()#
The type of the enum constants as ctypes type.
- ROCRAND_RNG_PSEUDO_DEFAULT = 400#
- ROCRAND_RNG_PSEUDO_XORWOW = 401#
- ROCRAND_RNG_PSEUDO_MRG32K3A = 402#
- ROCRAND_RNG_PSEUDO_MTGP32 = 403#
- ROCRAND_RNG_PSEUDO_PHILOX4_32_10 = 404#
- ROCRAND_RNG_PSEUDO_MRG31K3P = 405#
- ROCRAND_RNG_PSEUDO_LFSR113 = 406#
- ROCRAND_RNG_PSEUDO_MT19937 = 407#
- ROCRAND_RNG_PSEUDO_THREEFRY2_32_20 = 408#
- ROCRAND_RNG_PSEUDO_THREEFRY2_64_20 = 409#
- ROCRAND_RNG_PSEUDO_THREEFRY4_32_20 = 410#
- ROCRAND_RNG_PSEUDO_THREEFRY4_64_20 = 411#
- ROCRAND_RNG_QUASI_DEFAULT = 500#
- ROCRAND_RNG_QUASI_SOBOL32 = 501#
- ROCRAND_RNG_QUASI_SCRAMBLED_SOBOL32 = 502#
- ROCRAND_RNG_QUASI_SOBOL64 = 504#
- ROCRAND_RNG_QUASI_SCRAMBLED_SOBOL64 = 505#
- class hip.hiprand.rocrand_ordering(value)#
Bases:
_rocrand_ordering__BaserocRAND generator ordering
- Attributes:
- ROCRAND_ORDERING_PSEUDO_BEST:
Best ordering for pseudorandom results
- ROCRAND_ORDERING_PSEUDO_DEFAULT:
Default ordering for pseudorandom results
- ROCRAND_ORDERING_PSEUDO_SEEDED:
Fast lower quality pseudorandom results
- ROCRAND_ORDERING_PSEUDO_LEGACY:
Legacy ordering for pseudorandom results
- ROCRAND_ORDERING_PSEUDO_DYNAMIC:
Adjust to the device executing the generator
- ROCRAND_ORDERING_QUASI_DEFAULT:
n-dimensional ordering for quasirandom results
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- static ctypes_type()#
The type of the enum constants as ctypes type.
- ROCRAND_ORDERING_PSEUDO_BEST = 100#
- ROCRAND_ORDERING_PSEUDO_DEFAULT = 101#
- ROCRAND_ORDERING_PSEUDO_SEEDED = 102#
- ROCRAND_ORDERING_PSEUDO_LEGACY = 103#
- ROCRAND_ORDERING_PSEUDO_DYNAMIC = 104#
- ROCRAND_ORDERING_QUASI_DEFAULT = 201#
- class hip.hiprand.rocrand_direction_vector_set(value)#
Bases:
_rocrand_direction_vector_set__BaserocRAND vector set
- Attributes:
- ROCRAND_DIRECTION_VECTORS_32_JOEKUO6:
(undocumented)
- ROCRAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6:
(undocumented)
- ROCRAND_DIRECTION_VECTORS_64_JOEKUO6:
(undocumented)
- ROCRAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6:
(undocumented)
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- static ctypes_type()#
The type of the enum constants as ctypes type.
- ROCRAND_DIRECTION_VECTORS_32_JOEKUO6 = 101#
- ROCRAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6 = 102#
- ROCRAND_DIRECTION_VECTORS_64_JOEKUO6 = 103#
- ROCRAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6 = 104#
- hip.hiprand.hiprandGenerator_st#
alias of
rocrand_generator_base_type
- hip.hiprand.hiprandDiscreteDistribution_st#
alias of
rocrand_discrete_distribution_st
- class hip.hiprand.hiprandDirectionVectors32_t#
Bases:
PointerPython wrapper for cdef class chiprand.hiprandDirectionVectors32_t.
Python wrapper for cdef class chiprand.hiprandDirectionVectors32_t.
If this type is initialized via its
__init__method, it allocates a member of the underlying C type and destroys it again if the wrapper type is deallocated.This type also serves as adapter when appearing as argument type in a function signature. In this case, the type can further be initialized from a number of Python objects:
None:This will set the
self._ptrattribute toNULL.int:Interprets the integer value as pointer address and writes it to
self._ptr. No ownership is transferred.-
Takes the pointer address
pyobj.valueand writes it toself._ptr. No ownership is transferred. objectthat implements the CUDA Array Interface protocol:Takes the integer-valued pointer address, i.e. the first entry of the
datatuple frompyobj’s member__cuda_array_interface__and writes it toself._ptr.objectthat implements the Python buffer protocol:If the object represents a simple contiguous array, writes the
Py_bufferassociated withpyobjtoself._py_buffer, sets theself._py_buffer_acquiredflag toTrue, and writesself._py_buffer.bufto the data pointerself._ptr.-
Takes the pointer address
pyobj._ptrand writes it toself._ptr. No ownership is transferred.
Type checks are performed in the above order.
- C Attributes:
- _ptr (C type
void *, protected): Stores a pointer to the data of the original Python object.
- _is_ptr_owner (C type
bint, protected): If this wrapper is the owner of the underlying data.
- _py_buffer (C type ``Py_buffer`, protected):
Stores a pointer to the data of the original Python object.
- _py_buffer_acquired (C type
bint, protected): Stores a pointer to the data of the original Python object.
- _ptr (C type
- __getitem__(key, /)#
Return self[key].
- __init__()#
Constructor.
- as_c_void_p(self)#
Returns the data’s address as
ctypes.c_void_pNote:Implemented as function to not collide with autogenerated property names.
- c_sizeof(self)#
Returns the size of the underlying C type in bytes. Note:
Implemented as function to not collide with autogenerated property names.
- createRef(self) Pointer#
Creates are reference to this pointer.
Returns a
Pointerthat stores the address of this `~.Pointer’s data pointer.- Note:
No ownership information is transferred.
- static fromObj(pyobj)#
Creates a hiprandDirectionVectors32_t from a Python object.
Derives a hiprandDirectionVectors32_t from the given Python object
pyobj. In casepyobjis itself anhiprandDirectionVectors32_treference, this method returns it directly. No newhiprandDirectionVectors32_tis created in this case.
- is_ptr_null#
If data pointer is NULL.
- class hip.hiprand.hiprandDirectionVectors64_t#
Bases:
PointerPython wrapper for cdef class chiprand.hiprandDirectionVectors64_t.
Python wrapper for cdef class chiprand.hiprandDirectionVectors64_t.
If this type is initialized via its
__init__method, it allocates a member of the underlying C type and destroys it again if the wrapper type is deallocated.This type also serves as adapter when appearing as argument type in a function signature. In this case, the type can further be initialized from a number of Python objects:
None:This will set the
self._ptrattribute toNULL.int:Interprets the integer value as pointer address and writes it to
self._ptr. No ownership is transferred.-
Takes the pointer address
pyobj.valueand writes it toself._ptr. No ownership is transferred. objectthat implements the CUDA Array Interface protocol:Takes the integer-valued pointer address, i.e. the first entry of the
datatuple frompyobj’s member__cuda_array_interface__and writes it toself._ptr.objectthat implements the Python buffer protocol:If the object represents a simple contiguous array, writes the
Py_bufferassociated withpyobjtoself._py_buffer, sets theself._py_buffer_acquiredflag toTrue, and writesself._py_buffer.bufto the data pointerself._ptr.-
Takes the pointer address
pyobj._ptrand writes it toself._ptr. No ownership is transferred.
Type checks are performed in the above order.
- C Attributes:
- _ptr (C type
void *, protected): Stores a pointer to the data of the original Python object.
- _is_ptr_owner (C type
bint, protected): If this wrapper is the owner of the underlying data.
- _py_buffer (C type ``Py_buffer`, protected):
Stores a pointer to the data of the original Python object.
- _py_buffer_acquired (C type
bint, protected): Stores a pointer to the data of the original Python object.
- _ptr (C type
- __getitem__(key, /)#
Return self[key].
- __init__()#
Constructor.
- as_c_void_p(self)#
Returns the data’s address as
ctypes.c_void_pNote:Implemented as function to not collide with autogenerated property names.
- c_sizeof(self)#
Returns the size of the underlying C type in bytes. Note:
Implemented as function to not collide with autogenerated property names.
- createRef(self) Pointer#
Creates are reference to this pointer.
Returns a
Pointerthat stores the address of this `~.Pointer’s data pointer.- Note:
No ownership information is transferred.
- static fromObj(pyobj)#
Creates a hiprandDirectionVectors64_t from a Python object.
Derives a hiprandDirectionVectors64_t from the given Python object
pyobj. In casepyobjis itself anhiprandDirectionVectors64_treference, this method returns it directly. No newhiprandDirectionVectors64_tis created in this case.
- is_ptr_null#
If data pointer is NULL.
- hip.hiprand.hiprandGenerator_t#
alias of
rocrand_generator_base_type
- hip.hiprand.hiprandDiscreteDistribution_t#
alias of
rocrand_discrete_distribution_st
- class hip.hiprand.hiprandStatus(value)#
Bases:
_hiprandStatus__BasehipRAND function call status type
- Attributes:
- HIPRAND_STATUS_SUCCESS:
Success
- HIPRAND_STATUS_VERSION_MISMATCH:
Header file and linked library version do not match
- HIPRAND_STATUS_NOT_INITIALIZED:
Generator not created
- HIPRAND_STATUS_ALLOCATION_FAILED:
Memory allocation failed
- HIPRAND_STATUS_TYPE_ERROR:
Generator type is wrong
- HIPRAND_STATUS_OUT_OF_RANGE:
Argument out of range
- HIPRAND_STATUS_LENGTH_NOT_MULTIPLE:
Requested size is not a multiple of quasirandom generator’s dimension, or requested size is not even (see hiprandGenerateNormal()), or pointer is misaligned (see hiprandGenerateNormal())
- HIPRAND_STATUS_DOUBLE_PRECISION_REQUIRED:
GPU does not have double precision
- HIPRAND_STATUS_LAUNCH_FAILURE:
Kernel launch failure
- HIPRAND_STATUS_PREEXISTING_FAILURE:
Preexisting failure on library entry
- HIPRAND_STATUS_INITIALIZATION_FAILED:
Initialization of HIP failed
- HIPRAND_STATUS_ARCH_MISMATCH:
Architecture mismatch, GPU does not support requested feature
- HIPRAND_STATUS_INTERNAL_ERROR:
Internal library error
- HIPRAND_STATUS_NOT_IMPLEMENTED:
Feature not implemented yet
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- static ctypes_type()#
The type of the enum constants as ctypes type.
- HIPRAND_STATUS_SUCCESS = 0#
- HIPRAND_STATUS_VERSION_MISMATCH = 100#
- HIPRAND_STATUS_NOT_INITIALIZED = 101#
- HIPRAND_STATUS_ALLOCATION_FAILED = 102#
- HIPRAND_STATUS_TYPE_ERROR = 103#
- HIPRAND_STATUS_OUT_OF_RANGE = 104#
- HIPRAND_STATUS_LENGTH_NOT_MULTIPLE = 105#
- HIPRAND_STATUS_DOUBLE_PRECISION_REQUIRED = 106#
- HIPRAND_STATUS_LAUNCH_FAILURE = 201#
- HIPRAND_STATUS_PREEXISTING_FAILURE = 202#
- HIPRAND_STATUS_INITIALIZATION_FAILED = 203#
- HIPRAND_STATUS_ARCH_MISMATCH = 204#
- HIPRAND_STATUS_INTERNAL_ERROR = 999#
- HIPRAND_STATUS_NOT_IMPLEMENTED = 1000#
- hip.hiprand.hiprandStatus_t#
alias of
hiprandStatus
- class hip.hiprand.hiprandRngType(value)#
Bases:
_hiprandRngType__BasehipRAND generator type
- Attributes:
HIPRAND_RNG_TEST:
- HIPRAND_RNG_PSEUDO_DEFAULT:
Default pseudorandom generator
- HIPRAND_RNG_PSEUDO_XORWOW:
XORWOW pseudorandom generator
- HIPRAND_RNG_PSEUDO_MRG32K3A:
MRG32k3a pseudorandom generator
- HIPRAND_RNG_PSEUDO_MTGP32:
Mersenne Twister MTGP32 pseudorandom generator
- HIPRAND_RNG_PSEUDO_MT19937:
Mersenne Twister 19937
- HIPRAND_RNG_PSEUDO_PHILOX4_32_10:
PHILOX_4x32 (10 rounds) pseudorandom generator
- HIPRAND_RNG_QUASI_DEFAULT:
Default quasirandom generator
- HIPRAND_RNG_QUASI_SOBOL32:
Sobol32 quasirandom generator
- HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL32:
Scrambled Sobol32 quasirandom generator
- HIPRAND_RNG_QUASI_SOBOL64:
Sobol64 quasirandom generator
- HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64:
Scrambled Sobol64 quasirandom generator
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- static ctypes_type()#
The type of the enum constants as ctypes type.
- HIPRAND_RNG_TEST = 0#
- HIPRAND_RNG_PSEUDO_DEFAULT = 400#
- HIPRAND_RNG_PSEUDO_XORWOW = 401#
- HIPRAND_RNG_PSEUDO_MRG32K3A = 402#
- HIPRAND_RNG_PSEUDO_MTGP32 = 403#
- HIPRAND_RNG_PSEUDO_MT19937 = 404#
- HIPRAND_RNG_PSEUDO_PHILOX4_32_10 = 405#
- HIPRAND_RNG_QUASI_DEFAULT = 500#
- HIPRAND_RNG_QUASI_SOBOL32 = 501#
- HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL32 = 502#
- HIPRAND_RNG_QUASI_SOBOL64 = 503#
- HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64 = 504#
- hip.hiprand.hiprandRngType_t#
alias of
hiprandRngType
- class hip.hiprand.hiprandDirectionVectorSet(value)#
Bases:
_hiprandDirectionVectorSet__Base- Attributes:
- HIPRAND_DIRECTION_VECTORS_32_JOEKUO6:
(undocumented)
- HIPRAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6:
(undocumented)
- HIPRAND_DIRECTION_VECTORS_64_JOEKUO6:
(undocumented)
- HIPRAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6:
(undocumented)
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- static ctypes_type()#
The type of the enum constants as ctypes type.
- HIPRAND_DIRECTION_VECTORS_32_JOEKUO6 = 101#
- HIPRAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6 = 102#
- HIPRAND_DIRECTION_VECTORS_64_JOEKUO6 = 103#
- HIPRAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6 = 104#
- hip.hiprand.hiprandDirectionVectorSet_t#
alias of
hiprandDirectionVectorSet
- hip.hiprand.hiprandCreateGenerator(rng_type)#
Creates a new random number generator.
Creates a new random number generator of type
rng_type,and returns it ingenerator.That generator will use GPU to create random numbers.Values for
rng_typeare: - HIPRAND_RNG_PSEUDO_DEFAULT - HIPRAND_RNG_PSEUDO_XORWOW - HIPRAND_RNG_PSEUDO_MRG32K3A - HIPRAND_RNG_PSEUDO_MTGP32 - HIPRAND_RNG_PSEUDO_MT19937 - HIPRAND_RNG_PSEUDO_PHILOX4_32_10 - HIPRAND_RNG_QUASI_DEFAULT - HIPRAND_RNG_QUASI_SOBOL32 - HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL32 - HIPRAND_RNG_QUASI_SOBOL64 - HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64- Args:
- rng_type (
hiprandRngType): Type of random number generator to create
- rng_type (
- Returns:
A
tupleof size 2 that contains (in that order):hiprandStatus: HIPRAND_STATUS_ALLOCATION_FAILED, if memory allocation failedHIPRAND_STATUS_INITIALIZATION_FAILED if there was a problem setting up the GPU
HIPRAND_STATUS_VERSION_MISMATCH if the header file version does not match the dynamically linked library version
HIPRAND_STATUS_TYPE_ERROR if the value for
rng_typeis invalidHIPRAND_STATUS_NOT_IMPLEMENTED if generator of type
rng_typeis not implemented yetHIPRAND_STATUS_SUCCESS if generator was created successfully
rocrand_generator_base_type:Pointer to generator
- hip.hiprand.hiprandCreateGeneratorHost(rng_type)#
Creates a new random number generator on host.
Creates a new host random number generator of type
rng_typeand returns it ingenerator.Created generator will use host CPU to generate random numbers.Values for
rng_typeare: - HIPRAND_RNG_PSEUDO_DEFAULT - HIPRAND_RNG_PSEUDO_XORWOW - HIPRAND_RNG_PSEUDO_MRG32K3A - HIPRAND_RNG_PSEUDO_MTGP32 - HIPRAND_RNG_PSEUDO_MT19937 - HIPRAND_RNG_PSEUDO_PHILOX4_32_10 - HIPRAND_RNG_QUASI_DEFAULT - HIPRAND_RNG_QUASI_SOBOL32 - HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL32 - HIPRAND_RNG_QUASI_SOBOL64 - HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64- Args:
- rng_type (
hiprandRngType): Type of random number generator to create
- rng_type (
- Returns:
A
tupleof size 2 that contains (in that order):hiprandStatus: HIPRAND_STATUS_ALLOCATION_FAILED, if memory allocation failedHIPRAND_STATUS_VERSION_MISMATCH if the header file version does not match the dynamically linked library version
HIPRAND_STATUS_TYPE_ERROR if the value for
rng_typeis invalidHIPRAND_STATUS_NOT_IMPLEMENTED if host generator of type
rng_typeis not implemented yetHIPRAND_STATUS_SUCCESS if generator was created successfully
rocrand_generator_base_type:Pointer to generator
- hip.hiprand.hiprandDestroyGenerator(generator)#
Destroys random number generator.
Destroys random number generator and frees related memory.
- Args:
- generator (
rocrand_generator_base_type/object): Generator to be destroyed
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_SUCCESS if generator was destroyed successfully
- hip.hiprand.hiprandGenerate(generator, output_data, unsigned long n)#
Generates uniformly distributed 32-bit unsigned integers.
Generates
nuniformly distributed 32-bit unsigned integers and saves them tooutput_data.Generated numbers are between
0and2^32,including0and excluding2^32.Note:
generatormust be not be of typeHIPRAND_RNG_QUASI_SOBOL64orHIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of 32-bit unsigned integers to generate
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
- hip.hiprand.hiprandGenerateChar(generator, output_data, unsigned long n)#
Generates uniformly distributed 8-bit unsigned integers.
Generates
nuniformly distributed 8-bit unsigned integers and saves them tooutput_data.Generated numbers are between
0and2^8,including0and excluding2^8.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of 8-bit unsigned integers to generate
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
- hip.hiprand.hiprandGenerateShort(generator, output_data, unsigned long n)#
Generates uniformly distributed 16-bit unsigned integers.
Generates
nuniformly distributed 16-bit unsigned integers and saves them tooutput_data.Generated numbers are between
0and2^16,including0and excluding2^16.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of 16-bit unsigned integers to generate
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
- hip.hiprand.hiprandGenerateLongLong(generator, output_data, unsigned long n)#
Generates uniformly distributed 64-bit unsigned integers.
Generates
nuniformly distributed 64-bit unsigned integers and saves them tooutput_data.Generated numbers are between
0and2^64,including0and excluding2^64.Note:
generatormust be of typeHIPRAND_RNG_QUASI_SOBOL64orHIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of 64-bit unsigned integers to generate
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
- hip.hiprand.hiprandGenerateUniform(generator, output_data, unsigned long n)#
Generates uniformly distributed floats.
Generates
nuniformly distributed 32-bit floating-point values and saves them tooutput_data.Generated numbers are between
0.0fand1.0f,excluding0.0fand including1.0f.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of floats to generate
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not a multiple of the dimension
of used quasi-random generator
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
- hip.hiprand.hiprandGenerateUniformDouble(generator, output_data, unsigned long n)#
Generates uniformly distributed double-precision floating-point values.
Generates
nuniformly distributed 64-bit double-precision floating-point values and saves them tooutput_data.Generated numbers are between
0.0and1.0,excluding0.0and including1.0.Note: When
generatoris of type:HIPRAND_RNG_PSEUDO_MRG32K3A,HIPRAND_RNG_PSEUDO_MTGP32,HIPRAND_RNG_QUASI_SOBOL32,orHIPRAND_RNG_QUASI_SCRAMBLED_SOBOL32then the returneddoublevalues are generated from only 32 random bits each (one <tt>unsigned int</tt> value per one generateddouble).- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of floats to generate
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not a multiple of the dimension
of used quasi-random generator
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
- hip.hiprand.hiprandGenerateUniformHalf(generator, output_data, unsigned long n)#
Generates uniformly distributed half-precision floating-point values.
Generates
nuniformly distributed 16-bit half-precision floating-point values and saves them tooutput_data.Generated numbers are between
0.0and1.0,excluding0.0and including1.0.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of halfs to generate
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not a multiple of the dimension
of used quasi-random generator
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
- hip.hiprand.hiprandGenerateNormal(generator, output_data, unsigned long n, float mean, float stddev)#
Generates normally distributed floats.
Generates
nnormally distributed 32-bit floating-point values and saves them tooutput_data.- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not even,output_datais not
aligned to
sizeof(float2)bytes, ornis not a multiple of the dimension of used quasi-random generatorHIPRAND_STATUS_SUCCESS if random numbers were successfully generated
- hip.hiprand.hiprandGenerateNormalDouble(generator, output_data, unsigned long n, double mean, double stddev)#
Generates normally distributed doubles.
Generates
nnormally distributed 64-bit double-precision floating-point numbers and saves them tooutput_data.- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not even,output_datais not
aligned to
sizeof(double2)bytes, ornis not a multiple of the dimension of used quasi-random generatorHIPRAND_STATUS_SUCCESS if random numbers were successfully generated
- hip.hiprand.hiprandGenerateNormalHalf(generator, output_data, unsigned long n, int mean, int stddev)#
Generates normally distributed halfs.
Generates
nnormally distributed 16-bit half-precision floating-point numbers and saves them tooutput_data.- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not even,output_datais not
aligned to
sizeof(half2)bytes, ornis not a multiple of the dimension of used quasi-random generatorHIPRAND_STATUS_SUCCESS if random numbers were successfully generated
- hip.hiprand.hiprandGenerateLogNormal(generator, output_data, unsigned long n, float mean, float stddev)#
Generates log-normally distributed floats.
Generates
nlog-normally distributed 32-bit floating-point values and saves them tooutput_data.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of floats to generate
- mean (
float/int): Mean value of log normal distribution
- stddev (
float/int): Standard deviation value of log normal distribution
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not even,output_datais not
aligned to
sizeof(float2)bytes, ornis not a multiple of the dimension of used quasi-random generatorHIPRAND_STATUS_SUCCESS if random numbers were successfully generated
- hip.hiprand.hiprandGenerateLogNormalDouble(generator, output_data, unsigned long n, double mean, double stddev)#
Generates log-normally distributed doubles.
Generates
nlog-normally distributed 64-bit double-precision floating-point values and saves them tooutput_data.- Args:
- generator (
rocrand_generator_base_type/object): Generator to use
- output_data (
Pointer/object): Pointer to memory to store generated numbers
- n (
int): Number of doubles to generate
- mean (
float/int): Mean value of log normal distribution
- stddev (
float/int): Standard deviation value of log normal distribution
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not even,output_datais not
aligned to
sizeof(double2)bytes, ornis not a multiple of the dimension of used quasi-random generatorHIPRAND_STATUS_SUCCESS if random numbers were successfully generated
- hip.hiprand.hiprandGenerateLogNormalHalf(generator, output_data, unsigned long n, int mean, int stddev)#
Generates log-normally distributed halfs.
Generates
nlog-normally distributed 16-bit half-precision floating-point values and saves them tooutput_data.- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not even,output_datais not
aligned to
sizeof(half2)bytes, ornis not a multiple of the dimension of used quasi-random generatorHIPRAND_STATUS_SUCCESS if random numbers were successfully generated
- hip.hiprand.hiprandGeneratePoisson(generator, output_data, unsigned long n, double lambda_)#
Generates Poisson-distributed 32-bit unsigned integers.
Generates
nPoisson-distributed 32-bit unsigned integers and saves them tooutput_data.- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel
HIPRAND_STATUS_OUT_OF_RANGE if lambda is non-positive
HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if
nis not a multiple of the dimension
of used quasi-random generator
HIPRAND_STATUS_SUCCESS if random numbers were successfully generated
- hip.hiprand.hiprandGenerateSeeds(generator)#
Initializes the generator’s state on GPU or host.
Initializes the generator’s state on GPU or host.
If hiprandGenerateSeeds() was not called for a generator, it will be automatically called by functions which generates random numbers like hiprandGenerate(), hiprandGenerateUniform(), hiprandGenerateNormal() etc.
- Args:
- generator (
rocrand_generator_base_type/object): Generator to initialize
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was never createdHIPRAND_STATUS_PREEXISTING_FAILURE if there was an existing error from a previous kernel launch
HIPRAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason
HIPRAND_STATUS_SUCCESS if the seeds were generated successfully
- hip.hiprand.hiprandSetStream(generator, stream)#
Sets the current stream for kernel launches.
Sets the current stream for all kernel launches of the generator. All functions will use this stream.
- Args:
- generator (
rocrand_generator_base_type/object): Generator to modify
- stream (
ihipStream_t/object): Stream to use or NULL for default stream
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_SUCCESS if stream was set successfully
- hip.hiprand.hiprandSetPseudoRandomGeneratorSeed(generator, unsigned long long seed)#
Sets the seed of a pseudo-random number generator.
Sets the seed of the pseudo-random number generator.
This operation resets the generator’s internal state.
This operation does not change the generator’s offset.
- Args:
- generator (
rocrand_generator_base_type/object): Pseudo-random number generator
- seed (
int): New seed value
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_TYPE_ERROR if the generator is a quasi random number generator
HIPRAND_STATUS_SUCCESS if seed was set successfully
- hip.hiprand.hiprandSetGeneratorOffset(generator, unsigned long long offset)#
Sets the offset of a random number generator.
Sets the absolute offset of the random number generator.
This operation resets the generator’s internal state.
This operation does not change the generator’s seed.
Absolute offset cannot be set if generator’s type is HIPRAND_RNG_PSEUDO_MTGP32 or HIPRAND_RNG_PSEUDO_MT19937.
- Args:
- generator (
rocrand_generator_base_type/object): Random number generator
- offset (
int): New absolute offset
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initializedHIPRAND_STATUS_SUCCESS if offset was successfully set
HIPRAND_STATUS_TYPE_ERROR if generator’s type is HIPRAND_RNG_PSEUDO_MTGP32
or HIPRAND_RNG_PSEUDO_MT19937
- hip.hiprand.hiprandSetQuasiRandomGeneratorDimensions(generator, unsigned int dimensions)#
Set the number of dimensions of a quasi-random number generator.
Set the number of dimensions of a quasi-random number generator. Supported values of
dimensionsare 1 to 20000.This operation resets the generator’s internal state.
This operation does not change the generator’s offset.
- Args:
- generator (
rocrand_generator_base_type/object): Quasi-random number generator
- dimensions (
int): Number of dimensions
- generator (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_NOT_CREATED if the generator wasn’t createdHIPRAND_STATUS_TYPE_ERROR if the generator is not a quasi-random number generator
HIPRAND_STATUS_OUT_OF_RANGE if
dimensionsis out of rangeHIPRAND_STATUS_SUCCESS if the number of dimensions was set successfully
- hip.hiprand.hiprandGetVersion()#
Returns the version number of the cuRAND or rocRAND library.
Returns in
versionthe version number of the underlying cuRAND or rocRAND library.- Returns:
A
tupleof size 2 that contains (in that order):hiprandStatus: HIPRAND_STATUS_OUT_OF_RANGE ifversionis NULLHIPRAND_STATUS_SUCCESS if the version number was successfully returned
int:Version of the library
- hip.hiprand.hiprandCreatePoissonDistribution(double lambda_)#
Construct the histogram for a Poisson distribution.
Construct the histogram for the Poisson distribution with lambda
lambda.- Args:
- Returns:
A
tupleof size 2 that contains (in that order):hiprandStatus: HIPRAND_STATUS_ALLOCATION_FAILED if memory could not be allocatedHIPRAND_STATUS_OUT_OF_RANGE if
discrete_distributionpointer was nullHIPRAND_STATUS_OUT_OF_RANGE if lambda is non-positive
HIPRAND_STATUS_SUCCESS if the histogram was constructed successfully
rocrand_discrete_distribution_st:pointer to the histogram in device memory
- hip.hiprand.hiprandDestroyDistribution(discrete_distribution)#
Destroy the histogram array for a discrete distribution.
Destroy the histogram array for a discrete distribution created by hiprandCreatePoissonDistribution.
- Args:
- discrete_distribution (
rocrand_discrete_distribution_st/object): pointer to the histogram in device memory
- discrete_distribution (
- Returns:
A
tupleof size 1 that contains (in that order):hiprandStatus: HIPRAND_STATUS_OUT_OF_RANGE ifdiscrete_distributionwas nullHIPRAND_STATUS_SUCCESS if the histogram was destroyed successfully
- hip.hiprand.hiprandGetDirectionVectors32(set)#
(No short description, might be part of a group.)
- Args:
- set (
hiprandDirectionVectorSet): (undocumented)
- set (
- Returns:
A
tupleof size 1 that contains (in that order):- vectors (
hiprandDirectionVectors32_t): (undocumented)
- vectors (
- hip.hiprand.hiprandGetDirectionVectors64(set)#
(No short description, might be part of a group.)
- Args:
- set (
hiprandDirectionVectorSet): (undocumented)
- set (
- Returns:
A
tupleof size 1 that contains (in that order):- vectors (
hiprandDirectionVectors64_t): (undocumented)
- vectors (
- hip.hiprand.hiprandGetScrambleConstants32(constants)#
(No short description, might be part of a group.)
- Args:
- constants (
ListOfUnsigned/object): (undocumented)
- constants (