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

Pin Legion to specific commit sha by default #593

Merged
merged 10 commits into from
Mar 6, 2023
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ endif()
# - Download and initialize RAPIDS CMake helpers -----------------------------

if(NOT EXISTS ${CMAKE_BINARY_DIR}/RAPIDS.cmake)
file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-22.08/RAPIDS.cmake
file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-23.02/RAPIDS.cmake
${CMAKE_BINARY_DIR}/RAPIDS.cmake)
endif()
include(${CMAKE_BINARY_DIR}/RAPIDS.cmake)
Expand All @@ -72,7 +72,7 @@ include(rapids-cuda)
include(rapids-export)
include(rapids-find)

set(legate_core_version 22.12.00)
set(legate_core_version 23.03.00)

# For now we want the optimization flags to match on both normal make and cmake
# builds so we override the cmake defaults here for release, this changes
Expand Down
69 changes: 54 additions & 15 deletions cmake/thirdparty/get_legion.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright 2022 NVIDIA Corporation
# Copyright 2022-2023 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,13 +14,31 @@
# limitations under the License.
#=============================================================================

include_guard(GLOBAL)

function(find_or_configure_legion)
set(oneValueArgs VERSION REPOSITORY BRANCH EXCLUDE_FROM_ALL)
cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

include("${rapids-cmake-dir}/export/detail/parse_version.cmake")
rapids_export_parse_version(${PKG_VERSION} Legion PKG_VERSION)

string(REGEX REPLACE "^0([0-9]+)?$" "\\1" Legion_major_version "${Legion_major_version}")
string(REGEX REPLACE "^0([0-9]+)?$" "\\1" Legion_minor_version "${Legion_minor_version}")
string(REGEX REPLACE "^0([0-9]+)?$" "\\1" Legion_patch_version "${Legion_patch_version}")

include("${rapids-cmake-dir}/cpm/detail/package_details.cmake")
rapids_cpm_package_details(Legion version git_repo git_branch shallow exclude_from_all)

set(version "${Legion_major_version}.${Legion_minor_version}.${Legion_patch_version}")
set(exclude_from_all ${PKG_EXCLUDE_FROM_ALL})
if(PKG_BRANCH)
set(git_branch "${PKG_BRANCH}")
endif()
if(PKG_REPOSITORY)
set(git_repo "${PKG_REPOSITORY}")
endif()

set(Legion_CUDA_ARCH "")
if(Legion_USE_CUDA)
set(Legion_CUDA_ARCH ${CMAKE_CUDA_ARCHITECTURES})
Expand All @@ -47,14 +65,15 @@ function(find_or_configure_legion)
if(Legion_DIR OR Legion_ROOT)
set(_find_mode REQUIRED)
endif()
rapids_find_package(Legion ${PKG_VERSION} EXACT CONFIG ${_find_mode} ${FIND_PKG_ARGS})
rapids_find_package(Legion ${version} EXACT CONFIG ${_find_mode} ${FIND_PKG_ARGS})
endif()

if(Legion_FOUND)
message(STATUS "CPM: using local package Legion@${PKG_VERSION}")
message(STATUS "CPM: using local package Legion@${version}")
else()

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/cpm_helpers.cmake)
get_cpm_git_args(legion_cpm_git_args REPOSITORY ${PKG_REPOSITORY} BRANCH ${PKG_BRANCH})
get_cpm_git_args(legion_cpm_git_args REPOSITORY ${git_repo} BRANCH ${git_branch})
if(NOT DEFINED Legion_PYTHON_EXTRA_INSTALL_ARGS)
set(Legion_PYTHON_EXTRA_INSTALL_ARGS "--single-version-externally-managed --root=/")
endif()
Expand Down Expand Up @@ -149,14 +168,19 @@ function(find_or_configure_legion)
set(Legion_CUDA_ARCH ${Legion_CUDA_ARCH} CACHE STRING
"Comma-separated list of CUDA architectures to build for (e.g. 60,70)" FORCE)

rapids_cpm_find(Legion ${PKG_VERSION} ${FIND_PKG_ARGS}
message(VERBOSE "legate.core: Legion version: ${version}")
message(VERBOSE "legate.core: Legion git_repo: ${git_repo}")
message(VERBOSE "legate.core: Legion git_branch: ${git_branch}")
message(VERBOSE "legate.core: Legion exclude_from_all: ${exclude_from_all}")

rapids_cpm_find(Legion ${version} ${FIND_PKG_ARGS}
CPM_ARGS
${legion_cpm_git_args}
FIND_PACKAGE_ARGUMENTS EXACT
EXCLUDE_FROM_ALL ${PKG_EXCLUDE_FROM_ALL}
EXCLUDE_FROM_ALL ${exclude_from_all}
OPTIONS ${_legion_cuda_options}
"CMAKE_CXX_STANDARD ${_cxx_std}"
"Legion_VERSION ${PKG_VERSION}"
"Legion_VERSION ${version}"
"Legion_BUILD_BINDINGS ON"
"Legion_BUILD_APPS OFF"
"Legion_BUILD_TESTS OFF"
Expand All @@ -165,6 +189,14 @@ function(find_or_configure_legion)
"Legion_REDOP_COMPLEX ON"
"Legion_GPU_REDUCTIONS OFF"
"Legion_BUILD_RUST_PROFILER ON"
"Legion_SPY ${Legion_SPY}"
"Legion_USE_LLVM ${Legion_USE_LLVM}"
"Legion_USE_HDF5 ${Legion_USE_HDF5}"
"Legion_USE_CUDA ${Legion_USE_CUDA}"
"Legion_NETWORKS ${Legion_NETWORKS}"
"Legion_USE_OpenMP ${Legion_USE_OpenMP}"
"Legion_USE_Python ${Legion_USE_Python}"
"Legion_BOUNDS_CHECKS ${Legion_BOUNDS_CHECKS}"
)
endif()

Expand All @@ -180,16 +212,23 @@ function(find_or_configure_legion)

endfunction()

if(NOT DEFINED legate_core_LEGION_BRANCH)
set(legate_core_LEGION_BRANCH control_replication)
endif()

if(NOT DEFINED legate_core_LEGION_REPOSITORY)
set(legate_core_LEGION_REPOSITORY https://gitlab.com/StanfordLegion/legion.git)
endif()
foreach(_var IN ITEMS "legate_core_LEGION_VERSION"
"legate_core_LEGION_BRANCH"
"legate_core_LEGION_REPOSITORY"
"legate_core_EXCLUDE_LEGION_FROM_ALL")
if(DEFINED ${_var})
# Create a legate_core_LEGION_BRANCH variable in the current scope either from the existing
# current-scope variable, or the cache variable.
set(${_var} "${${_var}}")
# Remove legate_core_LEGION_BRANCH from the CMakeCache.txt. This ensures reconfiguring the same
# build dir without passing `-Dlegate_core_LEGION_BRANCH=` reverts to the value in versions.json
# instead of reusing the previous `-Dlegate_core_LEGION_BRANCH=` value.
unset(${_var} CACHE)
endif()
endforeach()

if(NOT DEFINED legate_core_LEGION_VERSION)
set(legate_core_LEGION_VERSION "${legate_core_VERSION_MAJOR}.${legate_core_VERSION_MINOR}.0")
set(legate_core_LEGION_VERSION "${legate_core_VERSION}")
endif()

find_or_configure_legion(VERSION ${legate_core_LEGION_VERSION}
Expand Down
12 changes: 8 additions & 4 deletions cmake/versions.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"packages" : {
"Thrust" : {
"version" : "1.17.0.0",
"git_url" : "https://github.com/NVIDIA/thrust.git",
"git_tag" : "1.17.0"
"Thrust" : {
"version" : "1.17.0.0",
"git_url" : "https://github.com/NVIDIA/thrust.git",
"git_tag" : "1.17.0"
},
"Legion": {
"git_url" : "https://gitlab.com/StanfordLegion/legion.git",
"git_tag" : "e1f1ef61e29c3160419d0cd528950b2d565c2a0d"
}
}
}
6 changes: 3 additions & 3 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def validate_path(path):
if conduit:
cmake_flags += [f"-DGASNet_CONDUIT={conduit}"]
if cuda_dir:
cmake_flags += [f"-DCUDA_TOOLKIT_ROOT_DIR={cuda_dir}"]
cmake_flags += [f"-DCUDAToolkit_ROOT={cuda_dir}"]
if thrust_dir:
cmake_flags += [f"-DThrust_ROOT={thrust_dir}"]
if legion_dir:
Expand Down Expand Up @@ -738,14 +738,14 @@ def driver():
"--legion-url",
dest="legion_url",
required=False,
default="https://gitlab.com/StanfordLegion/legion.git",
default=None,
help="Legion git URL to build Legate with.",
)
parser.add_argument(
"--legion-branch",
dest="legion_branch",
required=False,
default="control_replication",
default=None,
help="Legion branch to build Legate with.",
)
args, unknown = parser.parse_known_args()
Expand Down