Author Topic: Sailfish OpenCL fluid simulation  (Read 6034 times)

0 Members and 1 Guest are viewing this topic.

ljbade

  • NewsPosters
  • Jr. Member

  • Offline
  • *

  • 92
    • View Profile
Sailfish OpenCL fluid simulation
« on: January 22, 2010, 11:23:05 AM »
Hi JeGX,

Have you looked at the OpenCL fluid simulation Sailfish before?
http://sailfish.us.edu.pl/index.html

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\lbm_ldc_3d.py", line 54, in <module>
    sim.run()
  File "C:\python26\lib\site-packages\sailfish\lbm.py", line 715, in run
    self.vis.main()
  File "C:\python26\lib\site-packages\sailfish\vis2d.py", line 312, in main
    self.sim.sim_step(self._tracers)
  File "C:\python26\lib\site-packages\sailfish\lbm.py", line 532, in sim_step
    self.backend.run_kernel(kerns[1], self.kern_grid_size)
  File "C:\python26\lib\site-packages\sailfish\backend_opencl.py", line 54, in r
un_kernel
    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 lbm.py:
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.

Also:
Latest 32bit 2.6 python, and latest version of all required modules.
Compiled pyopencl with Visual Studio 2008 Professional SP1.
I am only running OpenCL on CPU as I have not got a graphics card for my new system yet.

Leith

ljbade

  • NewsPosters
  • Jr. Member

  • Offline
  • *

  • 92
    • View Profile
Re: Sailfish OpenCL fluid simulation
« Reply #1 on: January 22, 2010, 11:39:39 AM »
Since I can't attach files, here is a zip file:
http://www.leithalweapon.geek.nz/sailfish-mod.zip

JeGX

  • Global Moderator
  • Hero Member

  • Offline
  • *****

  • 555
    • View Profile
    • Geeks3D.com
Re: Sailfish OpenCL fluid simulation
« Reply #2 on: January 22, 2010, 02:57:00 PM »
In GPU Caps OpenCL demos I don't use compiler options with AMD because AMD's CL doesn't support them yet. Only  NV supports them (like -cl-fast-relaxed-math).

But I'm really busy and currently I don't have time to look at this cool python lib.

Have you tried this lib with GeeXLab ? I guess some functionalities will be missing in GeeXLab, but try to have a look (and it will be easier for me to play with a GeeXLab project).