Skip to content
Snippets Groups Projects
Commit 75fa9133 authored by EXT Jean-Matthieu Etancelin's avatar EXT Jean-Matthieu Etancelin
Browse files

remove hysop main __init__.py from verionning (generated by cmake)

parent 60d45efa
No related branches found
No related tags found
No related merge requests found
"""Python package dedicated to flow simulation using particular methods
on hybrid architectures (MPI-GPU)
"""
from functools import wraps
from hysop.deps import __builtin__, print_function, os, sys, warnings, traceback
def get_env(target, default_value):
target = 'HYSOP_{}'.format(target)
if target in os.environ:
value = os.environ[target]
if value.lower() in ('0', 'no', 'false'):
return False
elif value.upper() in ('1', 'yes', 'true'):
return True
else:
return value
else:
return default_value
# HySoP
package_name = "hysop"
version = "2.0.0-rc.1"
# Compilation flags
__MPI_ENABLED__ = "ON" is "ON"
__GPU_ENABLED__ = "ON" is "ON"
__FFTW_ENABLED__ = "ON" is "ON"
__SCALES_ENABLED__ = "OFF" is "ON"
__OPTIMIZE__ = not __debug__
__VERBOSE__ = get_env('VERBOSE', False)
__DEBUG__ = get_env('DEBUG', False)
__PROFILE__ = get_env('PROFILE', False)
__KERNEL_DEBUG__ = get_env('KERNEL_DEBUG', False)
__TRACE_CALLS__ = get_env('TRACE_CALLS', False)
__TRACE_WARNINGS__ = get_env('TRACE_WARNINGS', False)
__TRACE_MEMALLOCS__ = get_env('TRACE_MEMALLOC', False)
__TRACE_KERNELS__ = get_env('TRACE_KERNELS', False)
__KERNEL_DEBUG__ = get_env('KERNEL_DEBUG', False)
__BACKTRACE_BIG_MEMALLOCS__ = get_env('BACKTRACE_BIG_MEMALLOCS', False)
__TEST_ALL_OPENCL_PLATFORMS__ = get_env('TEST_ALL_OPENCL_PLATFORMS', False)
__ENABLE_LONG_TESTS__ = get_env('ENABLE_LONG_TESTS', ("OFF" is "ON"))
# OpenCL
__DEFAULT_PLATFORM_ID__ = int(get_env('DEFAULT_PLATFORM_ID', 0))
__DEFAULT_DEVICE_ID__ = int(get_env('DEFAULT_DEVICE_ID', 0))
if __MPI_ENABLED__:
from hysop.core.mpi import MPI, main_rank, main_size, \
host_rank, interhost_size, \
shm_rank, intershm_size
else:
main_rank, main_size = 0, 1
# define printing functions
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__:
print(*args, **kargs)
def dprint(*args, **kargs):
"""prints only if __DEBUG__ has been set"""
if __DEBUG__:
print(*args, **kargs)
def mprint(*args, **kargs):
"""prints only on world master rank 0"""
if (main_rank==0):
vprint(*args, **kargs)
def hprint(*args, **kargs):
"""prints only host master rank 0"""
if (host_rank==0):
vprint(*args, **kargs)
def sprint(*args, **kargs):
"""prints only shared memory master rank 0"""
if (shm_rank==0):
vprint(*args, **kargs)
def reset():
"""Reset hysop state (registered objects)."""
from hysop.tools.handle import RegisteredObject
RegisteredObject._RegisteredObject__reset()
# override warning printer
if '__formatwarning' not in locals():
__formatwarning = warnings.formatwarning
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
if __TRACE_CALLS__:
def __trace(frame, event, arg):
print('{} {}:{}'.format(event, frame.f_code.co_filename, frame.f_lineno))
sys.settrace(__trace)
from hysop.domain.domain import Domain
from hysop.domain.box import Box
from hysop.fields.continuous_field import Field
from hysop.fields.discrete_field import DiscreteField
from hysop.parameters.scalar_parameter import ScalarParameter
from hysop.parameters.tensor_parameter import TensorParameter
from hysop.topology.cartesian_topology import Topology, CartesianTopology
from hysop.topology.topology_descriptor import TopologyDescriptor
from hysop.tools.parameters import Discretization, MPIParams
from hysop.simulation import Simulation
from hysop.problem import Problem
from hysop.tools.io_utils import IO, IOParams
__all__ = ['Box', 'Field', 'DiscreteField', 'ScalarParameter', 'TensorParameter',
'Domain', 'Discretization', 'Simulation', 'MPIParams',
'Problem', 'IO', 'IOParams',
'Topology', 'CartesianTopology', 'TopologyDescriptor']
if __MPI_ENABLED__:
__all__ += ['MPI', 'main_rank', 'main_size']
from hysop.tools.sys_utils import SysUtils
if SysUtils.is_interactive():
__defpath = os.path.join(os.getcwd(), 'interactive')
else:
__defpath = os.getcwd()
IO.set_default_path(get_env('DUMP_DIR', __defpath))
msg_start = '\nStarting {} version {}'.format(package_name, version)
if __MPI_ENABLED__:
msg_start += (' with {} mpi process(es) on {} host(s) '+
'providing {} shared memory node(s).').format(main_size,interhost_size,intershm_size)
mprint(msg_start)
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)
mprint(msg_io)
mprint()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment