# Path: indigo/util.py
# class profile(object):
#     extra = dict()
# 
#     def __init__(self, event, **kwargs):
#         self._event = event
#         self._kwargs = kwargs
# 
#     def __enter__(self):
#         if log.level > logging.DEBUG:
#             return
# 
#         self._backend.barrier()
#         self._start = time.time()
# 
#         return self
# 
#     def __exit__(self, exc_type, exc_value, traceback):
#         if log.level > logging.DEBUG:
#             return
# 
#         self._backend.barrier()
#         data = dict(
#             duration = time.time() - self._start,
#             event    = self._event,
#         )
#         data.update(self.extra)
#         data.update(self._kwargs)
# 
#         if 'nflops' in data:
#             data['gflop_rate'] = data['nflops'] / data['duration'] * 1e-9
#             del data['nflops']
# 
#         if 'nbytes' in data:
#             data['membw_rate'] = data['nbytes'] / data['duration'] * 1e-9
#             del data['nbytes']
# 
#         kvs = sorted(data.items(), key=lambda kv: kv[0])
# 
#         def fmt(k, v):
#             if isinstance(v, float):
#                 return k, "%2.5g" % v
#             else:
#                 return k, repr(v)
# 
#         msg = "PROFILE(%s)" % ", ".join("%s=%s" % fmt(*kv) for kv in kvs)
#         log.debug(msg)
# 
#         self.duration = data['duration']


import logging
import abc, time
import numpy as np
import scipy.sparse as spp
import indigo.operators as op
        import scipy.signal as signal
from contextlib import contextmanager
from indigo.util import profile
        from indigo.interp import interp_mat
        from indigo.noncart import rolloff3
                from indigo.backends._customcpu import inspect


log = logging.getLogger(__name__)

class Backend(object):
    """
    Provides the routines and data structures necessary to implement
    a linear operator chain on different platforms.
    """
    __metaclass__ = abc.ABCMeta

    def __init__(self, device_id=0):

# Path: indigo/util.py
# class profile(object):
#     extra = dict()
# 
#     def __init__(self, event, **kwargs):
#         self._event = event
#         self._kwargs = kwargs
# 
#     def __enter__(self):
#         if log.level > logging.DEBUG:
#             return
# 
#         self._backend.barrier()
#         self._start = time.time()
# 
#         return self
# 
#     def __exit__(self, exc_type, exc_value, traceback):
#         if log.level > logging.DEBUG:
#             return
# 
#         self._backend.barrier()
#         data = dict(
#             duration = time.time() - self._start,
#             event    = self._event,
#         )
#         data.update(self.extra)
#         data.update(self._kwargs)
# 
#         if 'nflops' in data:
#             data['gflop_rate'] = data['nflops'] / data['duration'] * 1e-9
#             del data['nflops']
# 
#         if 'nbytes' in data:
#             data['membw_rate'] = data['nbytes'] / data['duration'] * 1e-9
#             del data['nbytes']
# 
#         kvs = sorted(data.items(), key=lambda kv: kv[0])
# 
#         def fmt(k, v):
#             if isinstance(v, float):
#                 return k, "%2.5g" % v
#             else:
#                 return k, repr(v)
# 
#         msg = "PROFILE(%s)" % ", ".join("%s=%s" % fmt(*kv) for kv in kvs)
#         log.debug(msg)
# 
#         self.duration = data['duration']


# Path: indigo/backends/backend.py
import logging
import abc, time
import numpy as np
import scipy.sparse as spp
import indigo.operators as op
        import scipy.signal as signal
from contextlib import contextmanager
from indigo.util import profile
        from indigo.interp import interp_mat
        from indigo.noncart import rolloff3
                from indigo.backends._customcpu import inspect



log = logging.getLogger(__name__)

class Backend(object):
    """
    Provides the routines and data structures necessary to implement
    a linear operator chain on different platforms.
    """
    __metaclass__ = abc.ABCMeta

    def __init__(self, device_id=0):

        profile._backend = self