code: def use(
      device,
      force=False,
      default_to_move_computation_to_gpu=True,
      move_shared_to_gpu=True,
      preallocate=None,
  ):
      """
      Error and warning about CUDA should be displayed only when this
      function is called. We need to be able to load this module only
      to check if it is available!
  
      Parameters
      ----------
      device : string
          "cuda", "cuda0", "cudaN", "" (N is the device number to use).
          "" mean do all the rest and don't init a device.
      force
          Will always raise an exception if we can't use the gpu.
      default_to_move_computation_to_gpu
          If gpu init succeeded, enable by default optimizations to move
          computations to the gpu.
      move_shared_to_gpu
          If gpu init succeeded, put new shared variables on the gpu.
      preallocate
          If specified, will use this value for preallocation instead of
          gpuarray.preallocate.
  
      """
      if force:
          if not (
              device.startswith("cuda") or device.startswith("opencl")
          ):
              raise Exception(
                  "forced the init and bad device provided: " + device
              )
          else:
              # If we force, the device should not already be initialized.
              assert device not in init_dev.devmap
      if device:
          init_dev(device, preallocate=preallocate)
      if default_to_move_computation_to_gpu:
          optdb.add_tags("gpuarray_opt", "fast_run", "fast_compile")
          optdb.add_tags("gpua_scanOp_make_inplace", "fast_run")
      if move_shared_to_gpu:
          import theano.compile
  
          theano.compile.shared_constructor(gpuarray_shared_constructor)
  
file_path: Theano/theano/gpuarray/__init__.py
imports: from __future__ import absolute_import, print_function, division
  import sys
  import os
  import logging
  import warnings
  import theano
  from theano import config
  from theano.compile import optdb
  from theano.tensor.basic import register_transfer
  from .type import GpuArrayType, GpuArrayVariable, GpuArrayConstant, GpuArraySharedVariable, gpuarray_shared_constructor, reg_context, get_context, ContextNotDefined
  from .basic_ops import as_gpuarray_variable
  from .None import fft, dnn, opt, extra_ops, multinomial, reduction, sort, rng_mrg, ctc
label_desc: Use image node_id 4 for calling a global function with example usage: use(device, force, default_to_move_computation_to_gpu, move_shared_to_gpu, preallocate) without return types