hip.hiprand

Contents

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

hiprandOrdering_t:

alias of hiprandOrdering

hiprandDirectionVectorSet_t:

alias of hiprandDirectionVectorSet

class hip.hiprand.uint4(*args, **kwargs)#

Bases: Pointer

Python 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._ptr attribute to NULL.

  • int:

    Interprets the integer value as pointer address and writes it to self._ptr. No ownership is transferred.

  • ctypes.c_void_p:

    Takes the pointer address pyobj.value and writes it to self._ptr. No ownership is transferred.

  • object that implements the CUDA Array Interface protocol:

    Takes the integer-valued pointer address, i.e. the first entry of the data tuple from pyobj’s member __cuda_array_interface__ and writes it to self._ptr.

  • object that implements the Python buffer protocol:

    If the object represents a simple contiguous array, writes the Py_buffer associated with pyobj to self._py_buffer, sets the self._py_buffer_acquired flag to True, and writes self._py_buffer.buf to the data pointer self._ptr.

  • hip._util.types.Pointer:

    Takes the pointer address pyobj._ptr and writes it to self._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.

static PROPERTIES()#
__getitem__(key, /)#

Return self[key].

__init__()#

Constructor type uint4.

Constructor for type uint4.

Args:
*args:

Positional arguments. Initialize all or a subset of the member variables according to their order of declaration.

**kwargs:

Can be used to initialize member variables at construction, Just pass an argument expression of the form <member>=<value> per member that you want to initialize.

as_c_void_p(self)#

Returns the data’s address as ctypes.c_void_p Note:

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 Pointer that 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 case pyobj is itself an uint4 reference, this method returns it directly. No new uint4 is created in this case.

get_w(self, i)#

Get value w of (<chiprand.uint4*>self._ptr)[i].

get_x(self, i)#

Get value x of (<chiprand.uint4*>self._ptr)[i].

get_y(self, i)#

Get value y of (<chiprand.uint4*>self._ptr)[i].

get_z(self, i)#

Get value z of (<chiprand.uint4*>self._ptr)[i].

is_ptr_null#

If data pointer is NULL.

set_w(self, i, unsigned int value)#

Set value w of (<chiprand.uint4*>self._ptr)[i].

set_x(self, i, unsigned int value)#

Set value x of (<chiprand.uint4*>self._ptr)[i].

set_y(self, i, unsigned int value)#

Set value y of (<chiprand.uint4*>self._ptr)[i].

set_z(self, i, unsigned int value)#

Set value z of (<chiprand.uint4*>self._ptr)[i].

w#

(undocumented)

x#

(undocumented)

y#

(undocumented)

z#

(undocumented)

class hip.hiprand.rocrand_discrete_distribution_st(*args, **kwargs)#

Bases: Pointer

Python 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._ptr attribute to NULL.

  • int:

    Interprets the integer value as pointer address and writes it to self._ptr. No ownership is transferred.

  • ctypes.c_void_p:

    Takes the pointer address pyobj.value and writes it to self._ptr. No ownership is transferred.

  • object that implements the CUDA Array Interface protocol:

    Takes the integer-valued pointer address, i.e. the first entry of the data tuple from pyobj’s member __cuda_array_interface__ and writes it to self._ptr.

  • object that implements the Python buffer protocol:

    If the object represents a simple contiguous array, writes the Py_buffer associated with pyobj to self._py_buffer, sets the self._py_buffer_acquired flag to True, and writes self._py_buffer.buf to the data pointer self._ptr.

  • hip._util.types.Pointer:

    Takes the pointer address pyobj._ptr and writes it to self._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.

static PROPERTIES()#
__getitem__(key, /)#

Return self[key].

__init__()#

Constructor type rocrand_discrete_distribution_st.

Constructor for type rocrand_discrete_distribution_st.

Args:
*args:

Positional arguments. Initialize all or a subset of the member variables according to their order of declaration.

**kwargs:

Can be used to initialize member variables at construction, Just pass an argument expression of the form <member>=<value> per member that you want to initialize.

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_p Note:

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 Pointer that 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 case pyobj is itself an rocrand_discrete_distribution_st reference, this method returns it directly. No new rocrand_discrete_distribution_st is created in this case.

get_alias(self, i)#

Get value alias of (<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].

get_cdf(self, i)#

Get value cdf of (<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].

get_offset(self, i)#

Get value offset of (<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].

get_probability(self, i)#

Get value probability of (<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].

get_size(self, i)#

Get value size of (<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 alias of (<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 cdf of (<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 offset of (<chiprand.rocrand_discrete_distribution_st*>self._ptr)[i].

set_probability(self, i, value)#

Set value probability of (<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 size of (<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: Pointer

Python 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._ptr attribute to NULL.

  • int:

    Interprets the integer value as pointer address and writes it to self._ptr. No ownership is transferred.

  • ctypes.c_void_p:

    Takes the pointer address pyobj.value and writes it to self._ptr. No ownership is transferred.

  • object that implements the CUDA Array Interface protocol:

    Takes the integer-valued pointer address, i.e. the first entry of the data tuple from pyobj’s member __cuda_array_interface__ and writes it to self._ptr.

  • object that implements the Python buffer protocol:

    If the object represents a simple contiguous array, writes the Py_buffer associated with pyobj to self._py_buffer, sets the self._py_buffer_acquired flag to True, and writes self._py_buffer.buf to the data pointer self._ptr.

  • hip._util.types.Pointer:

    Takes the pointer address pyobj._ptr and writes it to self._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.

static PROPERTIES()#
__getitem__(key, /)#

Return self[key].

__init__()#

Constructor.

Args:
pyobj (object):

See the class description Pointer for information about accepted types for pyobj. Defaults to None.

Raises:

TypeError: If the input object pyobj is not of the right type.

as_c_void_p(self)#

Returns the data’s address as ctypes.c_void_p Note:

Implemented as function to not collide with autogenerated property names.

createRef(self) Pointer#

Creates are reference to this pointer.

Returns a Pointer that 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 case pyobj is itself an rocrand_generator_base_type reference, this method returns it directly. No new rocrand_generator_base_type is 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__Base

rocRAND 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__Base

rocRAND 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__Base

rocRAND 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:

(undocumented)

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__Base

rocRAND 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: Pointer

Python 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._ptr attribute to NULL.

  • int:

    Interprets the integer value as pointer address and writes it to self._ptr. No ownership is transferred.

  • ctypes.c_void_p:

    Takes the pointer address pyobj.value and writes it to self._ptr. No ownership is transferred.

  • object that implements the CUDA Array Interface protocol:

    Takes the integer-valued pointer address, i.e. the first entry of the data tuple from pyobj’s member __cuda_array_interface__ and writes it to self._ptr.

  • object that implements the Python buffer protocol:

    If the object represents a simple contiguous array, writes the Py_buffer associated with pyobj to self._py_buffer, sets the self._py_buffer_acquired flag to True, and writes self._py_buffer.buf to the data pointer self._ptr.

  • hip._util.types.Pointer:

    Takes the pointer address pyobj._ptr and writes it to self._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.

__getitem__(key, /)#

Return self[key].

__init__()#

Constructor.

Args:
pyobj (object):

See the class description Pointer for information about accepted types for pyobj. Defaults to None.

Raises:

TypeError: If the input object pyobj is not of the right type.

as_c_void_p(self)#

Returns the data’s address as ctypes.c_void_p Note:

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 Pointer that 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 case pyobj is itself an hiprandDirectionVectors32_t reference, this method returns it directly. No new hiprandDirectionVectors32_t is created in this case.

is_ptr_null#

If data pointer is NULL.

class hip.hiprand.hiprandDirectionVectors64_t#

Bases: Pointer

Python 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._ptr attribute to NULL.

  • int:

    Interprets the integer value as pointer address and writes it to self._ptr. No ownership is transferred.

  • ctypes.c_void_p:

    Takes the pointer address pyobj.value and writes it to self._ptr. No ownership is transferred.

  • object that implements the CUDA Array Interface protocol:

    Takes the integer-valued pointer address, i.e. the first entry of the data tuple from pyobj’s member __cuda_array_interface__ and writes it to self._ptr.

  • object that implements the Python buffer protocol:

    If the object represents a simple contiguous array, writes the Py_buffer associated with pyobj to self._py_buffer, sets the self._py_buffer_acquired flag to True, and writes self._py_buffer.buf to the data pointer self._ptr.

  • hip._util.types.Pointer:

    Takes the pointer address pyobj._ptr and writes it to self._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.

__getitem__(key, /)#

Return self[key].

__init__()#

Constructor.

Args:
pyobj (object):

See the class description Pointer for information about accepted types for pyobj. Defaults to None.

Raises:

TypeError: If the input object pyobj is not of the right type.

as_c_void_p(self)#

Returns the data’s address as ctypes.c_void_p Note:

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 Pointer that 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 case pyobj is itself an hiprandDirectionVectors64_t reference, this method returns it directly. No new hiprandDirectionVectors64_t is 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__Base

hipRAND 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__Base

hipRAND 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.hiprandOrdering(value)#

Bases: _hiprandOrdering__Base

hipRAND generator ordering

Attributes:
HIPRAND_ORDERING_PSEUDO_BEST:

Best ordering for pseudorandom results

HIPRAND_ORDERING_PSEUDO_DEFAULT:

(undocumented)

HIPRAND_ORDERING_PSEUDO_SEEDED:

(undocumented)

HIPRAND_ORDERING_PSEUDO_LEGACY:

(undocumented)

HIPRAND_ORDERING_PSEUDO_DYNAMIC:

(undocumented)

HIPRAND_ORDERING_QUASI_DEFAULT:

(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_ORDERING_PSEUDO_BEST = 100#
HIPRAND_ORDERING_PSEUDO_DEFAULT = 101#
HIPRAND_ORDERING_PSEUDO_SEEDED = 102#
HIPRAND_ORDERING_PSEUDO_LEGACY = 103#
HIPRAND_ORDERING_PSEUDO_DYNAMIC = 104#
HIPRAND_ORDERING_QUASI_DEFAULT = 201#
hip.hiprand.hiprandOrdering_t#

alias of hiprandOrdering

class hip.hiprand.hiprandDirectionVectorSet(value)#

Bases: _hiprandDirectionVectorSet__Base

hipRAND vector set for quasirandom generators.

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 in generator. That generator will use GPU to create random numbers.

Values for rng_type are: - 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

Returns:

A tuple of size 2 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_ALLOCATION_FAILED, if memory allocation failed

    • HIPRAND_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_type is invalid

    • HIPRAND_STATUS_NOT_IMPLEMENTED if generator of type rng_type is not implemented yet

    • HIPRAND_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_type and returns it in generator. Created generator will use host CPU to generate random numbers.

Values for rng_type are: - 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

Returns:

A tuple of size 2 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_ALLOCATION_FAILED, if memory allocation failed

    • 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_type is invalid

    • HIPRAND_STATUS_NOT_IMPLEMENTED if host generator of type rng_type is not implemented yet

    • HIPRAND_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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_STATUS_SUCCESS if generator was destroyed successfully

hip.hiprand.hiprandGenerate(generator, output_data, unsigned long n)#

Generates uniformly distributed 32-bit unsigned integers.

Generates n uniformly distributed 32-bit unsigned integers and saves them to output_data.

Generated numbers are between 0 and 2^32, including 0 and excluding 2^32.

Note: generator must be not be of type HIPRAND_RNG_QUASI_SOBOL64 or HIPRAND_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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_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 n uniformly distributed 8-bit unsigned integers and saves them to output_data.

Generated numbers are between 0 and 2^8, including 0 and excluding 2^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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_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 n uniformly distributed 16-bit unsigned integers and saves them to output_data.

Generated numbers are between 0 and 2^16, including 0 and excluding 2^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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_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 n uniformly distributed 64-bit unsigned integers and saves them to output_data.

Generated numbers are between 0 and 2^64, including 0 and excluding 2^64.

Note: generator must be of type HIPRAND_RNG_QUASI_SOBOL64 or HIPRAND_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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_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 n uniformly distributed 32-bit floating-point values and saves them to output_data.

Generated numbers are between 0.0f and 1.0f, excluding 0.0f and including 1.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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel

    • HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if n is 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 n uniformly distributed 64-bit double-precision floating-point values and saves them to output_data.

Generated numbers are between 0.0 and 1.0, excluding 0.0 and including 1.0.

Note: When generator is of type: HIPRAND_RNG_PSEUDO_MRG32K3A, HIPRAND_RNG_PSEUDO_MTGP32, HIPRAND_RNG_QUASI_SOBOL32, or HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL32 then the returned double values are generated from only 32 random bits each (one <tt>unsigned int</tt> value per one generated double).

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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel

    • HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if n is 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 n uniformly distributed 16-bit half-precision floating-point values and saves them to output_data.

Generated numbers are between 0.0 and 1.0, excluding 0.0 and including 1.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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel

    • HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if n is 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 n normally distributed 32-bit floating-point values and saves them to output_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 normal distribution

stddev (float/int):
  • Standard deviation value of normal distribution

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel

    • HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not even, output_data is not

    aligned to sizeof(float2) bytes, or n is not a multiple of the dimension of used quasi-random generator

    • HIPRAND_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 n normally distributed 64-bit double-precision floating-point numbers and saves them to output_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 normal distribution

stddev (float/int):
  • Standard deviation value of normal distribution

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel

    • HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not even, output_data is not

    aligned to sizeof(double2) bytes, or n is not a multiple of the dimension of used quasi-random generator

    • HIPRAND_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 n normally distributed 16-bit half-precision floating-point numbers and saves them to output_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 halfs to generate

mean (int):
  • Mean value of normal distribution

stddev (int):
  • Standard deviation value of normal distribution

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel

    • HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not even, output_data is not

    aligned to sizeof(half2) bytes, or n is not a multiple of the dimension of used quasi-random generator

    • HIPRAND_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 n log-normally distributed 32-bit floating-point values and saves them to output_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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel

    • HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not even, output_data is not

    aligned to sizeof(float2) bytes, or n is not a multiple of the dimension of used quasi-random generator

    • HIPRAND_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 n log-normally distributed 64-bit double-precision floating-point values and saves them to output_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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel

    • HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not even, output_data is not

    aligned to sizeof(double2) bytes, or n is not a multiple of the dimension of used quasi-random generator

    • HIPRAND_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 n log-normally distributed 16-bit half-precision floating-point values and saves them to output_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 halfs to generate

mean (int):
  • Mean value of log normal distribution

stddev (int):
  • Standard deviation value of log normal distribution

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_STATUS_LAUNCH_FAILURE if generator failed to launch kernel

    • HIPRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not even, output_data is not

    aligned to sizeof(half2) bytes, or n is not a multiple of the dimension of used quasi-random generator

    • HIPRAND_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 n Poisson-distributed 32-bit unsigned integers and saves them to output_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 32-bit unsigned integers to generate

lambda (float/int):
  • lambda for the Poisson distribution

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_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 n is 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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was never created

    • HIPRAND_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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_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.hiprandSetGeneratorOrdering(generator, order)#

Sets the ordering of a random number generator.

Sets the ordering of the results of a random number generator.

  • This operation resets the generator’s internal state.

  • This operation does not change the generator’s seed.

The ordering choices for pseudorandom sequences are HIPRAND_ORDERING_PSEUDO_DEFAULT and HIPRAND_ORDERING_PSEUDO_LEGACY. The default ordering is HIPRAND_ORDERING_PSEUDO_DEFAULT, which is equal to HIPRAND_ORDERING_PSEUDO_LEGACY for now.

For quasirandom sequences there is only one ordering, HIPRAND_ORDERING_QUASI_DEFAULT.

Args:
generator (rocrand_generator_base_type/object):
  • Random number generator

order (hiprandOrdering):
  • New ordering of results

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_INITIALIZED if the generator was not initialized

    • HIPRAND_STATUS_OUT_OF_RANGE if the ordering is not valid

    • HIPRAND_STATUS_SUCCESS if the ordering was successfully set

    • HIPRAND_STATUS_TYPE_ERROR if generator’s type is not valid

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 dimensions are 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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_NOT_CREATED if the generator wasn’t created

    • HIPRAND_STATUS_TYPE_ERROR if the generator is not a quasi-random number generator

    • HIPRAND_STATUS_OUT_OF_RANGE if dimensions is out of range

    • HIPRAND_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 version the version number of the underlying cuRAND or rocRAND library.

Returns:

A tuple of size 2 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_OUT_OF_RANGE if version is NULL

    • HIPRAND_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:
lambda (float/int):
  • lambda for the Poisson distribution

Returns:

A tuple of size 2 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_ALLOCATION_FAILED if memory could not be allocated

    • HIPRAND_STATUS_OUT_OF_RANGE if discrete_distribution pointer was null

    • HIPRAND_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

Returns:

A tuple of size 1 that contains (in that order):

  • hiprandStatus: HIPRAND_STATUS_OUT_OF_RANGE if discrete_distribution was null

    • HIPRAND_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)

Returns:

A tuple of size 1 that contains (in that order):

hip.hiprand.hiprandGetDirectionVectors64(set)#

(No short description, might be part of a group.)

Args:
set (hiprandDirectionVectorSet):

(undocumented)

Returns:

A tuple of size 1 that contains (in that order):

hip.hiprand.hiprandGetScrambleConstants32(constants)#

(No short description, might be part of a group.)

Args:
constants (ListOfUnsigned/object):

(undocumented)

hip.hiprand.hiprandGetScrambleConstants64(constants)#

(No short description, might be part of a group.)

Args:
constants (Pointer/object):

(undocumented)