Skip to content

Commit

Permalink
fix mf when opencl is disable while avaiable
Browse files Browse the repository at this point in the history
  • Loading branch information
kif committed Sep 14, 2017
1 parent 5d280bb commit 871c2dc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pyFAI/opencl/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,19 @@
__contact__ = "[email protected]"
__license__ = "MIT"
__copyright__ = "2012-2017 European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "11/09/2017"
__date__ = "14/09/2017"
__status__ = "stable"
__all__ = ["ocl", "pyopencl", "mf", "release_cl_buffers", "allocate_cl_buffers",
"measure_workgroup_size", "kernel_workgroup_size"]

import os
import logging
import gc

import numpy


logger = logging.getLogger("pyFAI.opencl.common")

from .utils import get_opencl_code, concatenate_cl_kernel
from .utils import get_opencl_code

if os.environ.get("PYFAI_OPENCL") in ["0", "False"]:
logger.warning("Use of OpenCL has been disables from environment variable: SILX_OPENCL=0")
Expand All @@ -59,13 +57,15 @@
except ImportError:
logger.warning("Unable to import pyOpenCl. Please install it from: http://pypi.python.org/pypi/pyopencl")
pyopencl = None
class mf(object):
WRITE_ONLY = 1
READ_ONLY = 1
READ_WRITE = 1
else:
import pyopencl.array as array
mf = pyopencl.mem_flags
if pyopencl is None:
# create a dummy object
class mf(object):
WRITE_ONLY = 1
READ_ONLY = 1
READ_WRITE = 1

FLOP_PER_CORE = {"GPU": 64, # GPU, Fermi at least perform 64 flops per cycle/multicore, G80 were at 24 or 48 ...
"CPU": 4, # CPU, at least intel's have 4 operation per cycle
Expand Down

0 comments on commit 871c2dc

Please sign in to comment.