Author Topic: OpenCL fluid simulation  (Read 2335 times)

0 Members and 1 Guest are viewing this topic.


  • Guest
OpenCL fluid simulation
« on: December 08, 2018, 02:19:28 PM »
Have you looked at the OpenCL fluid simulation Sailfish before?

It uses pyopencl!

I have been hacking away to get this running under Windows. I have installed Python all the required modules, including compiling pyopencl against the ATI Stream 2.0 SDK.

I had to make a few modifications to Sailfish as it was designed for Linux. This included removing a hardcoded path, and adding support for the OpenCL ICD (selecting an OpenCL platform...).

I have had mixed results.
The example scripts compile fine, and run with no exceptions, yet I get black pixels, and the frames simulated per second is impossibly fast. I have the feeling the kernel is not running, but no error seems to be generated...
Also the ATI compiler always returns warnings that  the -cl-single-precision-constant and -cl-fast-relaxed-math compiler options are not supported despite being in the OpenCL specification...

But I can get the simulation to work perfectly and produce the red pixels if I run it via clprofile.exe! It probably runs slower though thanks to all the logging to stdout and the CSV file...
Why does profiling make it work?!?

Also the 3D simulations always fail with the following error:
Code: [Select]
Traceback (most recent call last):
  File "c:\sailfish\examples\", line 54, in <module>
  File "C:\python26\lib\site-packages\sailfish\", line 715, in run
  File "C:\python26\lib\site-packages\sailfish\", line 312, in main
  File "C:\python26\lib\site-packages\sailfish\", line 532, in sim_step
    self.backend.run_kernel(kerns[1], self.kern_grid_size)
  File "C:\python26\lib\site-packages\sailfish\", line 54, in r
    cl.enqueue_nd_range_kernel(self.queue, kernel, global_size, kernel.block)
pyopencl.LogicError: enqueue_nd_range_kernel failed: invalid value - global/work
 work sizes have differing dimensions

I have traced this back possibly being to line 517 in
Code: [Select]
self.kern_grid_size = (self.options.lat_nx/self.block_size * self.options.lat_ny, self.options.lat_nz)
but if I change this to:
Code: [Select]
self.kern_grid_size = (self.options.lat_nx/self.block_size, self.options.lat_ny, self.options.lat_nz)
the script runs but I get black pixels (even when inside the profiler).

Could you try this out on your setup and see what you get?
I have attached the modified python files.

In case it is any help I have attached a GPU Caps Viewer XML file.