Skip to content

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

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #6949
    Pulauwin
    Participant

    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?

    #6950
    Adrian
    Keymaster

    You need to select nvcc as the compiler in config.mk.

    Compare e.g. the example config config/gpu_only.mk included in the release.

    I hope this helps!

    #6951
    Pulauwin
    Participant

    dfsdfs

    #6952
    Pulauwin
    Participant

    still 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”

    #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).

    #6954
    Pulauwin
    Participant

    Thanks a lot. it works now.
    Can i compile the OpenLB into a shared lib so i can link it in my program.

    #6955
    Adrian
    Keymaster

    Good 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).

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.