Giter Club home page Giter Club logo

pyopencl-in-action's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pyopencl-in-action's Issues

mutex Compilation failed

cl) ~/work/p1/pyopencl-in-action$ python -m "ch7.mutex"
Using CPU: Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
On platform: Experimental OpenCL 2.1 CPU Only Platform (OpenCL 2.1 LINUX)

Build log:
/home/ubuntu/work/p1/pyopencl-in-action/ch7/mutex.py:46: UserWarning: Pre-build attribute access defeats compiler caching.
  print(prog.get_build_info(dev, cl.program_build_info.LOG))

Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/work/p1/pyopencl-in-action/ch7/mutex.py", line 43, in <module>
    prog.build(options=['-Werror'], devices=[dev])
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/site-packages/pyopencl/__init__.py", line 510, in build
    options_bytes=options_bytes, source=self._source)
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/site-packages/pyopencl/__init__.py", line 554, in _build_and_catch_errors
    raise err
pyopencl._cl.RuntimeError: clBuildProgram failed: BUILD_PROGRAM_FAILURE - clBuildProgram failed: BUILD_PROGRAM_FAILURE - clBuildProgram failed: BUILD_PROGRAM_FAILURE

Build on <pyopencl.Device 'Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz' on 'Experimental OpenCL 2.1 CPU Only Platform' at 0x21eee78>:

Compilation started
1:2:26: error: OpenCL extension 'cl_khr_global_int32_base_atomics' is core feature or supported optional core feature - ignoring
#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable
                         ^
Compilation failed

(options: -Werror -I /home/ubuntu/anaconda3/envs/cl/lib/python3.6/site-packages/pyopencl/cl)
(source saved as /tmp/tmpvkn4udlr.cl)

Issue on cl.Device at utility

I just wan to try your examples but I have run into issue on OpenCL 1.2 FP device

root:~/pyopencla/ch3# python map_copy.py
Traceback (most recent call last):
  File "map_copy.py", line 9, in <module>
    import utility
  File "/home/root/pyopencla/ch3/utility.py", line 6
    def get_default_device(use_gpu: bool = True) -> cl.Device:
                                  ^
SyntaxError: invalid syntax

and with OpenCL 2.1 FP device as well

(cl) ~/work/pyopencl-in-action/ch3$ python map_copy.py 
Using GPU: Intel(R) Gen9 HD Graphics NEO
On platform: Intel(R) OpenCL HD Graphics (OpenCL 2.1)

Traceback (most recent call last):
  File "map_copy.py", line 18, in <module>
    context = cl.Context(devices=[dev], properties=None, dev_type=None, cache_dir=None)
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. pyopencl._cl.Context(devices: object=None, properties: object=None, dev_type: object=None)

Invoked with: kwargs: devices=[<pyopencl.Device 'Intel(R) Gen9 HD Graphics NEO' on 'Intel(R) OpenCL HD Graphics' at 0x2644f50>], properties=None, dev_type=None, cache_dir=None

are you able to help on this?

Issue on interp_image no 'input_car.png'

(cl) ~/work/p1/pyopencl-in-action$ python -m "ch6.interp_image"
Using GPU: Intel(R) Gen9 HD Graphics NEO
On platform: Intel(R) OpenCL HD Graphics (OpenCL 2.1)

Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/work/p1/pyopencl-in-action/ch6/interp_image.py", line 64, in <module>
    im_src = imread('input_car.png').astype(dtype=np.uint16)
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/site-packages/skimage/io/_io.py", line 62, in imread
    img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/site-packages/skimage/io/manage_plugins.py", line 214, in call_plugin
    return func(*args, **kwargs)
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/site-packages/skimage/io/_plugins/pil_plugin.py", line 35, in imread
    with open(fname, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'input_car.png'

requesting 'input_car.png' file even it's in directory?

bsort8 BUILD_PROGRAM_FAILURE

(cl) ~/work/p1/pyopencl-in-action$ python -m "ch11.bsort8"
Using GPU: Intel(R) Gen9 HD Graphics NEO
On platform: Intel(R) OpenCL HD Graphics (OpenCL 2.1)

Build log:
/home/ubuntu/work/p1/pyopencl-in-action/ch11/bsort8.py:73: UserWarning: Pre-build attribute access defeats compiler caching.
  print(prog.get_build_info(dev, cl.program_build_info.LOG))

Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/work/p1/pyopencl-in-action/ch11/bsort8.py", line 70, in <module>
    prog.build(options=['-Werror'], devices=[dev])
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/site-packages/pyopencl/__init__.py", line 510, in build
    options_bytes=options_bytes, source=self._source)
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/site-packages/pyopencl/__init__.py", line 554, in _build_and_catch_errors
    raise err
pyopencl._cl.RuntimeError: clBuildProgram failed: BUILD_PROGRAM_FAILURE - clBuildProgram failed: BUILD_PROGRAM_FAILURE - clBuildProgram failed: BUILD_PROGRAM_FAILURE

Build on <pyopencl.Device 'Intel(R) Gen9 HD Graphics NEO' on 'Intel(R) OpenCL HD Graphics' at 0x19c31c0>:

1:26:4: error: ^ has lower precedence than <; < will be evaluated first
   SORT_VECTOR(input1, UP)
   ^~~~~~~~~~~~~~~~~~~~~~~
1:6:107: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1:26:4: note: place parentheses around the '<' expression to silence this warning
   SORT_VECTOR(input1, UP)
   ^~~~~~~~~~~~~~~~~~~~~~~
1:6:107: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1:26:4: note: place parentheses around the ^ expression to evaluate it first
   SORT_VECTOR(input1, UP)
   ^~~~~~~~~~~~~~~~~~~~~~~
1:6:107: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                    ~~~~~~~~~~~~~~~~~~~~~~^~~~~
1:26:4: error: ^ has lower precedence than <; < will be evaluated first
   SORT_VECTOR(input1, UP)
   ^~~~~~~~~~~~~~~~~~~~~~~
1:6:239: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1:26:4: note: place parentheses around the '<' expression to silence this warning
   SORT_VECTOR(input1, UP)
   ^~~~~~~~~~~~~~~~~~~~~~~
1:6:239: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1:26:4: note: place parentheses around the ^ expression to evaluate it first
   SORT_VECTOR(input1, UP)
   ^~~~~~~~~~~~~~~~~~~~~~~
1:6:239: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                        ~~~~~~~~~~~~~~~~~~~~~~^~~~~
1:26:4: error: ^ has lower precedence than <; < will be evaluated first
   SORT_VECTOR(input1, UP)
   ^~~~~~~~~~~~~~~~~~~~~~~
1:6:371: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                                                                                                                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1:26:4: note: place parentheses around the '<' expression to silence this warning
   SORT_VECTOR(input1, UP)
   ^~~~~~~~~~~~~~~~~~~~~~~
1:6:371: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                                                                                                                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1:26:4: note: place parentheses around the ^ expression to evaluate it first
   SORT_VECTOR(input1, UP)
   ^~~~~~~~~~~~~~~~~~~~~~~
1:6:371: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                                                                                                                                                            ~~~~~~~~~~~~~~~~~~~~~~^~~~~
1:27:4: error: ^ has lower precedence than <; < will be evaluated first
   SORT_VECTOR(input2, DOWN)
   ^~~~~~~~~~~~~~~~~~~~~~~~~
1:6:107: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1:27:4: note: place parentheses around the '<' expression to silence this warning
   SORT_VECTOR(input2, DOWN)
   ^~~~~~~~~~~~~~~~~~~~~~~~~
1:6:107: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1:27:4: note: place parentheses around the ^ expression to evaluate it first
   SORT_VECTOR(input2, DOWN)
   ^~~~~~~~~~~~~~~~~~~~~~~~~
1:6:107: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                    ~~~~~~~~~~~~~~~~~~~~~~^~~~~
1:27:4: error: ^ has lower precedence than <; < will be evaluated first
   SORT_VECTOR(input2, DOWN)
   ^~~~~~~~~~~~~~~~~~~~~~~~~
1:6:239: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1:27:4: note: place parentheses around the '<' expression to silence this warning
   SORT_VECTOR(input2, DOWN)
   ^~~~~~~~~~~~~~~~~~~~~~~~~
1:6:239: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1:27:4: note: place parentheses around the ^ expression to evaluate it first
   SORT_VECTOR(input2, DOWN)
   ^~~~~~~~~~~~~~~~~~~~~~~~~
1:6:239: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                        ~~~~~~~~~~~~~~~~~~~~~~^~~~~
1:27:4: error: ^ has lower precedence than <; < will be evaluated first
   SORT_VECTOR(input2, DOWN)
   ^~~~~~~~~~~~~~~~~~~~~~~~~
1:6:371: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                                                                                                                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1:27:4: note: place parentheses around the '<' expression to silence this warning
   SORT_VECTOR(input2, DOWN)
   ^~~~~~~~~~~~~~~~~~~~~~~~~
1:6:371: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                                                                                                                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1:27:4: note: place parentheses around the ^ expression to evaluate it first
   SORT_VECTOR(input2, DOWN)
   ^~~~~~~~~~~~~~~~~~~~~~~~~
1:6:371: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                                                                                                                                                            ~~~~~~~~~~~~~~~~~~~~~~^~~~~
1:29:4: error: ^ has lower precedence than <; < will be evaluated first
   SWAP_VECTORS(input1, input2, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1:8:160: note: expanded from macro 'SWAP_VECTORS'
#define SWAP_VECTORS(input1, input2, dir)                            temp = input1;                                                    comp = (input1 < input2 ^ dir) * 4 + add4;                        input1 = shuffle2(input1, input2, as_uint4(comp));                input2 = shuffle2(input2, temp, as_uint4(comp));               
                                                                                                                                               ~~~~~~~~~~~~~~~~^
1:29:4: note: place parentheses around the '<' expression to silence this warning
   SWAP_VECTORS(input1, input2, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1:8:160: note: expanded from macro 'SWAP_VECTORS'
#define SWAP_VECTORS(input1, input2, dir)                            temp = input1;                                                    comp = (input1 < input2 ^ dir) * 4 + add4;                        input1 = shuffle2(input1, input2, as_uint4(comp));                input2 = shuffle2(input2, temp, as_uint4(comp));               
                                                                                                                                               ~~~~~~~~~~~~~~~ ^
1:29:4: note: place parentheses around the ^ expression to evaluate it first
   SWAP_VECTORS(input1, input2, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1:8:160: note: expanded from macro 'SWAP_VECTORS'
#define SWAP_VECTORS(input1, input2, dir)                            temp = input1;                                                    comp = (input1 < input2 ^ dir) * 4 + add4;                        input1 = shuffle2(input1, input2, as_uint4(comp));                input2 = shuffle2(input2, temp, as_uint4(comp));               
                                                                                                                                                        ~~~~~~~^~~~~
1:31:4: error: ^ has lower precedence than <; < will be evaluated first
   SORT_VECTOR(input1, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:107: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1:31:4: note: place parentheses around the '<' expression to silence this warning
   SORT_VECTOR(input1, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:107: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1:31:4: note: place parentheses around the ^ expression to evaluate it first
   SORT_VECTOR(input1, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:107: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                    ~~~~~~~~~~~~~~~~~~~~~~^~~~~
1:31:4: error: ^ has lower precedence than <; < will be evaluated first
   SORT_VECTOR(input1, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:239: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1:31:4: note: place parentheses around the '<' expression to silence this warning
   SORT_VECTOR(input1, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:239: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1:31:4: note: place parentheses around the ^ expression to evaluate it first
   SORT_VECTOR(input1, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:239: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                        ~~~~~~~~~~~~~~~~~~~~~~^~~~~
1:31:4: error: ^ has lower precedence than <; < will be evaluated first
   SORT_VECTOR(input1, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:371: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                                                                                                                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1:31:4: note: place parentheses around the '<' expression to silence this warning
   SORT_VECTOR(input1, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:371: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                                                                                                                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1:31:4: note: place parentheses around the ^ expression to evaluate it first
   SORT_VECTOR(input1, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:371: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                                                                                                                                                            ~~~~~~~~~~~~~~~~~~~~~~^~~~~
1:32:4: error: ^ has lower precedence than <; < will be evaluated first
   SORT_VECTOR(input2, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:107: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1:32:4: note: place parentheses around the '<' expression to silence this warning
   SORT_VECTOR(input2, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:107: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1:32:4: note: place parentheses around the ^ expression to evaluate it first
   SORT_VECTOR(input2, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:107: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                    ~~~~~~~~~~~~~~~~~~~~~~^~~~~
1:32:4: error: ^ has lower precedence than <; < will be evaluated first
   SORT_VECTOR(input2, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:239: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1:32:4: note: place parentheses around the '<' expression to silence this warning
   SORT_VECTOR(input2, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:239: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1:32:4: note: place parentheses around the ^ expression to evaluate it first
   SORT_VECTOR(input2, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:239: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                        ~~~~~~~~~~~~~~~~~~~~~~^~~~~
1:32:4: error: ^ has lower precedence than <; < will be evaluated first
   SORT_VECTOR(input2, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:371: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                                                                                                                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1:32:4: note: place parentheses around the '<' expression to silence this warning
   SORT_VECTOR(input2, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:371: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                                                                                                                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1:32:4: note: place parentheses around the ^ expression to evaluate it first
   SORT_VECTOR(input2, dir)
   ^~~~~~~~~~~~~~~~~~~~~~~~
1:6:371: note: expanded from macro 'SORT_VECTOR'
#define SORT_VECTOR(input, dir)                                      comp = input < shuffle(input, mask1) ^ dir;                       input = shuffle(input, as_uint4(comp + add1));                    comp = input < shuffle(input, mask2) ^ dir;                       input = shuffle(input, as_uint4(comp * 2 + add2));                comp = input < shuffle(input, mask3) ^ dir;                       input = shuffle(input, as_uint4(comp + add3));                 
                                                                                                                                                                                                                                                                                                                                                            ~~~~~~~~~~~~~~~~~~~~~~^~~~~

(options: -Werror -I /home/ubuntu/anaconda3/envs/cl/lib/python3.6/site-packages/pyopencl/cl)
(source saved as /tmp/tmp4mg8i75_.cl)

import utility

I have trouble to import utility from the root of the project due to this
I have modified and added sys.path.append("..") for myself ch3/map_copy.py

'''
Listing 3.3: Copying and mapping buffer objects
'''

import sys
sys.path.append("..")

import pyopencl as cl
import numpy as np
import utility

as well I have modified project structure

    pyopencl-in-action\
        __init__.py
        utility.py
        ch3\
            __init__.py
            map_copy.py
            buffer_test.py
        ch4\
            __init__.py
            float_config.py
            double_test.py

at least on my side without those modification I run into

(cl) ~/work/pyopencl-in-action/ch3$ python buffer_test.py 
Traceback (most recent call last):
  File "buffer_test.py", line 7, in <module>
    import utility
ModuleNotFoundError: No module named 'utility'

due to compatibility with python2 I added into opencl-print-info.py

from __future__ import print_function

Can't get Image Processing Examples Working (ch6/interp_image.py)

Hello,
I'm willing to do some image interpolation with PyOpenCL, so I tried to run your example but I got the following error :

input.cl:2:32: error: use of undeclared identifier 'CLK_NORMALIZED_COORDS_FALSE'
input.cl:2:62: error: use of undeclared identifier 'CLK_ADDRESS_CLAMP'
input.cl:2:82: error: use of undeclared identifier 'CLK_FILTER_LINEAR'
input.cl:22:18: error: implicit declaration of function 'read_imagef' is invalid in C99
input.cl:26:10: error: implicit declaration of function 'write_imagef' is invalid in C99
input.cl:26:10: note: did you mean 'read_imagef'?
input.cl:22:18: note: 'read_imagef' declared here

I also get this kind of error while running simple_image.py
However I am able to run other examples that you provided on this repository, so I don't understand where these errors come from.

Any Idea of what is going wrong ?

Guillaume

ch7.mutex - compilaion failed

(cl) ~/work/p1/pyopencl-in-action$ python -m "ch7.mutex"
Using CPU: Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
On platform: Experimental OpenCL 2.1 CPU Only Platform (OpenCL 2.1 LINUX)

Build log:
/home/ubuntu/work/p1/pyopencl-in-action/ch7/mutex.py:46: UserWarning: Pre-build attribute access defeats compiler caching.
  print(prog.get_build_info(dev, cl.program_build_info.LOG))

Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/work/p1/pyopencl-in-action/ch7/mutex.py", line 43, in <module>
    prog.build(options=['-Werror'], devices=[dev])
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/site-packages/pyopencl/__init__.py", line 510, in build
    options_bytes=options_bytes, source=self._source)
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/site-packages/pyopencl/__init__.py", line 554, in _build_and_catch_errors
    raise err
pyopencl._cl.RuntimeError: clBuildProgram failed: BUILD_PROGRAM_FAILURE - clBuildProgram failed: BUILD_PROGRAM_FAILURE - clBuildProgram failed: BUILD_PROGRAM_FAILURE

Build on <pyopencl.Device 'Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz' on 'Experimental OpenCL 2.1 CPU Only Platform' at 0xdbd158>:

Compilation started
1:2:26: error: OpenCL extension 'cl_khr_global_int32_base_atomics' is core feature or supported optional core feature - ignoring
#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable
                         ^
Compilation failed

(options: -Werror -I /home/ubuntu/anaconda3/envs/cl/lib/python3.6/site-packages/pyopencl/cl)
(source saved as /tmp/tmpqm5dqjib.cl)


(cl) ~/work/p1/pyopencl-in-action$ python -m "ch11.string_search"
Using GPU: Intel(R) Gen9 HD Graphics NEO
On platform: Intel(R) OpenCL HD Graphics (OpenCL 2.1)

Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/ubuntu/anaconda3/envs/cl/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/work/p1/pyopencl-in-action/ch11/string_search.py", line 84, in <module>
    with open(TEXT_FILE, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'kafka.txt'
(cl) ~/work/p1/pyopencl-in-action$ 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.