ROCm/rocThrust

Can't use utility.h in thrust/type_traits/integer_sequence.h

AmbroseWong opened this issue · 2 comments

Hi everyone,

I am new to Rocm and just installed rocThrust. When I tried to compiled my hip cpp code using hipcc (rocm 5.4.0). I got

rocThrust/include/thrust/type_traits/integer_sequence.h:61:31: error: no template named 'integer_sequence' in namespace 'std'.

This 'integer_sequence' should come from include utility.h. I used -std=c++14 tag but it persisted. When I turned to include utility.h in a test code and compiled it using g++. Things went well. But hipcc still cannot compile the test code with same errors. Is there anyone can tell me how fix this issue?

Thanks a lot!

Hi! Could you try running hipcc with -v? It will print the include paths hipcc can reach. Are you running a non-standard installation of ROCm?

#include <...> search starts here:
 /opt/rocm-5.4.0/llvm/lib/clang/15.0.0/include/..
 /opt/rocm-5.4.0/hsa/include
 /opt/rocm-5.4.0/include
 /opt/rocm-5.4.0/llvm/lib/clang/15.0.0/include/cuda_wrappers
 /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9
 /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9
 /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/backward
 /opt/rocm-5.4.0/llvm/lib/clang/15.0.0/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include

For me hipcc can access utility via /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9


I ran the following on the rocm-terminal:5.4-docker image:

// test.cpp

#include <thrust/type_traits/integer_sequence.h>

template<class T, T... Args>
constexpr T sum(thrust::integer_sequence<T, Args...> = {}) {
  return (Args + ...);
}

int main() {
  return sum(thrust::integer_sequence<int, 1, 2, 3, 4>{});
}
hipcc -std=c++17 -v -o test test.cpp
./test; echo $? # Should return 10

Closing it since it's stale. Let us know if you still have any problems.