renom.cuda ¶
-
renom.cuda.
set_cuda_active
( activate=True ) ¶ -
If True is given, cuda will be activated.
Parameters: activate ( bool ) – Activation flag.
-
renom.cuda.
is_cuda_active
( ) ¶ -
Checks whether CUDA is activated.
Returns: True if cuda is active. Return type: ( bool )
-
renom.cuda.
has_cuda
( ) ¶ -
This method checks cuda libraries are available.
Returns: True if cuda is correctly set. Return type: ( bool )
-
renom.cuda.
curand_set_seed
( seed ) ¶ -
Set a seed to curand random number generator. The curand generator is used when cuda is activated.
Parameters: seed ( int ) – Seed. Example
>>> import numpy as np >>> import renom as rm >>> from renom.cuda import set_cuda_active, curand_set_seed >>> set_cuda_active(True) >>> a = rm.Variable(np.arange(4).reshape(2, 2)) >>> curand_set_seed(1) >>> print(rm.dropout(a)) [[ 0. 0.] [ 4. 0.]] >>> curand_set_seed(1) >>> print(rm.dropout(a)) # Same result will be returned. [[ 0. 0.] [ 4. 0.]]
-
renom.cuda.
release_mem_pool
( ) ¶ -
This function releases GPU memory pool.
Example
>>> import numpy as np >>> import renom as rm >>> from renom.cuda import set_cuda_active, release_mem_pool >>> set_cuda_active(True) >>> a = rm.Variable(np.arange(4).reshape(2, 2)) >>> a.to_gpu() >>> a = None >>> release_mem_pool() # The data of array `a` will be released.