Skip to content

Commit

Permalink
Merge host into sequential
Browse files Browse the repository at this point in the history
Also from __future__ absolute_import
  • Loading branch information
wence- committed Nov 4, 2016
1 parent a8e501f commit 5f0698b
Show file tree
Hide file tree
Showing 21 changed files with 1,149 additions and 1,174 deletions.
8 changes: 4 additions & 4 deletions pyop2/__init__.py
@@ -1,10 +1,10 @@
"""
PyOP2 is a library for parallel computations on unstructured meshes.
"""
from __future__ import absolute_import
from pyop2.op2 import * # noqa
from pyop2.version import __version_info__ # noqa: just expose

from op2 import * # noqa
from version import __version__ as ver, __version_info__ # noqa: just expose

from ._version import get_versions
from pyop2._version import get_versions
__version__ = get_versions()['version']
del get_versions
2 changes: 1 addition & 1 deletion pyop2/_version.py
Expand Up @@ -9,7 +9,7 @@
# versioneer-0.16 (https://github.com/warner/python-versioneer)

"""Git implementation of _version.py."""

from __future__ import absolute_import
import errno
import os
import re
Expand Down
19 changes: 10 additions & 9 deletions pyop2/base.py
Expand Up @@ -35,6 +35,7 @@
information which is backend independent. Individual runtime backends should
subclass these as required to implement backend-specific features.
"""
from __future__ import absolute_import

from contextlib import contextmanager
import itertools
Expand All @@ -44,14 +45,14 @@
import types
from hashlib import md5

from configuration import configuration
from caching import Cached, ObjectCached
from exceptions import *
from utils import *
from mpi import MPI, collective, dup_comm
from profiling import timed_region, timed_function
from sparsity import build_sparsity
from version import __version__ as version
from pyop2.configuration import configuration
from pyop2.caching import Cached, ObjectCached
from pyop2.exceptions import *
from pyop2.utils import *
from pyop2.mpi import MPI, collective, dup_comm
from pyop2.profiling import timed_region, timed_function
from pyop2.sparsity import build_sparsity
from pyop2.version import __version__ as version

from coffee.base import Node, FlatBlock
from coffee.visitors import FindInstances, EstimateFlops
Expand Down Expand Up @@ -4429,6 +4430,6 @@ def par_loop(kernel, it_space, *args, **kwargs):
passed to the kernel as a vector.
"""
if isinstance(kernel, types.FunctionType):
import pyparloop
from pyop2 import pyparloop
return pyparloop.ParLoop(pyparloop.Kernel(kernel), it_space, *args, **kwargs).enqueue()
return _make_object('ParLoop', kernel, it_space, *args, **kwargs).enqueue()
4 changes: 3 additions & 1 deletion pyop2/caching.py
Expand Up @@ -33,7 +33,9 @@

"""Provides common base classes for cached objects."""

from utils import cached_property
from __future__ import absolute_import

from pyop2.utils import cached_property


def report_cache(typ):
Expand Down
10 changes: 6 additions & 4 deletions pyop2/compilation.py
Expand Up @@ -31,15 +31,17 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# OF THE POSSIBILITY OF SUCH DAMAGE.

from __future__ import absolute_import
import os
from mpi import MPI, collective, COMM_WORLD
import subprocess
import sys
import ctypes
from hashlib import md5
from configuration import configuration
from logger import debug, progress, INFO
from exceptions import CompilationError

from pyop2.mpi import MPI, collective, COMM_WORLD
from pyop2.configuration import configuration
from pyop2.logger import debug, progress, INFO
from pyop2.exceptions import CompilationError


def _check_hashes(x, y, datatype):
Expand Down
3 changes: 2 additions & 1 deletion pyop2/configuration.py
Expand Up @@ -33,10 +33,11 @@

"""PyOP2 global configuration."""

from __future__ import absolute_import
import os
from tempfile import gettempdir

from exceptions import ConfigurationError
from pyop2.exceptions import ConfigurationError


class Configuration(dict):
Expand Down
1 change: 1 addition & 0 deletions pyop2/exceptions.py
Expand Up @@ -32,6 +32,7 @@
# OF THE POSSIBILITY OF SUCH DAMAGE.

"""OP2 exception types"""
from __future__ import absolute_import


class DataTypeError(TypeError):
Expand Down
5 changes: 2 additions & 3 deletions pyop2/fusion/extended.py
Expand Up @@ -43,7 +43,6 @@

import pyop2.base as base
import pyop2.sequential as sequential
import pyop2.host as host
from pyop2.utils import flatten, strip, as_tuple
from pyop2.mpi import collective
from pyop2.profiling import timed_region
Expand Down Expand Up @@ -162,7 +161,7 @@ def c_ind_data(self, idx, i, j=0, is_top=False, offset=None, var=None):

def c_map_name(self, i, j, fromvector=False):
if not self._c_local_maps:
map_name = host.Arg.c_map_name(self.ref_arg, i, j)
map_name = sequential.Arg.c_map_name(self.ref_arg, i, j)
else:
map_name = self._c_local_maps[i][j]
return map_name if not fromvector else "&%s[0]" % map_name
Expand Down Expand Up @@ -246,7 +245,7 @@ def _multiple_ast_to_c(self, kernels):
funcall.funcall.symbol = new_name
fundecl.name = new_name
function_name = "%s_%d" % (main._name, i)
code += host.Kernel._ast_to_c(main, main_ast, main._opts)
code += sequential.Kernel._ast_to_c(main, main_ast, main._opts)
else:
# AST not available so can't change the name, hopefully there
# will not be compile time clashes.
Expand Down

0 comments on commit 5f0698b

Please sign in to comment.