diff --git a/hysop/__init__.py b/hysop/__init__.py index c96fe188aee1bc2d4732bcc55d5ba39a411e3ef5..0501895e8d3475908dda017a9b36a709217bbd14 100644 --- a/hysop/__init__.py +++ b/hysop/__init__.py @@ -19,7 +19,8 @@ __OPTIMIZE__ = not __debug__ __VERBOSE__ = True __DEBUG__ = False __TRACE__ = False -__KERNEL_DEBUG__ = True +__TRACE_WARNINGS_ = False +__KERNEL_DEBUG__ = False __PROFILE__ = True __ENABLE_LONG_TESTS__ = False diff --git a/hysop/__init__.py.in b/hysop/__init__.py.in index 9d74d3d5fbf2d27b18bc438ed715042c9d72e890..c4d4acee5fd5e51a169b22aeb9e73efafd198e37 100644 --- a/hysop/__init__.py.in +++ b/hysop/__init__.py.in @@ -3,7 +3,7 @@ on hybrid architectures (MPI-GPU) """ from functools import wraps -from hysop.deps import __builtin__, print_function, os, sys +from hysop.deps import __builtin__, print_function, os, sys, warnings, traceback # HySoP package_name = "@PACKAGE_NAME@" @@ -18,9 +18,10 @@ __OPTIMIZE__ = not __debug__ __VERBOSE__ = "@DEBUG@" in ["1", "3"] __DEBUG__ = "@DEBUG@" in ["2", "3"] -__TRACE__ = "@DEBUG@" in ["5"] -__KERNEL_DEBUG__ = "@DEBUG@" in ["4", "3"] -__PROFILE__ = "@PROFILE@" in ["0", "1"] +__TRACE__ = False +__TRACE_WARNINGS_ = False +__KERNEL_DEBUG__ = False +__PROFILE__ = True __ENABLE_LONG_TESTS__ = "@ENABLE_LONG_TESTS@" is "ON" @@ -28,7 +29,6 @@ __ENABLE_LONG_TESTS__ = "@ENABLE_LONG_TESTS@" is "ON" __DEFAULT_PLATFORM_ID__ = @OPENCL_DEFAULT_OPENCL_PLATFORM_ID@ __DEFAULT_DEVICE_ID__ = @OPENCL_DEFAULT_OPENCL_DEVICE_ID@ - if __MPI_ENABLED__: from hysop.core.mpi import MPI, main_rank, main_size, \ host_rank, interhost_size, \ @@ -38,7 +38,6 @@ if __MPI_ENABLED__: def print(*args, **kargs): """Wrap print function (because of python 3)""" __builtin__.print(*args, **kargs) - def vprint(*args, **kargs): """prints only if __VERBOSE__ has been set""" if __VERBOSE__: @@ -60,11 +59,17 @@ def sprint(*args, **kargs): """prints only shared memory master rank 0""" if (shm_rank==0): vprint(*args, **kargs) - values=transposition_states[len(candidate_axes.dd + +def reset(): + """Reset hysop state (registered objects).""" + from hysop.tools.handle import RegisteredObject + RegisteredObject._RegisteredObject__reset() # override warning printer __formatwarning = warnings.formatwarning -def __new_formatwarning(message, category, filename, lineno, line=none): +def __new_formatwarning(message, category, filename, lineno, line=None): + if __TRACE_WARNINGS__: + traceback.print_stack() return __formatwarning(message, category, filename, lineno, line='') warnings.formatwarning = __new_formatwarning @@ -75,16 +80,16 @@ if __TRACE__: from hysop.domain.domain import Domain from hysop.domain.box import Box -from hysop.fields.continuous import Field -from hysop.fields.discrete import DiscreteField -from hysop.core.mpi.cartesian import Topology, Cartesian -from hysop.core.mpi.topology_descriptor import TopologyDescriptor +from hysop.fields.continuous_field import Field +from hysop.fields.discrete_field import DiscreteField +from hysop.topology.cartesian_topology import Topology, CartesianTopology +from hysop.topology.topology_descriptor import TopologyDescriptor from hysop.tools.parameters import Discretization from hysop.simulation import Simulation from hysop.problem import Problem from hysop.tools.io_utils import IO, IOParams __all__ = ['Box', 'Field', 'DiscreteField', 'Domain', 'Discretization', 'Simulation', - 'Problem', 'IO', 'IOParams', 'Topology', 'Cartesian', 'TopologyDescriptor'] + 'Problem', 'IO', 'IOParams', 'Topology', 'CartesianTopology', 'TopologyDescriptor'] if __MPI_ENABLED__: __all__ += ['MPI', 'main_rank', 'main_size'] @@ -107,6 +112,5 @@ default_path = IO.default_path() cache_path = IO.default_cache_path() msg_io = '\n*Default path for all i/o is \'{}\'.'.format(default_path) msg_io += '\n*Default path for caching is \'{}\'.'.format(cache_path) -msg_io += '\n' vprint(msg_io)