diff --git a/pyop2/fusion/extended.py b/pyop2/fusion/extended.py index 265b65238..9e9f67cdd 100644 --- a/pyop2/fusion/extended.py +++ b/pyop2/fusion/extended.py @@ -34,6 +34,7 @@ """Classes for fusing parallel loops and for executing fused parallel loops, derived from ``base.py``.""" +import sys import os import ctypes from copy import deepcopy as dcopy @@ -471,15 +472,12 @@ def compile(self): raise RuntimeError("JITModule not in cache, but has no args associated") # Set compiler and linker options - slope_dir = os.environ['SLOPE_DIR'] self._kernel._name = 'executor' self._kernel._headers.extend(slope.Executor.meta['headers']) if self._use_prefetch: self._kernel._headers.extend(['#include "xmmintrin.h"']) - self._kernel._include_dirs.extend(['%s/%s' % (slope_dir, - slope.get_include_dir())]) - self._libraries += ['-L%s/%s' % (slope_dir, slope.get_lib_dir()), - '-l%s' % slope.get_lib_name()] + self._kernel._include_dirs.extend(['%s/include/SLOPE' % sys.prefix]) + self._libraries += ['-L%s/lib' % sys.prefix, '-l%s' % slope.get_lib_name()] compiler = coffee.system.compiler.get('name') self._cppargs += slope.get_compile_opts(compiler) fun = super(TilingJITModule, self).compile() diff --git a/pyop2/fusion/interface.py b/pyop2/fusion/interface.py index e874c3327..20eb90111 100644 --- a/pyop2/fusion/interface.py +++ b/pyop2/fusion/interface.py @@ -41,15 +41,11 @@ from pyop2.base import _LazyMatOp from pyop2.mpi import MPI -from pyop2.logger import warning, info as log_info +from pyop2.logger import warning, debug from pyop2.utils import flatten try: - """Is SLOPE accessible ?""" - sys.path.append(os.path.join(os.environ['SLOPE_DIR'], 'python')) - import slope_python as slope - - # Set the SLOPE backend + from pyslope import slope backend = os.environ.get('SLOPE_BACKEND') if backend not in ['SEQUENTIAL', 'OMP']: backend = 'SEQUENTIAL' @@ -59,8 +55,8 @@ if backend == 'OMP': backend = 'OMP_MPI' slope.set_exec_mode(backend) - log_info("SLOPE backend set to %s" % backend) -except: + debug("SLOPE backend set to %s" % backend) +except ImportError: slope = None lazy_trace_name = 'lazy_trace' diff --git a/pyop2/fusion/transformer.py b/pyop2/fusion/transformer.py index 079d7e922..ab5f94536 100644 --- a/pyop2/fusion/transformer.py +++ b/pyop2/fusion/transformer.py @@ -33,6 +33,7 @@ """Core loop fusion mechanisms.""" +import sys import os from collections import OrderedDict, namedtuple from copy import deepcopy as dcopy @@ -399,14 +400,11 @@ def _tile(self): rettype = slope.Executor.meta['py_ctype_exec'] # Compiler and linker options - slope_dir = os.environ['SLOPE_DIR'] compiler = coffee.system.compiler.get('name') cppargs = slope.get_compile_opts(compiler) - cppargs += ['-I%s/%s' % (slope_dir, slope.get_include_dir())] - ldargs = ['-L%s/%s' % (slope_dir, slope.get_lib_dir()), - '-l%s' % slope.get_lib_name(), - '-Wl,-rpath,%s/%s' % (slope_dir, slope.get_lib_dir()), - '-lrt'] + cppargs += ['-I%s/include/SLOPE' % sys.prefix] + ldargs = ['-L%s/lib' % sys.prefix, '-l%s' % slope.get_lib_name(), + '-Wl,-rpath,%s/lib' % sys.prefix, '-lrt'] # Compile and run inspector fun = compilation.load(src, "cpp", "inspector", cppargs, ldargs,