CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Announcements from Other Sources (https://www.cfd-online.com/Forums/openfoam-news-announcements-other/)
-   -   GPU Linear Solvers for OpenFOAM (https://www.cfd-online.com/Forums/openfoam-news-announcements-other/87575-gpu-linear-solvers-openfoam.html)

gocarts April 23, 2011 19:16

GPU Linear Solvers for OpenFOAM
 
ofgpu is a free GPL library from Symscape that provides GPU linear solvers for OpenFOAM®. The experimental library targets NVIDIA CUDA devices on Windows, Linux, and (untested) Mac OS X. It uses the Cusp library's Krylov solvers to produce equivalent GPU (CUDA-based) versions of the standard OpenFOAM linear solvers:
  • PCG - Preconditioned conjugate gradient solver for symmetric matrices (e.g., p)
  • PBiCG - Preconditioned biconjugate gradient solver for asymmetric matrices (e.g., Ux, k)

ofgpu also has support for the OpenFOAM preconditioners:
  • no
  • diagonal

For more details see "GPU Linear Solver Library for OpenFOAM".

OpenFOAM is a registered trademark of OpenCFD and is unaffiliated with Symscape.

Bernhard May 2, 2011 04:04

Hi Richard,

Thanks for the nice work. I was able to compile OpenFOAM-1.7.x and use your plugin on the GPU. Your testcase also worked nicely.

Some comments that may help other people that are installing this library.
- I set gcc 4.3 as a compiler in ofgpu for C, and g++ (this is standard) for C++.
- Other people in my department are already using CUDA, but not Cusp and Thrust, I downloaded Cusp and Thrust code-packages to /ofgpu/src
- To patch, I used patch -p0 < file.patch

To compile OpenFOAM 1.7.x with the gpu library, I did the following
- chmod 770 src/gpu/Allwmake
- touch src/gpu/gpuless/Make/options (this file was missing)
- I think there is a mistake in src/gpu/cuda/Make/options, I used LIB = $(FOAM_LIBBIN)/cuda/libgpu there
- In OF/lib I made a symbolic link named libofgpu.so to the library in the ofgpu directory

You can check the activity of your graphical card with nvidia-smi -a -l

For the standard GPU in my machine with nice CPUs, this test case (pitzDaily) there was only slow down of course.

Richard, thanks for the nice work, I read on the website you're working on implementing additional preconditioners. I'm very of course very interested in those. Keep up the good work!

Best regards,
Bernhard

pablodecastillo May 2, 2011 04:46

Is It necessary to compile all openFoam, or just a library??

Pablo

Bernhard May 2, 2011 05:51

In principle you only have to recompile those parts of the code that are affected by the patch I suppose. Since I have been working with 1.7.1, and this library was designed for 1.7.x, I decided to take the save route and download and compile 1.7.x separate from my other installation. It would be worth trying it on your existing compiled OpenFOAM version.

gocarts May 2, 2011 09:13

Thanks for the feedback
 
Thanks for the feedback Bernard.

You raised some good points:

Quote:

Originally Posted by Bernhard (Post 305868)
- chmod 770 src/gpu/Allwmake
- touch src/gpu/gpuless/Make/options (this file was missing)

I'll update the source code patch shortly to fix these 2 problems.

Quote:

Originally Posted by Bernhard (Post 305868)
- I think there is a mistake in src/gpu/cuda/Make/options, I used LIB = $(FOAM_LIBBIN)/cuda/libgpu there
- In OF/lib I made a symbolic link named libofgpu.so to the library in the ofgpu directory

I think these 2 issues are caused because you are missing one or more of the following:
  • CMAKE_INSTALL_PREFIX variable as <ofgpu-root>/install - while configuring ofgpu with ccmake
  • ln -s <ofgpu-root>/install/release/lib <ofgpu-root>/install/lib - after 'make install'
  • export CUDA_ARCH_PATH=<ofgpu-root> - prior to building and running OpenFOAM

I've edited the build description to make this clearer at: http://www.symscape.com/gpu-openfoam

ahmadlashgar October 17, 2011 08:52

Casting problem
 
Hi,

I've successfully compiled ofgpu.During compilation of OpenFOAM there is casting problem between ofgpu::index and Foam::label.
I can solve the problem by manually cast-forcing. But, is there any quick solution?

Thanks.

The related error is shown here:
PBiCGgpu.C:103: error: no matching function for call to ofgpu::SparseMatrixArgs::SparseMatrixArgs(const char*, Foam::label, Foam::label, ofgpu::index*, ofgpu::index*, ofgpu::index*, ofgpu::real*, ofgpu::real*, ofgpu::index*, ofgpu::index*, ofgpu::real*, ofgpu::real*, ofgpu::real*, int, ofgpu::real, ofgpu::real, ofgpu::real, ofgpu::real, Foam::label, bool&)
/home/tesla/OpenFOAM/ofgpu/src/ofgpu/sparsematrixargs.h:46: note: candidates are: ofgpu::SparseMatrixArgs::SparseMatrixArgs(const char*, ofgpu::index, ofgpu::index, const ofgpu::index*, const ofgpu::index*, const ofgpu::index*, const ofgpu::real*, const ofgpu::real*, const ofgpu::index*, const ofgpu::index*, const ofgpu::real*, ofgpu::real*, const ofgpu::real*, ofgpu::index, ofgpu::real, ofgpu::real, ofgpu::real&, ofgpu::real&, ofgpu::index&, bool&)
/home/tesla/OpenFOAM/ofgpu/src/ofgpu/sparsematrixargs.h:24: note: ofgpu::SparseMatrixArgs::SparseMatrixArgs(const ofgpu::SparseMatrixArgs&)
make: *** [Make/linux64GccDPOpt/PBiCGgpu.o] Error 1

gocarts October 17, 2011 09:36

Foam::label as long, why?
 
So I guess on your system (Linux?) you have Foam::label defined as a long?

That would result from defining 'FOAM_LABEL_64' for label.H

Is this the case?

Do you really need access to integers larger than 2,000,000,000? Do you want to solve for more than 2 Billion cells/faces/nodes?

So my first suggestion is that if you don't need to define FOAM_LABEL_64 then don't (you save memory too) and recompile OpenFOAM.

Second option if you do want to keep FOAM_LABEL_64 then try changing the definition of ofgpu::index to long in index.h. This will cost you scarce GPU memory if it works.

ahmadlashgar October 17, 2011 10:02

The patch file issues
 
Dear gocarts,
Thanks for the quick reply.

You are right, FOAM_LABEL_64 is defined automatically because the operating system is "Ubuntu-Desktop-10.10 64-bit". I've solved the problem with casting.

The compilation proceeds and fails upon Allmake in "/home/tesla/OpenFOAM/OpenFOAM-1.7.1/applications/solvers/multiphase/compressibleInterFoam" directory.

Main errors are:
compressibleInterFoam.C:43:22: error: RASModel.H: No such file or directory
compressibleInterFoam.C:44:22: error: LESModel.H: No such file or directory
followed by:
compressibleInterFoam.C:51: error: "incompressible" has not been declared
compressibleInterFoam.C:52: error: "incompressible" has not been declared

This is caused by the patch file which makes some changes and adds "#include RASModel.H" and "#include LESModel.H" lines to compressibleInterFoam.C. However, these files are not exists in compressibleInterFoam directory.

These files are in the following path:
./src/turbulenceModels/incompressible/RAS/RASModel/RASModel.
./src/turbulenceModels/compressible/RAS/RASModel/RASModel.H

Should I make a soft link? or I have missed something in earlier stages

Thanks.

System: Ubuntu-10.10, OpenFOAM-1.7.1, CUDA 3.1 and GCC 4.4

gocarts October 17, 2011 10:14

What about ofgpu 0.2?
 
Wouldn't you prefer to build the latest version of ofgpu 0.2 with OpenFOAM 2.0.x? http://www.symscape.com/gpu-0-2-openfoam

By the looks of your errors it seems that your build may have failed to create the turbulence libraries. The missing includes should be in:

./src/turbulenceModels/incompressible/lnInclude
./src/turbulenceModels/compressible/lnInclude

ahmadlashgar October 17, 2011 10:25

Ofgpu_0.2
 
Happy to see OFGPU 0.2 is compatible with CUDA 4.0.
I have downgraded thrust, cusp and cuda to make the required compatibility.

I will test OFGPU 0.2 soon,
Thank you

gocarts October 17, 2011 10:32

Don't define FOAM_LABEL_64
 
Just to follow up on:

Quote:

Originally Posted by ahmadlashgar (Post 328232)
FOAM_LABEL_64 is defined automatically

I can't see where this is defined by default. It's not about whether you are compiling 64-bit, it relates to the size of integers. If you can find where it's defined I suggest removing it. Most likely it's somewhere in:

./wmake/rules/<platform>/c++

Edit: Should be FOAM_LABEL64 not FOAM_LABEL_64

ahmadlashgar October 17, 2011 10:38

label.H
 
Actually It is not defined! Following commands show that FOAM_LABEL_64 does not exist but FOAM_LABEL64 is used in label.H and uLabel.H

root@gpu30:~/OpenFOAM# grep -r ./ -e FOAM_LABEL_64
root@gpu30:~/OpenFOAM# grep -r ./ -e FOAM_LABEL64
./OpenFOAM-1.7.1/src/OpenFOAM/lnInclude/label.H:#if FOAM_LABEL64
./OpenFOAM-1.7.1/src/OpenFOAM/lnInclude/uLabel.H:#if FOAM_LABEL64
./OpenFOAM-1.7.1/src/OpenFOAM/primitives/ints/label/label.H:#if FOAM_LABEL64
./OpenFOAM-1.7.1/src/OpenFOAM/primitives/ints/uLabel/uLabel.H:#if FOAM_LABEL64

So the label type is int not long.

gocarts October 17, 2011 10:51

Double precision vs single precision
 
I think then your problems are two fold:
  • You need to patch the exact version of OpenFOAM 1.7.x (not 1.7.1) specified in the instructions at: http://www.symscape.com/gpu-openfoam
  • I guess you are trying to compile in double precision, whereas ofgpu assumes single precision
I haven't tried double precision, so I can't help you with that, though someone in the comments for the instructions mentioned it.

ahmadlashgar October 17, 2011 11:03

How to run the sample?
 
OK. I think the OpenFOAM is now compiled successfully.

I'm new in OpenFOAM. How can run "pitzDailyGpu" sample?
I've extracted the archive, now there exist 3 folders:
0 constant system

Thanks.

romant October 21, 2011 10:51

OF compilation problems
 
Hej,

I still have a problem with the compiling

I use GCC 4.4, thrust 1.4, cusp 0.2, OF 2.0.x (Oct 21st) and applied the patch. Everything else before of-gpu is compiled without errors.

After applying the patch, I can't compile OF 2.0.x anymore. I get problems.

There must be a problem with the include or something because it is missing basically all the files for include like the following

Code:

Making dependency list for source file pimpleFoam.C
could not open file fvCFD.H for source file pimpleFoam.C
Making dependency list for source file icoUncoupledKinematicParcelDyMFoam.C
could not open file fvCFD.H for source file icoUncoupledKinematicParcelDyMFoam.C
could not open file dynamicFvMesh.H for source file icoUncoupledKinematicParcelDyMFoam.C
could not open file volFieldsFwd.H for source file pimpleFoam.C
could not open file surfaceFieldsFwd.H for source file pimpleFoam.C
could not open file fvMatricesFwd.H for source file pimpleFoam.C
could not open file pimpleControl.H for source file pimpleFoam.C
could not open file createPhi.H for source file pimpleFoam.C
could not open file initContinuityErrs.H for source file pimpleFoam.C
could not open file readTimeControls.H for source file pimpleFoam.C
could not open file CourantNo.H for source file pimpleFoam.C
could not open file setDeltaT.H for source file pimpleFoam.C
could not open file continuityErrs.H for source file pimpleFoam.C
could not open file volFieldsFwd.H for source file icoUncoupledKinematicParcelDyMFoam.C
could not open file surfaceFieldsFwd.H for source file icoUncoupledKinematicParcelDyMFoam.C
could not open file fvMatricesFwd.H for source file icoUncoupledKinematicParcelDyMFoam.C
could not open file basicKinematicCollidingCloud.H for source file icoUncoupledKinematicParcelDyMFoam.C
could not open file createDynamicFvMesh.H for source file icoUncoupledKinematicParcelDyMFoam.C
could not open file readGravitationalAcceleration.H for source file icoUncoupledKinematicParcelDyMFoam.C
could not open file createPhi.H for source file icoUncoupledKinematicParcelDyMFoam.C

Unfortunately, this happens at all stages during the compile process.

I tried compiling it without the patch and that works flawlessly.

gocarts October 21, 2011 11:03

Need to match exact OpenFOAM 2.0.x for patch
 
I think your compilation failed earlier. You need to find the first error to diagnose the problem.

The problem you are seeing is a symptom (not the cause) related to missing lnInclude directories.

My guess is that you patched the wrong version of OpenFOAM 2.0.x. Did you see errors during the patch process?

You have to exactly match the git version of OpenFOAM 2.0.x with the patch:

git commit: 2a7a68737dba87d82500df67029a15aeda662c42, Date: Sept. 14 11:28:07 2011

i.e.,

git clone http://github.com/OpenFOAM/OpenFOAM-2.0.x
cd OpenFOAM-2.0.x
git checkout 2a7a68737dba87d82500df67029a15aeda662c42

romant October 21, 2011 13:04

still occuring error
 
Hej Richard,

I did as you suggested

git clone http://github.com/OpenFOAM/OpenFOAM-2.0.x
cd OpenFOAM-2.0.x
git checkout 2a7a68737dba87d82500df67029a15aeda662c42

and then

installed the patch, which goes in without errors now

then i do

chmod ug+x <OpenFOAM-root>/src/gpu/Allwmake
WM_GPU='CUDA'
CUDA_ARCH_PATH=/home/roman/OpenFOAM/ofgpu-0-2

where I am not sure about the last one, ofgpu-0-2 contains
Code:

CMakeCache.txt  CMakeCache.txt~  CMakeFiles  cmake_install.cmake  CMakeLists.txt  COPYING.txt  install  install_manifest.txt  Makefile  ofgpu  README.txt
so i think i have it right, the library when I compiled it, never was under a install/release/lib folder but right away under install/lib so i didn't need to create the soft-link

I then start the compilation with

./Allwmake

and get the following first error

Code:

lex.yy.c:1391: warning: ‘yyunput’ defined but not used
lex.yy.c:1432: warning: ‘input’ defined but not used
+ set -e
+ wmakePrintBuild -check
version changed from previous build
+ /bin/rm -f OpenFOAM/Make/*/global.?
+ wmakeLnInclude OpenFOAM
wmakeLnInclude: linking include files to OpenFOAM/lnInclude
+ wmakeLnInclude OSspecific/POSIX
wmakeLnInclude: linking include files to OSspecific/POSIX/lnInclude
+ OSspecific/POSIX/Allwmake
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file signals/sigSegv.C
Making dependency list for source file signals/sigFpe.C
Making dependency list for source file signals/sigInt.C
Making dependency list for source file signals/sigQuit.C
Making dependency list for source file regExp.C
Making dependency list for source file fileStat.C
Making dependency list for source file timer.C
Making dependency list for source file POSIX.C
Making dependency list for source file clockTime/clockTime.C
Making dependency list for source file cpuTime/cpuTime.C
Making dependency list for source file memInfo/memInfo.C
Making dependency list for source file printStack.C
Making dependency list for source file fileMonitor.C
POSIX.C: In function ‘bool Foam::ping(const Foam::word&, Foam::label, Foam::label)’:
POSIX.C:1074:25: warning: use of old-style cast [-Wold-style-cast]
POSIX.C:1074:25: warning: use of old-style cast [-Wold-style-cast]
+ Pstream/Allwmake
+ wmake libso dummy
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file UIPread.C
Making dependency list for source file UOPwrite.C
Making dependency list for source file UPstream.C
+ set +x
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file UIPread.C
Making dependency list for source file UOPwrite.C
could not open file omp.h for source file UIPread.C
could not open file omp.h for source file UOPwrite.C
Making dependency list for source file UPstream.C
could not open file omp.h for source file UPstream.C
could not open file openmpi/ompi/mpi/cxx/mpicxx.h for source file UIPread.C
Making dependency list for source file PstreamGlobals.C
could not open file openmpi/ompi/mpi/cxx/mpicxx.h for source file UOPwrite.C
could not open file omp.h for source file PstreamGlobals.C
could not open file openmpi/ompi/mpi/cxx/mpicxx.h for source file UPstream.C
could not open file openmpi/ompi/mpi/cxx/mpicxx.h for source file PstreamGlobals.C

it then has exactly the same errors as before, that it can't open the header files for the C files, because it can't find them, like beginning with the gpu part

Code:

+ [ TRUE =  ]
+ gpu/Allwmake
+ wmake libso gpuless
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file PBiCGgpu.C
Making dependency list for source file PCGgpu.C
+ wmake libso cuda
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file cudaGpu.C
could not open file ofgpu/ofgpuconfig.h for source file cudaGpu.C
Making dependency list for source file PBiCGgpu.C
could not open file ofgpu/pbicg.h for source file PBiCGgpu.C
could not open file ofgpu/sparsematrixargs.h for source file PBiCGgpu.C
Making dependency list for source file PCGgpu.C
could not open file ofgpu/pcg.h for source file PCGgpu.C
could not open file ofgpu/sparsematrixargs.h for source file PCGgpu.C
PBiCGgpu.C:23:25: fatal error: ofgpu/pbicg.h: No such file or directorycudaGpu.C:23:31: fatal error: ofgpu/ofgpuconfig.h: No such file or directory
compilation terminated.


gocarts October 21, 2011 13:31

Paths wrong
 
Errors I see:
  • "could not open file omp.h for source file UIPread.C"
  • "could not open file ofgpu/ofgpuconfig.h for source file cudaGpu.C"

So there's something wrong with your paths.

Don't bother compiling MPI (doesn't work with GPU), so set "WM_MPLIB=NONE"
Check that "/home/roman/OpenFOAM/ofgpu-0-2/ofgpu/*.h" exists

The fact that you don't have "<ofgpu-root>/install/release/lib" sounds like you didn't set "Set the CMAKE_INSTALL_PREFIX variable to <ofgpu-root>/install" or you didn't set the ofgpu build type to "release"

Check that the ofgpu build and install was successful.

gocarts October 21, 2011 15:31

bashrc args
 
Another thought.

You have to supply your settings "WM_GPU='CUDA' CUDA_ARCH_PATH=/home/roman/OpenFOAM/ofgpu-0-2"

as args to etc/bashrc e.g.,:

export FOAM_INST_DIR="$(HOME)/projects/of/of2.0"; source $(FOAM_INST_DIR)/OpenFOAM-2.0.x/etc/bashrc WM_GPU='CUDA' CUDA_ARCH_PATH=/home/roman/OpenFOAM/ofgpu-0-2 etc...

ahmadlashgar October 22, 2011 09:34

Performance of OFGPU
 
Hi all,

First I should thank gocarts for supporting OFGPU :)

I've succeeded to compile and run OpenFOAM-1.7.1 and OFGPU-0.1 and evaluate it. Here I have reported the performance comparison between CPU and GPU. The benchmark is pitzDailyGPU. One can run the benchmark using following commands:
blockMesh
simpleFoam

System CPU: AMD Opteron 6134
System GPU: NVIDIA Tesla C2050

For 12225 Cells:
CPU Time: 16 s
GPU Time: 45 s

For 122250 Cells:
CPU Time: 303 s
GPU Time: 105 s

For 299100 Cells:
CPU Time: 808 s
GPU Time: 186 s

romant October 23, 2011 05:14

Hej Richard

I made sure that the files exist and I sourced everything again.

Code:

roman@pc070245:~/OpenFOAM/OpenFOAM-2.0.x$ export  FOAM_INST_DIR="/home/roman/OpenFOAM"; source  $FOAM_INST_DIR/OpenFOAM-2.0.x/etc/bashrc WM_GPU='CUDA'  CUDA_ARCH_PATH=/home/roman/OpenFOAM/ofgpu-0-2 WM_MPLIB=NONE
I then start the code, but I am still getting errors. The path should be right. Compiling of of-gpu went find and I didn't get any errors. I soft linked the install/release/lib to install/lib.

Code:

roman@pc070245:~/OpenFOAM/OpenFOAM-2.0.x$ ./Allwmake
make: Nothing to be done for `all'.
no ThirdParty sources found - skipping
+ set -e
+ wmakePrintBuild -check
same version as previous build
+ wmakeLnInclude OpenFOAM
+ wmakeLnInclude OSspecific/POSIX
+ OSspecific/POSIX/Allwmake
'/home/roman/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/libOSspecific.o' is up to date.
+ Pstream/Allwmake
+ wmake libso dummy
'/home/roman/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/dummy/libPstream.so' is up to date.
+ wmake libso OpenFOAM
'/home/roman/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so' is up to date.
+ [ TRUE =  ]
+ gpu/Allwmake
+ wmake libso gpuless
'/home/roman/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/lib/gpuless/libgpu.so' is up to date.
+ wmake libso cuda
SOURCE=cudaGpu.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100  -I/home/roman/OpenFOAM/ofgpu-0-2/src -IlnInclude -I. -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/OpenFOAM/lnInclude -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/cudaGpu.o
cudaGpu.C:23:31: fatal error: ofgpu/ofgpuconfig.h: No such file or directory
compilation terminated.
make: *** [Make/linux64GccDPOpt/cudaGpu.o] Error 1

I marked something in read. I know that the path does not exist. I checked that the green-marked file and path exist. and they do. Further down the compilation it is missing many more files and always results in the same errors. like
Code:

+ wmake all utilities
make[1]: Entering directory `/home/roman/OpenFOAM/OpenFOAM-2.0.x/applications/utilities/mesh'
make[2]: Entering directory `/home/roman/OpenFOAM/OpenFOAM-2.0.x/applications/utilities/mesh/advanced'
make[3]: Entering directory `/home/roman/OpenFOAM/OpenFOAM-2.0.x/applications/utilities/mesh/advanced/PDRMesh'
SOURCE=PDRMesh.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/meshTools/lnInclude -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/dynamicMesh/lnInclude -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/OpenFOAM/lnInclude -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/PDRMesh.o
PDRMesh.C:45:26: fatal error: fvMeshSubset.H: No such file or directory
compilation terminated.
make[3]: *** [Make/linux64GccDPOpt/PDRMesh.o] Error 1
make[3]: Target `/home/roman/OpenFOAM/OpenFOAM-2.0.x/platforms/linux64GccDPOpt/bin/PDRMesh' not remade because of errors.
make[3]: Leaving directory `/home/roman/OpenFOAM/OpenFOAM-2.0.x/applications/utilities/mesh/advanced/PDRMesh'
make[2]: *** [PDRMesh] Error 2
make[3]: Entering directory `/home/roman/OpenFOAM/OpenFOAM-2.0.x/applications/utilities/mesh/advanced/autoRefineMesh'
SOURCE=autoRefineMesh.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/dynamicMesh/lnInclude -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/meshTools/lnInclude -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/triSurface/lnInclude -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/lagrangian/basic/lnInclude -IlnInclude -I. -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/OpenFOAM/lnInclude -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/autoRefineMesh.o
autoRefineMesh.C:32:32: fatal error: twoDPointCorrector.H: No such file or directory
compilation terminated.

in this one all the green lnInclude directories are missing.

ahmadlashgar October 23, 2011 05:21

To solve "fatal error: ofgpu/ofgpuconfig.h: No such file or directory"
 
Hi romant,

ofgpu-0.2 does not create ./src directory. you should make it your self.
To solve "fatal error: ofgpu/ofgpuconfig.h: No such file or directory" copy "ofgpu-0-2/ofgpu" directory to "ofgpu-0-2/src/":

mkdir ofgpu-0-2/src -p
cp -r ofgpu-0-2/ofgpu ofgpu-0-2/src/

Ahmad

romant October 23, 2011 05:28

thank you, but this still leaves some errors to work on. like all the linking errors that I mentioned with the normal openfoam :( and now it at least tries to compile part of the of-gpu, but still runs into problem, namely, when building PBiCGgpu.C

Code:

SOURCE=PBiCGgpu.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100  -I/home/roman/OpenFOAM/ofgpu-0-2/src -IlnInclude -I. -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/OpenFOAM/lnInclude -I/home/roman/OpenFOAM/OpenFOAM-2.0.x/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/PBiCGgpu.o
PBiCGgpu.C: In member function ‘virtual Foam::lduMatrix::solverPerformance Foam::PBiCGgpu::solve(Foam::scalarField&, const scalarField&, Foam::direction) const’:
PBiCGgpu.C:88:72: error: no matching function for call to ‘ofgpu::SparseMatrixArgs::SparseMatrixArgs(const char*, Foam::label, Foam::label, Foam::UList<int>::const_iterator, Foam::UList<int>::const_iterator, Foam::UList<int>::const_iterator, Foam::UList<double>::const_iterator, Foam::UList<double>::const_iterator, Foam::UList<int>::const_iterator, Foam::UList<int>::const_iterator, Foam::UList<double>::const_iterator, Foam::UList<double>::iterator, Foam::UList<double>::const_iterator, const label&, const scalar&, const scalar&, Foam::scalar&, Foam::scalar&, Foam::label&, bool&)’
PBiCGgpu.C:88:72: note: candidates are:
/home/roman/OpenFOAM/ofgpu-0-2/src/ofgpu/sparsematrixargs.h:46:5: note: ofgpu::SparseMatrixArgs::SparseMatrixArgs(const char*, ofgpu::index, ofgpu::index, const index*, const index*, const index*, const real*, const real*, const index*, const index*, const real*, ofgpu::real*, const real*, ofgpu::index, ofgpu::real, ofgpu::real, ofgpu::real&, ofgpu::real&, ofgpu::index&, bool&)
/home/roman/OpenFOAM/ofgpu-0-2/src/ofgpu/sparsematrixargs.h:46:5: note:  no known conversion for argument 7 from ‘Foam::UList<double>::const_iterator {aka const double*}’ to ‘const real* {aka const float*}’
/home/roman/OpenFOAM/ofgpu-0-2/src/ofgpu/sparsematrixargs.h:24:10: note: ofgpu::SparseMatrixArgs::SparseMatrixArgs(const ofgpu::SparseMatrixArgs&)
/home/roman/OpenFOAM/ofgpu-0-2/src/ofgpu/sparsematrixargs.h:24:10: note:  candidate expects 1 argument, 20 provided
make: *** [Make/linux64GccDPOpt/PBiCGgpu.o] Error 1

and of course the missing lnInclude directories.

ahmadlashgar October 23, 2011 05:54

$WM_PRECISION or a similar environment variable
 
Hi Roman,

I had the same problem. You should export $WM_PRECISION or a similar environment variable in <open-foam-root>/etc/bashrc

It should have "SP" value since ofgpu supports only single-precision floating point. For you, its value is "DP" probably.

Recompiling all modules is needed :)

gocarts October 24, 2011 10:55

Missing src directory
 
Quote:

Originally Posted by ahmadlashgar (Post 329059)
ofgpu-0.2 does not create ./src directory

I see the problem - I missed the src directory in my package hierarchy (ofgpu-0-2.tgz). I've fixed it now, should be good to go. Thanks for finding/reporting this problem.

I've also added a note about single precision in the instructions: http://www.symscape.com/gpu-0-2-openfoam

arphy November 22, 2011 13:01

Unknown function type cudaGpu
 
I finished compiling and obtained libgpu.so in
platforms/linux64GccSPOpt/lib/cuda/
but when I tried pitzDailyGpu, I've got the following error
Starting time loop

--------------------------
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1141
dlopen error : gpu: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96
could not load "gpu"
--> FOAM Warning :
From function dlLibraryTable::open(const dictionary&, const word&, const TablePtr&)
in file lnInclude/dlLibraryTableTemplates.C at line 67
Could not open library "gpu"

--> FOAM FATAL ERROR:
Unknown function type cudaGpu
-------------------------------------------

am I missing something here ?

gocarts November 22, 2011 13:07

Check libofgpu.so
 
Check that libofgpu.so is also in your LD_LIBRARY_PATH

wyldckat November 22, 2011 15:23

Greetings to all!
Quote:

Originally Posted by arphy (Post 333139)
--> FOAM Warning :
From function dlLibraryTable::open(const dictionary&, const word&, const TablePtr&)
in file lnInclude/dlLibraryTableTemplates.C at line 67
Could not open library "gpu"

That name in bold is unrolled to "libgpu.so".

Quote:

Originally Posted by gocarts (Post 333141)
Check that libofgpu.so is also in your LD_LIBRARY_PATH

@arphy: Along with Richard's suggestion, I'm also guessing that there is a typo somewhere in you case's "controlDict" file? "gpu" instead of "ofgpu".

Best regards,
Bruno

gocarts November 22, 2011 16:09

gpu in controlDict is correct
 
Quote:

Originally Posted by arphy
I finished compiling and obtained libgpu.so in
platforms/linux64GccSPOpt/lib/cuda/

It's correct to load libgpu.so ("gpu" in your controlDict) and I was thinking that given libgpu.so is in the right location, it is more likely that libofgpu.so (which libgpu.so references) was not being found and therefore loading libgpu.so would fail.

For reference libgpu.so is the bridge library between OpenFOAM and libofgpu.so. libofgpu.so is independent of OpenFOAM and only references CUDA libraries.

Quote:

Originally Posted by wyldckat
...typo somewhere in your case's "controlDict" file? "gpu" instead of "ofgpu".

No, as discussed above controlDict should refer to gpu not ofgpu.

Bruno, partly this confusion is likely because I named the libs so similar and it's easy to miss refer to the wrong one.

gocarts November 22, 2011 16:39

Try replacing "gpu" with "libgpu.so"
 
Another thought, try replacing "gpu" in controlDict with "libgpu.so" - though this shouldn't be necessary. I suggest this because the dlopen error message shouldn't be reported in it's raw form, at least not in OpenFOAM 2.0.x, yet that is what you are seeing.

Just to be clear which version of OpenFOAM and ofgpu are you using?

arphy November 22, 2011 23:46

Quote:

Originally Posted by gocarts (Post 333174)
Another thought, try replacing "gpu" in controlDict with "libgpu.so" - though this shouldn't be necessary. I suggest this because the dlopen error message shouldn't be reported in it's raw form, at least not in OpenFOAM 2.0.x, yet that is what you are seeing.

Just to be clear which version of OpenFOAM and ofgpu are you using?


Thanks you very much for your help. It is working now.
This part in my controlDict looks like this
functions
{
cudaGpu
{
type cudaGpu;
functionObjectLibs ("libgpu.so");
cudaDevice 0;
}
}

What do you think why the normal setting does not work ?
BTW. My OpenFoam is the one I clone from the repository yesterday (have no idea how to check the version via git)
I will redo another make with your designated version of OpenFoam.

gocarts November 23, 2011 08:46

Match git commit
 
Quote:

Originally Posted by arphy (Post 333203)
My OpenFoam is the one I clone from the repository yesterday (have no idea how to check the version via git)
I will redo another make with your designated version of OpenFoam.

I think the version you checked out of git has a modified Foam::dlopen routine.

For the patch to work correctly you need to match the exact version of OpenFOAM from git.

git commit: 2a7a68737dba87d82500df67029a15aeda662c42, Date: Sept. 14 11:28:07 2011.

Use:
  1. git clone http://github.com/OpenFOAM/OpenFOAM-2.0.x
  2. cd OpenFOAM-2.0.x
  3. git checkout 2a7a68737dba87d82500df67029a15aeda662c42
  4. apply patch

sontac February 12, 2012 15:29

error with nviroment variable for OpenFOAM-2.1.x
 
As I download OpenFOAam-2.1.x from https://github.com/OpenFOAM/OpenFOAM-2.1.x and apply the patch.

I run the foamSystemCheck to check if I can compile OpenFOAM
then I run foamInstallationTest to check if I source my ~/.bashrc correctly
and I got the errors shown below. No error during applying patch. Plz help !!

ERROR MESSAGE IN TERMINAL:
Code:

Executing ./foamInstallationTest:


Checking basic setup...
-------------------------------------------------------------------------------

FATAL ERROR: OpenFOAM environment not configured.

    Please refer to the installation section of the README file:
    <OpenFOAM installation dir>/OpenFOAM-2.1.x/README
    to source the OpenFOAM environment.


sontac February 14, 2012 12:20

Need Help debugging this message
 
I'm trying to compile cuda with wmake within ~/OpenFOAM/OpenFOAM-2.1.0/src/gpu/cuda/ and have the errors shown below. What does it mean ?

Code:

g++ -m32 -Dlinux -DWM_SP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-100  -I/home/hai-nguyen/ofgpu-0-2/src -IlnInclude -I. -I/home/hai-nguyen/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude -I/home/hai-nguyen/OpenFOAM/OpenFOAM-2.1.0/src/OSspecific/POSIX/lnInclude  -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linuxGccDPOpt/cudaGpu.o Make/linuxGccDPOpt/PBiCGgpu.o Make/linuxGccDPOpt/PCGgpu.o -L/home/hai-nguyen/OpenFOAM/OpenFOAM-2.1.0/platforms/linuxGccDPOpt/lib \
          -lOpenFOAM -ldl  -lm -o OpenFOAM.out
/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
Make/linuxGccDPOpt/cudaGpu.o: In function `Foam::cudaGpu::cudaGpu(Foam::word const&, Foam::Time const&, Foam::dictionary const&)':
cudaGpu.C:(.text+0x64c): undefined reference to `ofgpuConfig'
Make/linuxGccDPOpt/cudaGpu.o: In function `Foam::cudaGpu::cudaGpu(Foam::word const&, Foam::Time const&, Foam::dictionary const&)':
cudaGpu.C:(.text+0x8fc): undefined reference to `ofgpuConfig'
Make/linuxGccDPOpt/PBiCGgpu.o: In function `Foam::PBiCGgpu::PBiCGgpu(Foam::word const&, Foam::lduMatrix const&, Foam::FieldField<Foam::Field, float> const&, Foam::FieldField<Foam::Field, float> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, Foam::dictionary const&)':
PBiCGgpu.C:(.text+0x48): undefined reference to `Foam::PBiCG::PBiCG(Foam::word const&, Foam::lduMatrix const&, Foam::FieldField<Foam::Field, float> const&, Foam::FieldField<Foam::Field, float> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, Foam::dictionary const&)'
Make/linuxGccDPOpt/PBiCGgpu.o: In function `Foam::PBiCGgpu::PBiCGgpu(Foam::word const&, Foam::lduMatrix const&, Foam::FieldField<Foam::Field, float> const&, Foam::FieldField<Foam::Field, float> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, Foam::dictionary const&)':
PBiCGgpu.C:(.text+0xb8): undefined reference to `Foam::PBiCG::PBiCG(Foam::word const&, Foam::lduMatrix const&, Foam::FieldField<Foam::Field, float> const&, Foam::FieldField<Foam::Field, float> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, Foam::dictionary const&)'
Make/linuxGccDPOpt/PBiCGgpu.o: In function `Foam::PBiCGgpu::solve(Foam::Field<float>&, Foam::Field<float> const&, unsigned char) const':
PBiCGgpu.C:(.text+0x7dd): undefined reference to `ofgpuPBiCGsolve'
Make/linuxGccDPOpt/PCGgpu.o: In function `Foam::PCGgpu::PCGgpu(Foam::word const&, Foam::lduMatrix const&, Foam::FieldField<Foam::Field, float> const&, Foam::FieldField<Foam::Field, float> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, Foam::dictionary const&)':
PCGgpu.C:(.text+0x48): undefined reference to `Foam::PCG::PCG(Foam::word const&, Foam::lduMatrix const&, Foam::FieldField<Foam::Field, float> const&, Foam::FieldField<Foam::Field, float> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, Foam::dictionary const&)'
Make/linuxGccDPOpt/PCGgpu.o: In function `Foam::PCGgpu::PCGgpu(Foam::word const&, Foam::lduMatrix const&, Foam::FieldField<Foam::Field, float> const&, Foam::FieldField<Foam::Field, float> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, Foam::dictionary const&)':
PCGgpu.C:(.text+0xb8): undefined reference to `Foam::PCG::PCG(Foam::word const&, Foam::lduMatrix const&, Foam::FieldField<Foam::Field, float> const&, Foam::FieldField<Foam::Field, float> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, Foam::dictionary const&)'
Make/linuxGccDPOpt/PCGgpu.o: In function `Foam::PCGgpu::solve(Foam::Field<float>&, Foam::Field<float> const&, unsigned char) const':
PCGgpu.C:(.text+0x7dd): undefined reference to `ofgpuPCGsolve'
collect2: ld returned 1 exit status
make: *** [OpenFOAM.out] Error 1


akidess February 15, 2012 03:00

Probably that you should have used 'wmake libso' to build a library instead of an executable.

twray March 1, 2012 20:41

***EDIT***
I wasn't configuring cmake correctly. I followed directions in the comments of the symscape website and now have everything working.
************

Applying
$ cmake -DCMAKE_INSTALL_PREFIX=/opt/ofgpu-0-2/install

gives me the following errors

Code:

CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA  (missing:  CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_CUDART_LIBRARY (ADVANCED)
    linked by target "ofgpu" in directory /opt/ofgpu-0-2/src/ofgpu
CUDA_TOOLKIT_INCLUDE (ADVANCED)
  used as include directory in directory /opt/ofgpu-0-2/src/ofgpu

-- Configuring incomplete, errors occurred!

How do I resolve these errors? Should I be using -DCMAKE_INSTALL_PREFIX=/opt/ofgpu-0-2/src/ofgpu/install?

I can apply the OF patch with no errors.
I'm on 64bit Ubuntu 10.04. For reference my $HOME/.bashrc file contains

Code:

export CUDA_HOME="/opt/cuda"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${CUDA_HOME}/lib64"
export PATH=${CUDA_HOME}/bin:${PATH}


savee March 29, 2017 08:05

pitzDailyGpu example is not working
 
Hello,

I am trying to use ofgpu-1-1-0 library to accelerate the performance of linear solver in OpenFoam 2.2.x.
I have followed the steps given on http://www.symscape.com/gpu-1-1-openfoam link.
Try to execute the given example pitzDailyGpu.
But, the error is like...

-------------------------------------------------------------------------------------------------------------------------------
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libgpu.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libgpu.so"
--> FOAM Warning :
From function dlLibraryTable::open(const dictionary&, const word&, const TablePtr&)
in file lnInclude/dlLibraryTableTemplates.C at line 67
Could not open library "libgpu.so"



--> FOAM FATAL ERROR:
Unknown function type cudaGpu

Valid functions are :

4
(
patchProbes
probes
sets
surfaces
)



From function functionObject::New(const word& name, const Time&, const dictionary&)
in file db/functionObjects/functionObject/functionObject.C at line 92.

FOAM exiting
-------------------------------------------------------------------------------------------------------------------------------

As told in the earlier post that change the functionObjectLibs ("gpu"); to functionObjectLibs ("libgpu.so");
still, the same error is occurring.

How can I resolve this error?

Diego Alex Mayer August 17, 2022 14:22

Hello,
I'm having trouble compiling ofgpu. I didn't really understand how to make this compilation. Can you help me?
Best Regards,
Diego


All times are GMT -4. The time now is 18:16.