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
- This topic has 6 replies, 2 voices, and was last updated 2 years, 1 month ago by Adrian.
-
AuthorPosts
-
November 4, 2022 at 12:52 pm #6949PulauwinParticipant
g++ -O3 -Wall -march=native -mtune=native -std=c++17 –generate-code=arch=compute_86,code=[compute_86,sm_86] –extended-lambda –expt-relaxed-constexpr -x cu -Xcudafe “–diag_suppress=implicit_return_from_non_void_function –display_error_number –diag_suppress=20014 –diag_suppress=20011” -DPLATFORM_GPU_CUDA -I../../../src -I../../../external/zlib -I../../../external/tinyxml -c -o cavity2d.o cavity2d.cpp
g++: error: unrecognized command line option ‘–generate-code=arch=compute_86,code=[compute_86,sm_86]’
g++: error: unrecognized command line option ‘–extended-lambda’
g++: error: unrecognized command line option ‘–expt-relaxed-constexpr’
g++: error: unrecognized command line option ‘-Xcudafe’
g++: error: unrecognized command line option ‘–diag_suppress=implicit_return_from_non_void_function –display_error_number –diag_suppress=20014 –diag_suppress=20011’How to resolve this problem?
November 4, 2022 at 12:55 pm #6950AdrianKeymasterYou need to select
nvcc
as the compiler inconfig.mk
.Compare e.g. the example config
config/gpu_only.mk
included in the release.I hope this helps!
November 4, 2022 at 2:58 pm #6951PulauwinParticipantdfsdfs
November 4, 2022 at 3:05 pm #6952PulauwinParticipantstill has error, it seems my version is too low?
I sue cuda11.8 and gcc7.5.src/utilities/benchmarkUtil.h(342): error: namespace “std” has no member “for_each_n”
November 4, 2022 at 3:11 pm #6953AdrianKeymasterNo, 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 (alsostd::for_each_n
is not actually needed here).November 4, 2022 at 3:39 pm #6954PulauwinParticipantThanks a lot. it works now.
Can i compile the OpenLB into a shared lib so i can link it in my program.November 4, 2022 at 3:41 pm #6955AdrianKeymasterGood to hear!
Yes, this is possible (to some degree, depending on how you want to use the library) and will be included as a build option in the next release (enabling e.g. mixing compilers and speeding up the CUDA-enabled compilation).
-
AuthorPosts
- You must be logged in to reply to this topic.