CUDA and OpenCL

104 views
Skip to first unread message

Yong

unread,
Jan 6, 2016, 11:18:21 AM1/6/16
to sailfish-cfd
Hi,

It's said that Sailfish works on GPU with both CUDA and OpenCL. Is there a way to switch from using CUDA to OpenCL?

Thank you very much.

Best,
Yong

Michal Januszewski

unread,
Jan 7, 2016, 4:41:56 AM1/7/16
to sailfish-cfd
You can use the --backend=opencl option. Note that you will need a working PyOpenCL on your system in order for this work.

--Michal

--

---
You received this message because you are subscribed to the Google Groups "sailfish-cfd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sailfish-cfd...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Y Wang

unread,
Jan 8, 2016, 10:03:36 AM1/8/16
to sailfi...@googlegroups.com
Hi Michal,

Thanks for your information. I just had a try on a machine where I installed the latest opencl. With a simple test, the opencl can find 1 platform and 4 GPU devices. But finally I get following error message. Any suggestion? Thanks.

[wxw@cu01 2_cyl]$ python cylinder.py —backends=opencl
[  1187  INFO Master/cu01] Machine master starting with PID 26431 at 2016-01-08 12:39:32 UTC
[  1235  INFO Master/cu01] Sailfish version: 08b219240b900366df7fef0420a6d28d59cf366f
[  1236  INFO Master/cu01] Handling subdomains: [0]
[  1236  INFO Master/cu01] Subdomain -> GPU map: {0: 0}
[  6028  INFO Subdomain/0] Initializing subdomain.
Process Subdomain/0:
Traceback (most recent call last):
  File "/home/wxw/software/lib/python2.7/multiprocessing/process.py", line 232, in _bootstrap
    self.run()
  File "/home/wxw/software/lib/python2.7/multiprocessing/process.py", line 88, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wxw/software/sailfish-cfd/sailfish/master.py", line 67, in _start_subdomain_runner
    runner.run()
  File "/home/wxw/software/sailfish-cfd/sailfish/subdomain_runner.py", line 1502, in run
    self._sim.init_fields(self)
  File "/home/wxw/software/sailfish-cfd/sailfish/lb_base.py", line 154, in init_fields
    gpu_array=field.gpu_array)
  File "/home/wxw/software/sailfish-cfd/sailfish/subdomain_runner.py", line 268, in make_scalar_field
    buf = self.backend.alloc_async_host_buf(self.num_phys_nodes, dtype=dtype)
  File "/home/wxw/software/sailfish-cfd/sailfish/backend_opencl.py", line 94, in alloc_async_host_buf
    return host_buf.get_host_array(shape, dtype)
  File "/home/wxw/software/lib/python2.7/site-packages/pyopencl-2015.2.4-py2.7-linux-x86_64.egg/pyopencl/cffi_cl.py", line 753, in get_host_array
    _size))
  File "/home/wxw/software/lib/python2.7/site-packages/pyopencl-2015.2.4-py2.7-linux-x86_64.egg/pyopencl/cffi_cl.py", line 549, in _handle_error
    raise e
LogicError: memoryobject.get host array failed: INVALID_VALUE - Only MemoryObject with USE_HOST_PTR is supported.









--

---
You received this message because you are subscribed to a topic in the Google Groups "sailfish-cfd" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sailfish-cfd/79acNuqmSf8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sailfish-cfd...@googlegroups.com.

Y Wang

unread,
Jan 8, 2016, 10:09:39 AM1/8/16
to sailfi...@googlegroups.com
I also tried with option "--opencl-interactive-select", then it stuck, even I chose 0 as default. 

[wxw@cu01 examples]$ python ldc_2d.py --backends=opencl --opencl-interactive-select
[  1150  INFO Master/cu01] Machine master starting with PID 12604 at 2016-01-08 14:30:35 UTC
[  1200  INFO Master/cu01] Sailfish version: 08b219240b900366df7fef0420a6d28d59cf366f
[  1200  INFO Master/cu01] Handling subdomains: [0]
[  1200  INFO Master/cu01] Subdomain -> GPU map: {0: 0}
Choose platform:
[0] <pyopencl.Platform 'NVIDIA CUDA' at 0x416d220>
Process Subdomain/0:
Traceback (most recent call last):
  File "/home/wxw/software/lib/python2.7/multiprocessing/process.py", line 232, in _bootstrap
    self.run()
  File "/home/wxw/software/lib/python2.7/multiprocessing/process.py", line 88, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wxw/software/sailfish-cfd/sailfish/master.py", line 51, in _start_subdomain_runner
    backend = backend_class(config, gpu_id)
  File "/home/wxw/software/sailfish-cfd/sailfish/backend_opencl.py", line 34, in __init__
    self.ctx = cl.create_some_context(True)
  File "/home/wxw/software/lib/python2.7/site-packages/pyopencl-2015.2.4-py2.7-linux-x86_64.egg/pyopencl/__init__.py", line 1270, in create_some_context
    answer = get_input("Choice [0]:")
  File "/home/wxw/software/lib/python2.7/site-packages/pyopencl-2015.2.4-py2.7-linux-x86_64.egg/pyopencl/__init__.py", line 1254, in get_input
    user_input = input(prompt)
EOFError: EOF when reading a line
Choice [0]:0
Reply all
Reply to author
Forward
0 new messages