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

Add option to use locally installed Unified Runtime #21

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions source/framework/ur/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ if (NOT BUILD_UR)
return()
endif()

if(BENCHMARK_UR_SOURCE_DIR)
add_subdirectory(
${BENCHMARK_UR_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/unified-runtime)
find_package(unified-runtime)

if(${unified-runtime_FOUND} AND NOT BENCHMARK_UR_OVERRIDE_FETCH_CONTENT_REPO AND NOT BENCHMARK_UR_OVERRIDE_FETCH_CONTENT_TAG)

message(STATUS "Unified Runtime installation found")

add_library(ur_loader ALIAS unified-runtime::ur_loader)
add_library(ur_headers ALIAS unified-runtime::ur_headers)

else()

include(FetchContent)

set(UMF_DISABLE_HWLOC ON CACHE INTERNAL "")
Expand All @@ -22,31 +28,29 @@ else()
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
set(UNIFIED_RUNTIME_TAG main)

message(STATUS
"Will fetch Unified Runtime from ${UNIFIED_RUNTIME_REPO} at ${UNIFIED_RUNTIME_TAG}")

if(BENCHMARK_UR_OVERRIDE_FETCH_CONTENT_REPO)
set(UNIFIED_RUNTIME_REPO "${BENCHMARK_UR_OVERRIDE_FETCH_CONTENT_REPO}")
endif()
if(BENCHMARK_UR_OVERRIDE_FETCH_CONTENT_TAG)
set(UNIFIED_RUNTIME_TAG "${BENCHMARK_UR_OVERRIDE_FETCH_CONTENT_TAG}")
endif()

message(STATUS "Will fetch Unified Runtime from ${UNIFIED_RUNTIME_REPO}")
message(STATUS
"Will fetch Unified Runtime from ${UNIFIED_RUNTIME_REPO} at ${UNIFIED_RUNTIME_TAG}")

FetchContent_Declare(unified-runtime
GIT_REPOSITORY ${UNIFIED_RUNTIME_REPO}
GIT_TAG ${UNIFIED_RUNTIME_TAG}
)

FetchContent_GetProperties(unified-runtime)
FetchContent_MakeAvailable(unified-runtime)

endif()

# Define target
set(API_NAME ur)

set(TARGET_NAME compute_benchmarks_framework_${API_NAME})

add_library(${TARGET_NAME} STATIC ur.cpp ur.h error.h)
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(${TARGET_NAME} PUBLIC compute_benchmarks_framework ur_loader ur_headers)
Expand Down