|
[Sponsors] |
OpenFOAM external CUDA code with functionObject |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 3, 2022, 05:33 |
OpenFOAM external CUDA code with functionObject
|
#1 |
New Member
Lukas Heisler
Join Date: May 2022
Posts: 4
Rep Power: 4 |
Hello everyone,
i am quite new to OpenFOAM. My current task is to implement part of a custom solver in CUDA. Basically some particle cloud is calculated on the GPU, while the CPU solver handles the rest. Now as a start, I would like to be able to compile a simple .so library with CUDA code as external C and be able to call it with a function object. So basically let the GPU say hello. I have read probably every thread that covers this or similar problems but was not able to find an answer. This is what my files look right now: the following is in the folder customLibrary customLibrary.cu #include "cuda.h" #include <iostream> #include "hello.cu" hello.cu void helloWorld() { std::cout << "Hello World" << std::endl; } hello.H #ifdef __cplusplus #include <iostream> extern "C" #endif void helloWorld(); files hello.H LIB = $(FOAM_USER_LIBBIN)/libcustomLibrary options EXE_INC = \ -I/usr/local/cuda/include LIB_LIBS = the following is in the main folder of the solver Allwmake cd customLibrary wclean nvcc --shared -Xcompiler -fPIC -o $FOAM_LIBBIN/libcustomLibrary.so customLibrary.cu -I/usr/local/cuda/include -L/usr/local/cuda/lib -lcudart wmake libso cd .. wmake solidParticleInterFoam.C ... #include "hello.H" ... some code helloWorld(); this setup seems to compile the library with no visible errors. But when I start a simulation I get the following error: symbol lookup error: solidParticleInterFoam: undefined symbol: _Z10helloWorldv If anyone could help me with this or has done something similar, I would highly appreciate any help. Many thanks and all the best! |
|
March 26, 2024, 08:24 |
|
#2 |
New Member
Angel Malaguera
Join Date: May 2016
Location: Florianópolis, SC, Brazil
Posts: 20
Rep Power: 10 |
Hello Lucas how are you
Did you manage to solve that problem? You use CUDA with which version of OpenFoam? Angel... |
|
Tags |
functionobject, gpgpu, gpu, openfoam |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM, progress in academia and industry, after 13 years' effort | sharonyue | OpenFOAM | 5 | March 29, 2018 13:09 |
Very small job: converting an OpenFOAM mesh to a format needed by another code | SFr | CFD Freelancers | 1 | June 24, 2016 06:45 |
[Other] Comparing OpenFOAM to another code: advice on dealing with meshes? | SFr | OpenFOAM Meshing & Mesh Conversion | 1 | June 11, 2016 13:02 |
Memory protection in OpenFOAM / combinig with FORTRAN | botp | OpenFOAM Programming & Development | 2 | February 15, 2016 13:25 |
OpenFOAM v3.0.1 Training, London, Houston, Berlin, Jan-Mar 2016 | cfd.direct | OpenFOAM Announcements from Other Sources | 0 | January 5, 2016 04:18 |