CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   including third party GPU library in OpenFOAM (https://www.cfd-online.com/Forums/openfoam-programming-development/98542-including-third-party-gpu-library-openfoam.html)

spelai March 13, 2012 09:39

including third party GPU library in OpenFOAM
 
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

chegdan March 13, 2012 12:21

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.

spelai March 13, 2012 14:35

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

klausb November 2, 2012 05:06

Have a look at clFoam
 
Hello,

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

see: http://www.cfd-online.com/Forums/ope...very-soon.html
...
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


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