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

cmake build error: unknown type name 'hipEvent_t'; #959

Closed
holyprince opened this issue Mar 12, 2019 · 4 comments

Comments

Projects
None yet
2 participants
@holyprince
Copy link

commented Mar 12, 2019

I use cmake to build a complex GPU program ported from cuda.
I have used the guide to find hip https://github.com/ROCm-Developer-Tools/HIP/tree/master/samples/2_Cookbook/12_cmake_hip_add_executable#including-findhip-cmake-module-in-the-project
But it prints the error and to make it more detailed, I print the make process:

[ 0%] Building HIPCC object src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o
..........................................................................................
/opt/rocm/hip/bin/hipcc -c /home/holy/autom-2/src/acc/hip/hip_projector_plan.hip.cpp -o /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir/
/acc/hip/./autom_gpu_util_generated_hip_projector_plan.hip.cpp.o -I/work/soft/mpi/openmpi/3.1.0_hygon/gcc-7.2/include -I/home/holy/autom-2 -I/home/holy/autom-2/external/fftw/include -I/opt/rocm/include -I/opt/rocm/rocrand/include -I/opt/rocm/hiprand/include
In file included from /home/holy/autom-2/src/acc/hip/hip_projector_plan.hip.cpp:1:
In file included from /home/holy/autom-2/src/acc/acc_projector_plan.h:9:
/home/holy/autom-2/src/acc/hip/custom_allocator.hpp:55:3: error: unknown type name 'hipEvent_t'; did you mean 'sigevent_t'?
hipEvent_t readyEvent;
^~~~~~~~~~
sigevent_t
/usr/include/bits/siginfo.h:321:5: note: 'sigevent_t' declared here
} sigevent_t;

And I have checked that the file has included the header file "hip/hip_runtime.h"

So what may the problem be?

@mangupta

This comment has been minimized.

Copy link
Collaborator

commented Mar 13, 2019

Could you try turning on cmake verbose mode using make VERBOSE=1 <your_target>? Additionally you can also turn on hipcc verbose mode using export HIPCC_VERBOSE=7. Please share the build log after turning on these 2 verbose modes.

@holyprince

This comment has been minimized.

Copy link
Author

commented Mar 13, 2019

ok, I have turned the two verbose modes and the output is :

[ 0%] Building HIPCC object src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o
cd /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir/
/acc/hip && /work/soft/compiler/cmake-3.13.0/bin/cmake -E make_directory /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/.
cd /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir/
/acc/hip && /work/soft/compiler/cmake-3.13.0/bin/cmake -D verbose:BOOL=1 -D build_configuration:STRING=Release -D generated_file:STRING=/home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/./autom_gpu_util_generated_hip_projector_plan.hip.cpp.o -P /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.cmake
-- Removing /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/./autom_gpu_util_generated_hip_projector_plan.hip.cpp.o
/work/soft/compiler/cmake-3.13.0/bin/cmake -E remove /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir/
/acc/hip/./autom_gpu_util_generated_hip_projector_plan.hip.cpp.o
-- Generating dependency file: /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend.pre
/opt/rocm/hip/bin/hipcc -M /home/holy/autom-2/src/acc/hip/hip_projector_plan.hip.cpp -o /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir/
/acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend.pre -I/work/soft/mpi/openmpi/3.1.0_hygon/gcc-7.2/include -I/home/holy/autom-2 -I/home/holy/autom-2/external/fftw/include -I/opt/rocm/include -I/opt/rocm/rocrand/include -I/opt/rocm/hiprand/include
HIP_PATH=/opt/rocm/hip
HIP_PLATFORM=hcc
HSA_PATH=/opt/rocm/hsa
HCC_HOME=/opt/rocm/hcc
hipcc-args: -M /home/holy/autom-2/src/acc/hip/hip_projector_plan.hip.cpp -o /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend.pre -I/work/soft/mpi/openmpi/3.1.0_hygon/gcc-7.2/include -I/home/holy/autom-2 -I/home/holy/autom-2/external/fftw/include -I/opt/rocm/include -I/opt/rocm/rocrand/include -I/opt/rocm/hiprand/include
hipcc-cmd: /opt/rocm/hcc/bin/hcc -hc -D__HIPCC
-I/opt/rocm/hcc/include -I/opt/rocm/hip/include/hip/hcc_detail/cuda -I/opt/rocm/hsa/include -Wno-deprecated-register -I/opt/rocm/profiler/CXLActivityLogger/include -I/opt/rocm/hip/include -DHIP_VERSION_MAJOR=1 -DHIP_VERSION_MINOR=5 -DHIP_VERSION_PATCH=18353 -D__HIP_ARCH_GFX906__=1 -M /home/holy/autom-2/src/acc/hip/hip_projector_plan.hip.cpp -o /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend.pre -I/work/soft/mpi/openmpi/3.1.0_hygon/gcc-7.2/include -I/home/holy/autom-2 -I/home/holy/autom-2/external/fftw/include -I/opt/rocm/include -I/opt/rocm/rocrand/include -I/opt/rocm/hiprand/include
-- Generating temporary cmake readable file: /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir/
/acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend.tmp
/work/soft/compiler/cmake-3.13.0/bin/cmake -D input_file:FILEPATH=/home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend.pre -D output_file:FILEPATH=/home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend.tmp -D verbose=1 -P /opt/rocm/hip/cmake/FindHIP/run_make2cmake.cmake
-- Copy if different /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend.tmp to /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend
/work/soft/compiler/cmake-3.13.0/bin/cmake -E copy_if_different /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend.tmp /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend
-- Removing /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend.tmp and /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend.pre
/work/soft/compiler/cmake-3.13.0/bin/cmake -E remove /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend.tmp /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/autom_gpu_util_generated_hip_projector_plan.hip.cpp.o.depend.pre
-- Generating /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/./autom_gpu_util_generated_hip_projector_plan.hip.cpp.o
/opt/rocm/hip/bin/hipcc -c /home/holy/autom-2/src/acc/hip/hip_projector_plan.hip.cpp -o /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir/
/acc/hip/./autom_gpu_util_generated_hip_projector_plan.hip.cpp.o -I/work/soft/mpi/openmpi/3.1.0_hygon/gcc-7.2/include -I/home/holy/autom-2 -I/home/holy/autom-2/external/fftw/include -I/opt/rocm/include -I/opt/rocm/rocrand/include -I/opt/rocm/hiprand/include
HIP_PATH=/opt/rocm/hip
HIP_PLATFORM=hcc
HSA_PATH=/opt/rocm/hsa
HCC_HOME=/opt/rocm/hcc
hipcc-args: -c /home/holy/autom-2/src/acc/hip/hip_projector_plan.hip.cpp -o /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir//acc/hip/./autom_gpu_util_generated_hip_projector_plan.hip.cpp.o -I/work/soft/mpi/openmpi/3.1.0_hygon/gcc-7.2/include -I/home/holy/autom-2 -I/home/holy/autom-2/external/fftw/include -I/opt/rocm/include -I/opt/rocm/rocrand/include -I/opt/rocm/hiprand/include
hipcc-cmd: /opt/rocm/hcc/bin/hcc -hc -D__HIPCC
-I/opt/rocm/hcc/include -I/opt/rocm/hip/include/hip/hcc_detail/cuda -I/opt/rocm/hsa/include -Wno-deprecated-register -I/opt/rocm/profiler/CXLActivityLogger/include -I/opt/rocm/hip/include -DHIP_VERSION_MAJOR=1 -DHIP_VERSION_MINOR=5 -DHIP_VERSION_PATCH=18353 -D__HIP_ARCH_GFX906__=1 -c /home/holy/autom-2/src/acc/hip/hip_projector_plan.hip.cpp -o /home/holy/autom-2/build2/src/apps/CMakeFiles/autom_gpu_util.dir/__/acc/hip/./autom_gpu_util_generated_hip_projector_plan.hip.cpp.o -I/work/soft/mpi/openmpi/3.1.0_hygon/gcc-7.2/include -I/home/holy/autom-2 -I/home/holy/autom-2/external/fftw/include -I/opt/rocm/include -I/opt/rocm/rocrand/include -I/opt/rocm/hiprand/include
In file included from /home/holy/autom-2/src/acc/hip/hip_projector_plan.hip.cpp:1:
In file included from /home/holy/autom-2/src/acc/acc_projector_plan.h:9:
/home/holy/autom-2/src/acc/hip/custom_allocator.hpp:55:3: error: unknown type name 'hipEvent_t'; did you mean 'sigevent_t'?
hipEvent_t readyEvent;
^~~~~~~~~~
sigevent_t
/usr/include/bits/siginfo.h:321:5: note: 'sigevent_t' declared here
} sigevent_t;

@mangupta

This comment has been minimized.

Copy link
Collaborator

commented Mar 13, 2019

I am guessing that the GPU application in question is https://github.com/3dem/relion. Looking at https://github.com/3dem/relion/blob/master/src/acc/cuda/custom_allocator.cuh, it seems to require CUDA to be defined for it to work correctly. This seems to be enabled in https://github.com/3dem/relion/blob/master/CMakeLists.txt#L147. However I don't see -DCUDA or anything similar being passed to hipcc in the logs you shared. Please recheck your build scripts. Alternatively see if you can share your HIPified code for us to look at it.

@holyprince

This comment has been minimized.

Copy link
Author

commented Mar 13, 2019

Thank you very much. Your guess is right and I try to port the relion application to rocm. After getting your wise advice, I find I miss the -DHIP in the build logs. But I have written the flag is true in the CMakeLists.txt like this:

if(HIP) add_definitions(-DHIP) endif()
I also add the flag in the subdirectories cmake file :

if (HIP_FOUND)

add_definitions(-DHIP)
set(HIP_INCLUDE_PATH /opt/rocm/include)
include_directories("${HIP_INCLUDE_PATH}")
include_directories("/opt/rocm/rocrand/include")
include_directories("/opt/rocm/hiprand/include")

find_package(rocprim REQUIRED CONFIG PATHS "/opt/rocm/rocprim")
find_package(hipcub REQUIRED CONFIG PATHS "/opt/rocm/rocPRIM/hipcub")

file(GLOB REL_HIP_SRC "${CMAKE_SOURCE_DIR}/src/acc/hip/*.hip.cpp" "${CMAKE_SOURCE_DIR}/src/acc/hip/hip_kernels/*.hip.cpp" )
set_source_files_properties(${REL_HIP_SRC} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
hip_add_library(relion_gpu_util ${REL_HIP_SRC})

But it doesn't work and the error is the same.
Even though I use cmake .. -DHIP=ON also has no effect.

It is very strange, and the whole HIPified code is provided :
https://github.com/holyprince/relionrocm

Thank you very much!

@holyprince holyprince closed this Jun 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.