Skip to content

Reply To: compile liddriven 2D with GPU error message

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics compile liddriven 2D with GPU error message Reply To: compile liddriven 2D with GPU error message

#6953
Adrian
Keymaster

No, the latest CUDA version 11.8 works in my tests.

The issue here is that the selected C++ standard library headers don’t include the std::for_each_n despite C++17 being requested of the compiler.

You can apply the following change to get it to compile:


diff --git a/src/utilities/benchmarkUtil.h b/src/utilities/benchmarkUtil.h
index 0156bd1ce5..5806c19fa5 100644
--- a/src/utilities/benchmarkUtil.h
+++ b/src/utilities/benchmarkUtil.h
@@ -339,9 +339,9 @@ public:
   }
 
   void reset(T lowerBound, T upperBound, T dt) {
-    std::for_each_n(integrators.begin(),numComponents,[&](auto& integrator){
+    for (auto& integrator : integrators) {
       integrator->reset(lowerBound,upperBound,dt);
-    });
+    }
   }
 
   std::array<T,numComponents> getResult()

As this sadly seems to be a common issue also on our clusters this replacement of std::for_each_n usage will be included in the next release (also std::for_each_n is not actually needed here).