+ All Categories
Home > Documents > Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng...

Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng...

Date post: 01-Jan-2016
Category:
Upload: marshall-green
View: 218 times
Download: 0 times
Share this document with a friend
25
Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21
Transcript
Page 1: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

Initial experience on openCL pragamming and develop GPU

solver for OpenFoam

Presented by: Qingfeng Xia

School of MACEUniversity of Manchester

Date: 2011-05-21

Page 2: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

Structure

• Part 1. Introduction to OpenCL tools• coding, analyzing, debugging and profiling tools

• ViennaCL C++ template library for BLAS1, 2,3

• Part 2. Introduction to OpenFoam• Summary of GPU plugins

• Part 3. Profiling results• 3.1profiling ViennaCL blas library

• 3.2 profiling OpenFoam with GPU plugins• Future work: real-time PIV and DSMC solver

Page 3: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

AMD APP kernel analyzer and profiler

• Command line tool: sprofile32 for Linux• Gui tool is a plugin for Visual Studio 2008/2010,

Professional version is needed

Page 4: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

AMD APP kernel analyzer

Page 5: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

AMD APP Profiler

Page 6: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

Nvidia visual profiler (cross-platfrom)

Page 7: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

gDEBbuger(cross-platform)

• (1)Powerful tool for openGL debugging and profiling, now available for openCL

• (2) Cross-GPU platform:• Support Nvidia and AMD GPU• (3) Cross-OS: windows and Linux Mac

• Cons: Too powerful to quick get work

Page 8: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

IDE for C++ development (codelite)

• Cross-platform IDE

Page 9: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

viennaCL : openCL c++ blas lib

• Brilliant lib, BLAS I,II, III

• Same API with Boost::ublas, can fall back to CPU

• However, this lib can not been linked with OpenFoam (Error: Segment fault)

Page 10: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

Part 2

Introduction to OpenFoam (CFD)

Installation: (hope your GPU support double precision)

http://www.openfoam.org/archive/2.1.0/download/git.php

Page 11: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

2.1 Quick Introduction to OpenFoam

• Free Computional Fluid Dynamics(CFD)

• (1) OpenFoam is programmed in C++, without an GUI frontend.

• (2)Code_saturne (finite volume) programmed in Fortran, has GUI front end

Page 12: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

GPU solvers for OpenFoam

• (1) OF plugin for OpenFoam (before 2010)• Only free for single precision

• (2) Ofgpm package (GPL, May 2011)• from Symscape.com, Which transplant

OpenFoam from *nix to windows and develop a GUI(Cadium) for OpenFoam

• No preconditioner is implemented,• No benchmark is done

Page 13: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

My work : clUtils, clFoam, vclFoam

Page 14: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

(1) clUtils

• Just as practice of openCL programming, and provide utility for clFoam solver.

• Mainly in C, so there is no template suport,

• Single precision and double precision is switchable via Macro #define scalar float

Page 15: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

(2)clFoam(PCG & PBiCG)

• (1) parallel the CPU serial code to parallel code in openCL, all preconditioners of Openfoam are usable

• (2) my own PCG and Bistab solver implented according to algorithms of textbook.

Page 16: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

(3)vclFoam

• Wrappers to call ViennalCL sparse matrix solving utility.

• No preconditioner is implemented.

• Yet, do not work until now (gcc 4.4 openfoam 1.7)

Page 17: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

Part 3: profiling

• (1) Tricks on the profiling

Page 18: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

Profiling method of ViennaCL

Page 19: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

Vector adding via ViennaCL

Page 20: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

SpeedIT classic PCG solver

• A Japanese research has already make an profiling

• The result show the PCG on GPU is 3 time slower than CPU.

Page 21: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

clFoam profiliing

Page 22: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

Profiling platform

• Redqueen.rcs.manchester.ac.uk

• CPU AMD core 4, 2.3 GHz

• using one core on the cluster node

• GPU: Telsa C2050

Page 23: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

Conclusion

• (1)Looks promising, peak Gflops is hundreds times higher than single CPU.

• (2)But not powerful enough to boost CFD simulation now.

• Domain decomposition is still the most effective way.

Page 24: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

Future work

• (1) Real-time PIV vectoring processing up to 10 Hz.

• Most of calculation time is spent on Inter?? between 32X32pixels spots. it can make the best usage of the fast local cache on GPU.

• (2) Direct simulation Monte Carlo method: particles tracking,etc.

Page 25: Initial experience on openCL pragamming and develop GPU solver for OpenFoam Presented by: Qingfeng Xia School of MACE University of Manchester Date: 2011-05-21.

Acknowledgement

• RCS Dr Mike Bane, Dr. Simon, etc.

• Test on Nvidia GPU of the cluster Redqueen


Recommended