The OpenFOAM extend group has contributed to this by adding libraries for solvers to harness the power of GPU. I have an NVIDIA GeForce GTX 650 Ti 2GB Graphics card and first wanted to compile the cudaSolvers in foam-extend.
So some of the basic steps which are required for compilation are as shown below :
1. Install NVIDIA cuda libraries for your system ( https://developer.nvidia.com/cuda-downloads ).
2. After this before compiling foam-extend source the environment variable for compiling cuda solvers. On the terminal type the command below and hit enter
export CUDA_ARCH=sm_30
3. Compile foam-extend by running the ./Allwmake.firstInstall script
4. Once the compilation is finished we can now compile the CUDA solvers separately by running the Allwmake file inside $FOAM_SRC/cudaSolvers
5. But wait, this might still throw up some errors. So we need to complete a few more steps before compiling cudaSolvers
a ) Set the path for CUDA nvcc. You can save these lines in you etc/bashrc file so you can save time exporting these everytime you need to run the cuda based solvers
export set PATH=/usr/local/cuda-7.5/bin:$PATH
export set LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH
b ) You will also require CUSP for compiling the cuda libraries
cusp library v0.4.0
Download it from : https://github.com/cusplibrary/cusplibrary.git
Rename the zip file as " cusp " .This library needs to be saved inside the cuda directory in /usr/local/cuda-7.5
c ) I had some trouble while compiling the cudaSolvers, but when I checked options file in Make directory my error was solved. Basically we need to set the CUDA_INCLUDE_DIR path to include all the required files for running cudaSolvers.
export CUDA_INCLUDE_DIR=$CUDA_DIR/include
d ) Now compile the cudaSolvers , and once it says that
'libcudaSolvers.so' is up to date
Your work is done
Now my next task would be to work with these solvers and check how fast the cuda libraries work for OpenFOAM extend.
No comments:
Post a Comment