Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cray clang compiler errors #2392

Merged
merged 3 commits into from
Sep 24, 2024

Conversation

psychocoderHPC
Copy link
Member

@psychocoderHPC psychocoderHPC commented Sep 23, 2024

  • fix cray clang compile issue
    include/alpaka/acc/TagAccIsEnabled.hpp:34:66: error: template template argument has different template parameters than its corresponding template template parameter
     34 |     using EnabledAccTags = alpaka::meta::Filter<AccTags, alpaka::AccIsEnabled>;
        |    
    
  • fix cray clang OpenMP linker issues, missing flag -fopenmp
  • remove clang workaround we applied in implement AccIsEnabled #2267

```
include/alpaka/acc/TagAccIsEnabled.hpp:34:66: error: template template argument has different template parameters than its corresponding template template parameter
   34 |     using EnabledAccTags = alpaka::meta::Filter<AccTags, alpaka::AccIsEnabled>;
      |                                                                  ^
```
cmake/alpakaCommon.cmake Outdated Show resolved Hide resolved
@SimeonEhrig
Copy link
Member

SimeonEhrig commented Sep 23, 2024

Adding the Cray Compiler Compiler ID here in the CMake should solve the problem:

alpaka_set_compiler_options(HOST_DEVICE target alpaka "$<$<AND:$<CXX_COMPILER_ID:Clang,AppleClang,IntelLLVM>>:SHELL:-frelaxed-template-template-args>")

I removed this line from my CMake, the Filter.hpp does not compile.

$ cmake --build -j -t kernelSpecialization
Building CXX object example/kernelSpecialization/CMakeFiles/kernelSpecialization.dir/src/kernelSpecialization.cpp.o
In file included from /home/simeon/projects/alpaka/example/kernelSpecialization/src/kernelSpecialization.cpp:5:
In file included from /home/simeon/projects/alpaka/include/alpaka/alpaka.hpp:26:
/home/simeon/projects/alpaka/include/alpaka/acc/TagAccIsEnabled.hpp:34:66: error: template template argument has different template parameters than its corresponding template template parameter
   34 |     using EnabledAccTags = alpaka::meta::Filter<AccTags, alpaka::AccIsEnabled>;
      |                                                                  ^
/home/simeon/projects/alpaka/include/alpaka/acc/TagAccIsEnabled.hpp:23:5: note: too many template parameters in template template argument
   23 |     template<typename TTag, typename = void>
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/simeon/projects/alpaka/include/alpaka/meta/Filter.hpp:42:30: note: previous template template parameter is here
   42 |     template<typename TList, template<typename> class TPred>
      |                              ^~~~~~~~~~~~~~~~~~
In file included from /home/simeon/projects/alpaka/example/kernelSpecialization/src/kernelSpecialization.cpp:6:
/home/simeon/projects/alpaka/include/alpaka/example/ExecuteForEachAccTag.hpp:25:97: error: no member named 'EnabledAccTags' in namespace 'alpaka'
   25 |         return std::apply([=](auto const&... tags) { return (callable(tags) || ...); }, alpaka::EnabledAccTags{});
      |                                                                                         ~~~~~~~~^
/home/simeon/projects/alpaka/example/kernelSpecialization/src/kernelSpecialization.cpp:109:12: error: cannot initialize return object of type 'int' with an rvalue of type 'void'
  109 |     return alpaka::executeForEachAccTag([=](auto const& tag) { return example(tag); });
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.
gmake[3]: *** [example/kernelSpecialization/CMakeFiles/kernelSpecialization.dir/build.make:76: example/kernelSpecialization/CMakeFiles/kernelSpecialization.dir/src/kernelSpecialization.cpp.o] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:2248: example/kernelSpecialization/CMakeFiles/kernelSpecialization.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:2255: example/kernelSpecialization/CMakeFiles/kernelSpecialization.dir/rule] Error 2
gmake: *** [Makefile:673: kernelSpecialization] Error 2

If I apply your changes, it compiles.

CMake is not setting the linker flag `-fopenmp`  for the cray clang
compiler.
@psychocoderHPC
Copy link
Member Author

@SimeonEhrig I removed the cmake workaround.
The advantage is that stand alone header does not need additional flags and CMS does not need to handle this case in there build suite too.

@fwyzard
Copy link
Contributor

fwyzard commented Sep 23, 2024

I have no idea what these changes are about :-p

@SimeonEhrig
Copy link
Member

I have no idea what these changes are about :-p

Up to Clang 19, the compiler does not support relaxed template template args by default, which is a C++17 feature: https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#150
Therefore all Clang based compilers needs to set the compiler flag -frelaxed-template-template-arg to enable the feature. I forgot to add the Cray Clang compiler ID to the CMake. Therefore the compiler cannot compile the code.

René's code change simply avoids to use the feature. Therefore the flag does not need to be set anymore.

@fwyzard
Copy link
Contributor

fwyzard commented Sep 23, 2024

Thanks for the explanation. I let you approve the PR :-)

@SimeonEhrig SimeonEhrig merged commit 4301981 into alpaka-group:develop Sep 24, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants