SimFlowCFD / RapidCFD-dev

RapidCFD is an OpenFOAM fork running fully on CUDA platform. Brought to you by
https://sim-flow.com
Other
328 stars 95 forks source link

RapidCFD errors with CUDA 11.2, 11.3, 11.4 and 11.5 #92

Open TonkomoLLC opened 3 years ago

TonkomoLLC commented 3 years ago

Hello, In case anyone else tries to compile RapidCFD with one of the more recent (as of Sept 2021) verisons of CUDA.... On my machine (stock Ubuntu 20.04 - meaning gcc 9.3.0 and any other default toolchain items),

Here is a workaround.

In PointHit.H, replace line 89:

            hitPoint_(vector::zero),

with

            hitPoint_(vector(0,0,0)),

The code then compiles and except for the libforces issue, it seems to run OK.

SolidBodyMotionFvMesh/multiSolidBodyMotionFvMesh.C:104:6: error: reference to ‘const_iterator’ is ambiguous
  104 |     forAllConstIter(dictionary, dynamicMeshCoeffs_, iter)

  solidBodyMotionFvMesh/multiSolidBodyMotionFvMesh.C:104:59: error: ‘iter’ was not declared in this scope
  104 |     forAllConstIter(dictionary, dynamicMeshCoeffs_, iter)

For now if dynamicMesh is not needed, CUDA 11.5 can be used if the compilation of the dynamic mesh library is disabled by commenting out `src/Allwmake' as follows:

# wmake $makeType dynamicFvMesh

It is also possible to compile the dynamicMesh library by just commenting out the for loop starting at line 104 in multiSolidBodyMotionFvMesh.C, as per the attached. Of course, the feature commented out will not work, but if not needed for your application, RapidCFD will compile.

multiSolidBodyMotionFvMesh.txt

My apologies for not proposing code fixes, but I thought I would at least report my findings in case anyone else tries to compile RapidCFD with CUDA >= 11.2.

Best regards,

Eric

sleeperss commented 6 months ago

simple fix for dynamicMesh :

git diff src/dynamicFvMesh/solidBodyMotionFvMesh/multiSolidBodyMotionFvMesh.C
diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/multiSolidBodyMotionFvMesh.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/multiSolidBodyMotionFvMesh.C
index 83026d6..6092b0e
--- a/src/dynamicFvMesh/solidBodyMotionFvMesh/multiSolidBodyMotionFvMesh.C
+++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/multiSolidBodyMotionFvMesh.C
@@ -101,7 +101,8 @@ Foam::multiSolidBodyMotionFvMesh::multiSolidBodyMotionFvMesh(const IOobject& io)
     gpuPointIDs_.setSize(pointIDs_.size());
     label zoneI = 0;

-    forAllConstIter(dictionary, dynamicMeshCoeffs_, iter)
+    using IteratorType = UILList<DLListBase, entry>;
+    forAllConstIter(IteratorType, dynamicMeshCoeffs_, iter)
     {
         if (iter().isDict())
         {

Moreover I also have had to add this change to whos preconised by @TonkomoLLC :

diff --git a/src/OpenFOAM/fields/Fields/vectorField/vectorField.C b/src/OpenFOAM/fields/Fields/vectorField/vectorField.C
index 08337fa..44862d5 100644
--- a/src/OpenFOAM/fields/Fields/vectorField/vectorField.C
+++ b/src/OpenFOAM/fields/Fields/vectorField/vectorField.C
@@ -13,6 +13,8 @@ template class gpuList<vector>;
 template class gpuField<vector>;

 template Ostream& operator<< <vector>(Ostream&, const gpuList<vector>&);
+template Ostream& operator<< <int>(Ostream&, const gpuList<int>&);
+template Ostream& operator<< <double>(Ostream&, const gpuList<double>&);
 template Istream& operator>> <vector>(Istream&, gpuList<vector>&);

 template<>