这里有打印HIP信息吗?export HIP_PATH=/opt/dtk/hip试试呢
cmake_minimum_required(VERSION 3.10)
if(NOT DEFINED HIP_PATH)
if(NOT DEFINED ENV{HIP_PATH})
set(HIP_PATH "/opt/rocm/hip" CACHE PATH "Path to which HIP has been installed")
else()
set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to which HIP has been installed")
endif()
endif()
# 设置 CMake 模块路径
set(CMAKE_MODULE_PATH "${HIP_PATH}/cmake" ${CMAKE_MODULE_PATH})
project(HipVectorAdd LANGUAGES HIP CXX)
# set(CMAKE_MODULE_PATH "/opt/dtk-23.10.1/hip/cmake" ${CMAKE_MODULE_PATH})
# Enable HIP support
find_package(HIP REQUIRED)
if(HIP_FOUND)
message(STATUS "Found HIP: " ${HIP_VERSION})
else()
message(FATAL_ERROR "Could not find HIP. Ensure that HIP is either installed in /opt/rocm/hip or the variable HIP_PATH is set to point to the right location.")
endif()
# Specify HIP flags
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_HIP_ARCHITECTURES "gfx1032;gfx1035") # 根据目标GPU架构设置
# Add executable
add_executable(hip_vector_add ./src/main.cpp ./src/hip_functions.hip)
# Link HIP library
target_link_libraries(hip_vector_add PRIVATE hip::device)
target_compile_features(hip_vector_add PRIVATE cxx_std_11)
CMake Error at CMakeLists.txt:32 (add_executable):
Target "hip_vector_add" links to target "hip::device" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
上述构建过程报错,请帮忙看看写的哪里有问题吗

暂无数据