ginkgo-project / ginkgo

Numerical linear algebra software package
https://ginkgo-project.github.io/
BSD 3-Clause "New" or "Revised" License
401 stars 88 forks source link

Build failure with ROCm 6.0 #1566

Closed lahwaacz closed 5 months ago

lahwaacz commented 6 months ago

I tried building ginkgo 1.7.0 with ROCm/HIP 6.0 but got these errors:

FAILED: benchmark/CMakeFiles/hipsparse_linops_d.dir/utils/hip_linops.hip.cpp.o
/usr/bin/c++ -DGKO_BENCHMARK_USE_DOUBLE_PRECISION -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CPP -DUSE_PROF_API=1 -D__HIP_PLATFORM_AMD__=1 -Dhipsparse_linops_d_EXPORTS -I/build/ginkgo-hpc/src/build-hip/include -I/build/ginkgo-hpc/src/ginkgo-1.7.0/include -I/build/ginkgo-hpc/src/ginkgo-1.7.0 -isystem /opt/rocm/include -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/ginkgo-hpc/src=/usr/src/debug/ginkgo-hpc -flto=auto -fPIC  -D__HIP_PLATFORM_HCC__= -D__HIP_PLATFORM_AMD__= -I/opt/rocm/include -I/opt/rocm/lib/llvm/lib/clang/17.0.0 -MD -MT benchmark/CMakeFiles/hipsparse_linops_d.dir/utils/hip_linops.hip.cpp.o -MF benchmark/CMakeFiles/hipsparse_linops_d.dir/utils/hip_linops.hip.cpp.o.d -o benchmark/CMakeFiles/hipsparse_linops_d.dir/utils/hip_linops.hip.cpp.o -c /build/ginkgo-hpc/src/ginkgo-1.7.0/benchmark/utils/hip_linops.hip.cpp
<command-line>: warning: "__HIP_PLATFORM_AMD__" redefined
<command-line>: note: this is the location of the previous definition
In file included from /opt/rocm/include/thrust/complex.h:30,
                 from /build/ginkgo-hpc/src/ginkgo-1.7.0/hip/base/types.hip.hpp:51,
                 from /build/ginkgo-hpc/src/ginkgo-1.7.0/hip/base/hipsparse_bindings.hip.hpp:49,
                 from /build/ginkgo-hpc/src/ginkgo-1.7.0/benchmark/utils/hip_linops.hip.cpp:41:
/opt/rocm/include/thrust/detail/type_traits.h:736:1: error: expected type-specifier before ‘template’
  736 | template <class F, class... Us>
      | ^~~~~~~~
[812/1379] Building CXX object benchmark/CMakeFiles/hipsparse_linops_s.dir/utils/hip_linops.hip.cpp.o
FAILED: benchmark/CMakeFiles/hipsparse_linops_s.dir/utils/hip_linops.hip.cpp.o
/usr/bin/c++ -DGKO_BENCHMARK_USE_SINGLE_PRECISION -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CPP -DUSE_PROF_API=1 -D__HIP_PLATFORM_AMD__=1 -Dhipsparse_linops_s_EXPORTS -I/build/ginkgo-hpc/src/build-hip/include -I/build/ginkgo-hpc/src/ginkgo-1.7.0/include -I/build/ginkgo-hpc/src/ginkgo-1.7.0 -isystem /opt/rocm/include -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/ginkgo-hpc/src=/usr/src/debug/ginkgo-hpc -flto=auto -fPIC  -D__HIP_PLATFORM_HCC__= -D__HIP_PLATFORM_AMD__= -I/opt/rocm/include -I/opt/rocm/lib/llvm/lib/clang/17.0.0 -MD -MT benchmark/CMakeFiles/hipsparse_linops_s.dir/utils/hip_linops.hip.cpp.o -MF benchmark/CMakeFiles/hipsparse_linops_s.dir/utils/hip_linops.hip.cpp.o.d -o benchmark/CMakeFiles/hipsparse_linops_s.dir/utils/hip_linops.hip.cpp.o -c /build/ginkgo-hpc/src/ginkgo-1.7.0/benchmark/utils/hip_linops.hip.cpp
<command-line>: warning: "__HIP_PLATFORM_AMD__" redefined
<command-line>: note: this is the location of the previous definition
In file included from /opt/rocm/include/thrust/complex.h:30,
                 from /build/ginkgo-hpc/src/ginkgo-1.7.0/hip/base/types.hip.hpp:51,
                 from /build/ginkgo-hpc/src/ginkgo-1.7.0/hip/base/hipsparse_bindings.hip.hpp:49,
                 from /build/ginkgo-hpc/src/ginkgo-1.7.0/benchmark/utils/hip_linops.hip.cpp:41:
/opt/rocm/include/thrust/detail/type_traits.h:736:1: error: expected type-specifier before ‘template’
  736 | template <class F, class... Us>
      | ^~~~~~~~
FAILED: benchmark/CMakeFiles/hipsparse_linops_z.dir/utils/hip_linops.hip.cpp.o
/usr/bin/c++ -DGKO_BENCHMARK_USE_DOUBLE_COMPLEX_PRECISION -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CPP -DUSE_PROF_API=1 -D__HIP_PLATFORM_AMD__=1 -Dhipsparse_linops_z_EXPORTS -I/build/ginkgo-hpc/src/build-hip/include -I/build/ginkgo-hpc/src/ginkgo-1.7.0/include -I/build/ginkgo-hpc/src/ginkgo-1.7.0 -isystem /opt/rocm/include -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/ginkgo-hpc/src=/usr/src/debug/ginkgo-hpc -flto=auto -fPIC  -D__HIP_PLATFORM_HCC__= -D__HIP_PLATFORM_AMD__= -I/opt/rocm/include -I/opt/rocm/lib/llvm/lib/clang/17.0.0 -MD -MT benchmark/CMakeFiles/hipsparse_linops_z.dir/utils/hip_linops.hip.cpp.o -MF benchmark/CMakeFiles/hipsparse_linops_z.dir/utils/hip_linops.hip.cpp.o.d -o benchmark/CMakeFiles/hipsparse_linops_z.dir/utils/hip_linops.hip.cpp.o -c /build/ginkgo-hpc/src/ginkgo-1.7.0/benchmark/utils/hip_linops.hip.cpp
<command-line>: warning: "__HIP_PLATFORM_AMD__" redefined
<command-line>: note: this is the location of the previous definition
In file included from /opt/rocm/include/thrust/complex.h:30,
                 from /build/ginkgo-hpc/src/ginkgo-1.7.0/hip/base/types.hip.hpp:51,
                 from /build/ginkgo-hpc/src/ginkgo-1.7.0/hip/base/hipsparse_bindings.hip.hpp:49,
                 from /build/ginkgo-hpc/src/ginkgo-1.7.0/benchmark/utils/hip_linops.hip.cpp:41:
/opt/rocm/include/thrust/detail/type_traits.h:736:1: error: expected type-specifier before ‘template’
  736 | template <class F, class... Us>
      | ^~~~~~~~
[816/1379] Building CXX object benchmark/CMakeFiles/hipsparse_linops_c.dir/utils/hip_linops.hip.cpp.o
FAILED: benchmark/CMakeFiles/hipsparse_linops_c.dir/utils/hip_linops.hip.cpp.o
/usr/bin/c++ -DGKO_BENCHMARK_USE_SINGLE_COMPLEX_PRECISION -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CPP -DUSE_PROF_API=1 -D__HIP_PLATFORM_AMD__=1 -Dhipsparse_linops_c_EXPORTS -I/build/ginkgo-hpc/src/build-hip/include -I/build/ginkgo-hpc/src/ginkgo-1.7.0/include -I/build/ginkgo-hpc/src/ginkgo-1.7.0 -isystem /opt/rocm/include -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/ginkgo-hpc/src=/usr/src/debug/ginkgo-hpc -flto=auto -fPIC  -D__HIP_PLATFORM_HCC__= -D__HIP_PLATFORM_AMD__= -I/opt/rocm/include -I/opt/rocm/lib/llvm/lib/clang/17.0.0 -MD -MT benchmark/CMakeFiles/hipsparse_linops_c.dir/utils/hip_linops.hip.cpp.o -MF benchmark/CMakeFiles/hipsparse_linops_c.dir/utils/hip_linops.hip.cpp.o.d -o benchmark/CMakeFiles/hipsparse_linops_c.dir/utils/hip_linops.hip.cpp.o -c /build/ginkgo-hpc/src/ginkgo-1.7.0/benchmark/utils/hip_linops.hip.cpp
<command-line>: warning: "__HIP_PLATFORM_AMD__" redefined
<command-line>: note: this is the location of the previous definition
In file included from /opt/rocm/include/thrust/complex.h:30,
                 from /build/ginkgo-hpc/src/ginkgo-1.7.0/hip/base/types.hip.hpp:51,
                 from /build/ginkgo-hpc/src/ginkgo-1.7.0/hip/base/hipsparse_bindings.hip.hpp:49,
                 from /build/ginkgo-hpc/src/ginkgo-1.7.0/benchmark/utils/hip_linops.hip.cpp:41:
/opt/rocm/include/thrust/detail/type_traits.h:736:1: error: expected type-specifier before ‘template’
  736 | template <class F, class... Us>
      | ^~~~~~~~

Do you have some idea how to fix this? Also the warnings regarding __HIP_PLATFORM_AMD__ redefinition are not nice.

upsj commented 6 months ago

I didn't encounter these issues when building Ginkgo in 6.0 on #1334, so hopefully they will be fixed as a side-effect of that PR.

upsj commented 5 months ago

@lahwaacz can you check whether these issues are still present after #1334 was merged?

lahwaacz commented 5 months ago

@upsj Indeed, this issue is gone after #1334 :tada: