diff --git a/ndarray/gen_elemwise.py b/ndarray/gen_elemwise.py index 32d2db6..dd97f58 100644 --- a/ndarray/gen_elemwise.py +++ b/ndarray/gen_elemwise.py @@ -7,9 +7,9 @@ import numpy +import pygpu_ndarray as gpu_ndarray import StringIO -import pygpu_ndarray as gpu_ndarray _CL_MODE = hasattr(gpu_ndarray, "set_opencl_context") @@ -20,6 +20,7 @@ from pyopencl.tools import dtype_to_ctype # import pyopencl._mymako as mako from pyopencl._cluda import CLUDA_PREAMBLE + # TODO: use mako to get rid of the %if CLUDA_PREAMBLE = CLUDA_PREAMBLE[:455] CLUDA_PREAMBLE += """ @@ -51,12 +52,12 @@ #define GDIM_2 gridDim.z """ -from theano import Apply -from theano import scalar -from theano.tensor import TensorType +import logging + import theano +from theano import Apply, scalar +from theano.tensor import TensorType -import logging _logger_name = 'compyte.gen_elemwise' _logger = logging.getLogger(_logger_name) _logger.setLevel(logging.INFO) diff --git a/ndarray/gen_reduction.py b/ndarray/gen_reduction.py index 793d1ce..c232c0c 100644 --- a/ndarray/gen_reduction.py +++ b/ndarray/gen_reduction.py @@ -1,7 +1,6 @@ import numpy import StringIO - _CL_MODE = False # "pyopencl" in __name__ @@ -12,6 +11,7 @@ from pyopencl.tools import dtype_to_ctype # import pyopencl._mymako as mako from pyopencl._cluda import CLUDA_PREAMBLE + # TODO: use mako to get rid of the %if CLUDA_PREAMBLE = CLUDA_PREAMBLE[:455] CLUDA_PREAMBLE += """ @@ -43,13 +43,13 @@ #define GDIM_2 gridDim.z """ -from theano import Apply -from theano import scalar -from theano.tensor import TensorType -from theano.sandbox.cuda import CudaNdarrayType +import logging + import theano +from theano import Apply, scalar +from theano.sandbox.cuda import CudaNdarrayType +from theano.tensor import TensorType -import logging _logger_name = 'compyte.gen_reduction' _logger = logging.getLogger(_logger_name) _logger.setLevel(logging.INFO) diff --git a/ndarray/setup_opencl.py b/ndarray/setup_opencl.py index a6f4727..089e9cc 100644 --- a/ndarray/setup_opencl.py +++ b/ndarray/setup_opencl.py @@ -1,8 +1,8 @@ import os - -from distutils.core import setup, Extension from distutils.command.build_ext import build_ext +from distutils.core import Extension, setup from distutils.dep_util import newer + import numpy as np @@ -82,6 +82,7 @@ def build_extensions(self): self.build_extension(ext) import sys + if sys.platform == 'darwin': libcl_args = {'extra_link_args': ['-framework', 'OpenCL']} else: diff --git a/ndarray/test_gpu_elemwise.py b/ndarray/test_gpu_elemwise.py index 07ea451..f6fbfd9 100644 --- a/ndarray/test_gpu_elemwise.py +++ b/ndarray/test_gpu_elemwise.py @@ -1,12 +1,13 @@ # TODO: test other dtype +from functools import reduce + import numpy +import pygpu_ndarray as gpu_ndarray import theano -import pygpu_ndarray as gpu_ndarray from .gen_elemwise import MyGpuNdArray, elemwise_collapses -from .test_gpu_ndarray import (dtypes_all, enable_double, - gen_gpu_nd_array, product) -from functools import reduce +from .test_gpu_ndarray import (dtypes_all, enable_double, gen_gpu_nd_array, + product) def rand(shape, dtype): diff --git a/ndarray/test_gpu_ndarray.py b/ndarray/test_gpu_ndarray.py index 00f8703..dc84690 100644 --- a/ndarray/test_gpu_ndarray.py +++ b/ndarray/test_gpu_ndarray.py @@ -1,7 +1,6 @@ import copy import numpy - import pygpu_ndarray as gpu_ndarray enable_double = True