Exemple #1
0
def init(**kwargs):
    """Initialise PyOP2: select the backend and potentially other configuration
    options.

    :arg debug:     The level of debugging output.
    :arg comm:      The MPI communicator to use for parallel communication,
                    defaults to `MPI_COMM_WORLD`
    :arg log_level: The log level. Options: DEBUG, INFO, WARNING, ERROR, CRITICAL
    :arg opt_level: The default optimization level in COFFEE. Options: O0, O1, O2,
                    O3, Ofast. For more information about these levels, refer to
                    ``coffee_init``'s documentation. The default value is O0.

    For debugging purposes, `init` accepts all keyword arguments
    accepted by the PyOP2 :class:`Configuration` object, see
    :meth:`Configuration.__init__` for details of further accepted
    options.

    .. note::
       Calling ``init`` again with a different backend raises an exception.
       Changing the backend is not possible. Calling ``init`` again with the
       same backend or not specifying a backend will update the configuration.
       Calling ``init`` after ``exit`` has been called is an error and will
       raise an exception.
    """
    global _initialised
    configuration.reconfigure(**kwargs)

    set_log_level(configuration['log_level'])
    coffee_init(compiler=configuration['compiler'], isa=configuration['simd_isa'],
                optlevel=configuration.get('opt_level', O0))
    _initialised = True
Exemple #2
0
def init(**kwargs):
    """Initialise PyOP2: select the backend and potentially other configuration
    options.

    :arg debug:     The level of debugging output.
    :arg comm:      The MPI communicator to use for parallel communication,
                    defaults to `MPI_COMM_WORLD`
    :arg log_level: The log level. Options: DEBUG, INFO, WARNING, ERROR, CRITICAL

    For debugging purposes, `init` accepts all keyword arguments
    accepted by the PyOP2 :class:`Configuration` object, see
    :meth:`Configuration.__init__` for details of further accepted
    options.

    .. note::
       Calling ``init`` again with a different backend raises an exception.
       Changing the backend is not possible. Calling ``init`` again with the
       same backend or not specifying a backend will update the configuration.
       Calling ``init`` after ``exit`` has been called is an error and will
       raise an exception.
    """
    global _initialised
    configuration.reconfigure(**kwargs)

    set_log_level(configuration['log_level'])

    _initialised = True
Exemple #3
0
Fichier : op2.py Projet : OP2/PyOP2
def init(**kwargs):
    """Initialise PyOP2: select the backend and potentially other configuration
    options.

    :arg debug:     The level of debugging output.
    :arg comm:      The MPI communicator to use for parallel communication,
                    defaults to `MPI_COMM_WORLD`
    :arg log_level: The log level. Options: DEBUG, INFO, WARNING, ERROR, CRITICAL

    For debugging purposes, `init` accepts all keyword arguments
    accepted by the PyOP2 :class:`Configuration` object, see
    :meth:`Configuration.__init__` for details of further accepted
    options.

    .. note::
       Calling ``init`` again with a different backend raises an exception.
       Changing the backend is not possible. Calling ``init`` again with the
       same backend or not specifying a backend will update the configuration.
       Calling ``init`` after ``exit`` has been called is an error and will
       raise an exception.
    """
    global _initialised
    configuration.reconfigure(**kwargs)

    set_log_level(configuration['log_level'])

    _initialised = True
Exemple #4
0
def init(**kwargs):
    """Initialise PyOP2: select the backend and potentially other configuration
    options.

    :arg debug:     The level of debugging output.
    :arg comm:      The MPI communicator to use for parallel communication,
                    defaults to `MPI_COMM_WORLD`
    :arg log_level: The log level. Options: DEBUG, INFO, WARNING, ERROR, CRITICAL
    :arg opt_level: The default optimization level in COFFEE. Options: O0, O1, O2,
                    O3, Ofast. For more information about these levels, refer to
                    ``coffee_init``'s documentation. The default value is O0.

    For debugging purposes, `init` accepts all keyword arguments
    accepted by the PyOP2 :class:`Configuration` object, see
    :meth:`Configuration.__init__` for details of further accepted
    options.

    .. note::
       Calling ``init`` again with a different backend raises an exception.
       Changing the backend is not possible. Calling ``init`` again with the
       same backend or not specifying a backend will update the configuration.
       Calling ``init`` after ``exit`` has been called is an error and will
       raise an exception.
    """
    global _initialised
    configuration.reconfigure(**kwargs)

    set_log_level(configuration['log_level'])
    coffee_init(compiler=configuration['compiler'],
                isa=configuration['simd_isa'],
                optlevel=configuration.get('opt_level', O0))
    _initialised = True
parameters.add(Parameters("assembly_cache",
                          enabled=True,
                          eviction=True,
                          max_bytes=float("Inf"),
                          max_factor=0.6,
                          max_misses=3))

parameters.add(Parameters("coffee",
                          O2=True))

# Default to the values of PyOP2 configuration dictionary
pyop2_opts = Parameters("pyop2_options",
                        **configuration)

pyop2_opts.set_update_function(lambda k, v: configuration.reconfigure(**{k: v}))

# Override values
pyop2_opts["type_check"] = False
pyop2_opts["log_level"] = "INFO"

parameters.add(pyop2_opts)

ffc_parameters = default_parameters()
ffc_parameters['write_file'] = False
ffc_parameters['format'] = 'pyop2'
ffc_parameters['representation'] = 'quadrature'
ffc_parameters['pyop2-ir'] = True
parameters.add(Parameters("form_compiler", **ffc_parameters))

parameters["reorder_meshes"] = True
Exemple #6
0
parameters.add(
    Parameters("assembly_cache",
               enabled=True,
               eviction=True,
               max_bytes=float("Inf"),
               max_factor=0.6,
               max_misses=3))

parameters.add(Parameters("coffee", O2=True))

# Default to the values of PyOP2 configuration dictionary
pyop2_opts = Parameters("pyop2_options", **configuration)

pyop2_opts.set_update_function(
    lambda k, v: configuration.reconfigure(**{k: v}))

# Override values
pyop2_opts["type_check"] = False
pyop2_opts["log_level"] = "INFO"

parameters.add(pyop2_opts)

ffc_parameters = default_parameters()
ffc_parameters['write_file'] = False
ffc_parameters['format'] = 'pyop2'
ffc_parameters['representation'] = 'quadrature'
ffc_parameters['pyop2-ir'] = True
parameters.add(Parameters("form_compiler", **ffc_parameters))

parameters["reorder_meshes"] = True