GPU Linear Solver Library for OpenFOAM
For the latest version of our Windows patch for OpenFOAM visit "OpenFOAM 2.2.x on Windows".
ofgpu is our free GPL library that provides GPU (sometimes referred to as GPGPU) linear solvers for OpenFOAM®. Sponsored by the Microsoft DPE team, the library targets NVIDIA CUDA devices on Windows, Linux, and (untested) Mac OS X. While this effort is still in the experimental stage, GPU acceleration holds the promise of providing significant speed up at relatively low cost and with low power consumption compared to other alternatives. If you want to try our ofgpu library with OpenFOAM then we recommend that you use either a dedicated (i.e., not displaying graphics) high-performance NVIDIA graphics card or a TESLA card.
Are you looking for a GUI driven, integrated simulation environment with GPU support for Windows and Linux with NVIDIA CUDA devices incorporating a selection of the RANS OpenFOAM solvers and various import/export filters?
In our ofgpu library we use the Cusp library's Krylov solvers to produce equivalent GPU (CUDA) versions of the standard OpenFOAM linear solvers:
- PCG - Preconditioned conjugate gradient solver for symmetric matrices (e.g., p)
- PBiCG - Preconditioned biconjugate gradient solver for asymmetric matrices (e.g., Ux, k)
We also have support in ofgpu for the OpenFOAM preconditioners:
Providing better preconditioners, such as DILU (asymmetric) and DIC (symmetric), is clearly an area for further work.
We have not yet performed any benchmarks.
- You are familiar with the OpenFOAM build process
- You are familiar with CMake
- You have a CUDA-capable NVIDIA device, such as a TESLA C2070
Install and test:
- Latest NVIDIA graphics driver
- Latest CUDA Toolkit (including Thrust) and GPU Computing SDK
- Cusp - sparse linear algebra library
- CMake - cross platform make
- OpenFOAM 1.7.x source - git commit: 14b79332ee4a1827656951db39fe81cc5ba52d78, Date: Tue Nov 16 20:41:48 2010
This build procedure assumes single precision.
- Download our free GPL licensed ofgpu library [last update April 23, 2011 to v0.1].
- Configure and generate the build system for ofgpu with CMake, Set the
- Build ofgpu
- On *nix systems
make installand create the symbolic link:
ln -s <ofgpu-root>/install/release/lib <ofgpu-root>/install/lib
- For Windows you will need to build ofgpu natively using Visual Studio and then transfer ofgpu.dll and ofgpu.lib to your Linux system for cross compiling. Place your natively compiled Windows files in
<ofgpu-root>/install/win/libon your Linux system.
- On *nix systems
- Patch your OpenFOAM source with our CUDA modifications [last updated May 3, 2011 to v7]. This is the same source code patch that adds Windows support for OpenFOAM.
chmod ug+x <OpenFOAM-root>/src/gpu/Allwmake
- Build OpenFOAM in the usual manner, but with the addition of the environment variables:
The build process will produce the following 2 new OpenFOAM libraries:
Under Windows you will need to have the <OpenFOAM-root>/lib/<platform>/cuda directory in your executable path to use the library.
For an example of a GPU-enabled case try pitzDailyGpu.
The GPU library is loaded in
As an example the p and U linear solvers in the
<case>/system/fvSolution file are modified as follows:
If you don't export the
WM_GPU='CUDA' variable on *nix or you put the
<OpenFOAM-root>/lib/<platform>/gpuless directory in your Windows executable path then the 'dummy' gpu library will be used, which defaults to the standard OpenFOAM PCG and PBiCG solvers .
OpenFOAM is a registered trademark of OpenCFD and is unaffiliated with Symscape.