The very first 100% free GPU accelerated SPH simulation ever!

Gallium compute tools are constantly improving… So much… At a point that if you have an AMD graphic card you should consider stop using Catalyst (or even Crimson), and move to the free driver:

OpenCL man!!!

Of course AQUAgpusph must not be  unaware of this revolution. In the branch 2.2 I adapted the OpenCL tools to work smoothly with LLVM-CLang and libclc… Here what I get with my AMD R9 290:

Performance for the first 100% free GPU accelerated SPH example

In the previous image the performance for the 2D TLD example is shown. The grey line is the instantaneous time consumed per time step, the black solid line is the average value, while the dashed lines are denoting its variance.

I also added a red dashed line to represent the point of the simulation where I modified the working profile of the graphic card, an awesome superpower of the Open Source drivers:

echo "performance" > \
  /sys/class/drm/card0/device/power_dpm_state
echo "high" > \
  /sys/class/drm/card0/device/power_dpm_force_performance_level

As far as I know, this is the very first SPH simulation, accelerated with a GPU, carried out without a single line of non-free software!!! (not even the OS, the framework, the driver, or the ICD loader!!!)

In Ubuntu 15.10, If you have a relatively old hardware, you may use the launchpad repository of Oibaf, purging fglrx and installing LLVM, CLang, libclc (with libclc-r600), and  mesa-opencl-icd. Otherwise you should manually download and install them, something that can be done with the following bash script:

# =============================================================
#!/bin/bash

git clone http://llvm.org/git/llvm.git
cd llvm/tools
git clone http://llvm.org/git/clang.git
cd ../..
git clone http://llvm.org/git/libclc.git
git clone git://anongit.freedesktop.org/mesa/mesa

cd llvm/
mkdir build
cd build/
../configure --enable-targets=x86,amdgpu,r600 --enable-shared \
    --enable-optimized --prefix=/usr
make -j4
sudo make install
cd ../../

cd libclc/
./configure.py --prefix=/usr \
    --pkgconfigdir=/usr/share/pkgconfig/
make clean
make -j4
sudo make install
cd ..

cd mesa
PKG_CONFIG_PATH=/usr/share/pkgconfig/ ./autogen.sh \
    --prefix=/usr --with-dri-drivers="" \
    --with-gallium-drivers=r600,radeonsi \
    --with-egl-platforms=drm --enable-opencl \
    --enable-opencl-icd --disable-dri3
make -j4
sudo make install
# =============================================================

Probably several dependencies will be required to be installed during the process (all of them available trough apt-get).

In Ubuntu 16.04 all this process is probably becoming unnecessary, working “out of the box” with the packages included in the default repositories (it’s something to hope for).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s