CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

including third party GPU library in OpenFOAM

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   March 13, 2012, 10:39
Question including third party GPU library in OpenFOAM
  #1
New Member
 
Spela I
Join Date: Mar 2012
Posts: 2
Rep Power: 0
spelai is on a distinguished road
Hi,

this is a slightly convoluted question, but please bear with me.

We have incorporated the OpenMM GPU library (https://simtk.org/home/openmm) inside OpenFOAM and are using it to perform Molecular Dynamics force calculations on the GPU. The OpenMM is compiled as a shared library and included in the OpenFOAM MD solver.

OpenMM supports two GPU platforms: CUDA and OpenCL. CUDA is precompiled with a make compiler but OpenCL code gets compiled at runtime. As a consequence, CUDA code runs fine within OpenFOAM, but the OpenCL code crashes.

Unfortunately, we need the OpenCL and we suspect that the problem is due to the difference in compilers. The OpenMM example simulation code uses make and the OpenCL compiled this way works fine. However, when integrated in OpenFOAM, the solver is compiled with wmake and this seems to disagree with the OpenCL code. We have checked all the compiler options but to no avail.

Does anyone have a similar experience with integrating third-party libraries inside OpenFOAM? Would you be able to offer any insight?

Thanks,
Spela
spelai is offline   Reply With Quote

Old   March 13, 2012, 13:21
Default
  #2
Senior Member
 
chegdan's Avatar
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 538
Rep Power: 18
chegdan will become famous soon enough
Quote:
Does anyone have a similar experience with integrating third-party libraries inside OpenFOAM? Would you be able to offer any insight?
A few months ago I had integrated some CUDA into OF and had to achieve this as an extern function while compiling the CUDA separately and then including it in OF compilation. The project is at

http://code.google.com/p/cufflink-library/

the compile script you are interested is in

http://code.google.com/p/cufflink-li...k/nvccWmakeAll

and the example of the extern function in OF is

extern "C" void CFL_AinvPBiCGStab(cusp_equation_system *CES, OFSolverPerformance *OFSP);//extern function in CUDA that solves the equation system

in the file (http://code.google.com/p/cufflink-li...invPBiCGStab.C)

lastly, the definition of the extern function in CUDA is in

http://code.google.com/p/cufflink-li...nvPBiCGStab.cu

Hope that helps.
__________________
Dan

Find me on twitter @dancombest and LinkedIn
chegdan is offline   Reply With Quote

Old   March 13, 2012, 15:35
Default
  #3
New Member
 
Spela I
Join Date: Mar 2012
Posts: 2
Rep Power: 0
spelai is on a distinguished road
Hi Dan,

thank you for your reply. I have found the same thing with CUDA - because it can be fully compiled externally, there seems to be no problem with including it in OF - the OF compiler does not need to recompile it while compiling the solver.

With the OpenCL, things seem to be different as you do not compile it externally, it gets compiled at runtime and it is here that I run into problems.

I'll have a look at your CUDA solution and see if I can get any ideas for how to tackle this.

Regards,
Spela
spelai is offline   Reply With Quote

Old   November 2, 2012, 06:06
Default Have a look at clFoam
  #4
Member
 
Klaus
Join Date: Mar 2009
Posts: 70
Rep Power: 8
klausb is on a distinguished road
Hello,

there has been an OpenCl plugin for OpenFOAM - maybe that helps:

see: OpenCL linear solver for OpenFoam 1.7 (alpha) will come out very soon
...
The OpenCL solver plugin : clFoam v0.1 come out for test.

Until now, clFoam single precision has been tested on ATI 5650M GPU and NVidia Tesla C2050. The speed is slightly slower than CPU on Tesla C2050 for 160000 cells of case: cavity 4 times steps (clPCG). (see profilingDatasheet.xls in profiling data/ for details)

The openCL solver is still promising, as it is a new tech and has great space to improve.

download link:
http://www.iesensor.com/download/clFoam_v0.1.zip

Quite a lot of work to do, any advice on improving the efficiency is appreciated. further, there must be some errors in the manual, DO leave me a email to correct them.

Thanks very much

Yours,

Qingfeng Xia
services@iesensor.com

...

Let me know how it works - I'm planning something similar.

Klaus
klausb is offline   Reply With Quote

Reply

Tags
gpu, molecular dynamics, openfoam, openmm

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2D Mesh Generation Tutorial for GMSH aeroslacker Open Source Meshers: Gmsh, Netgen, CGNS, ... 12 January 19, 2012 04:52
New OpenFOAM Forum Structure jola OpenFOAM 2 October 19, 2011 06:55
Testing of OpenFOAM 1.4alpha Commenced OpenFOAM discussion board administrator OpenFOAM Announcements from ESI-OpenCFD 0 January 16, 2007 10:41
Testing of OpenFOAM 1.3alpha Commenced OpenFOAM discussion board administrator OpenFOAM Announcements from ESI-OpenCFD 0 February 7, 2006 08:31
OpenFOAM Training and Workshop Hrvoje Jasak Main CFD Forum 0 October 7, 2005 07:14


All times are GMT -4. The time now is 08:57.