diff --git a/cmake/Modules/legate_core_options.cmake b/cmake/Modules/legate_core_options.cmake index 62fd1e759..c9b8bf299 100644 --- a/cmake/Modules/legate_core_options.cmake +++ b/cmake/Modules/legate_core_options.cmake @@ -49,7 +49,6 @@ option(Legion_USE_HDF5 "Enable support for HDF5" OFF) option(Legion_USE_CUDA "Enable Legion support for the CUDA runtime" OFF) option(Legion_NETWORKS "Networking backends to use (semicolon-separated)" "") option(Legion_USE_OpenMP "Use OpenMP" OFF) -option(Legion_USE_Python "Use Python" OFF) option(Legion_BOUNDS_CHECKS "Enable bounds checking in Legion accessors" OFF) if("${Legion_NETWORKS}" MATCHES ".*gasnet(1|ex).*") diff --git a/cmake/thirdparty/get_legion.cmake b/cmake/thirdparty/get_legion.cmake index 71ce33fb1..766590fb0 100644 --- a/cmake/thirdparty/get_legion.cmake +++ b/cmake/thirdparty/get_legion.cmake @@ -70,6 +70,14 @@ function(find_or_configure_legion) if(Legion_FOUND) message(STATUS "CPM: using local package Legion@${version}") + + # Check that required Legion options are set + if(NOT Legion_USE_Python) + message(FATAL_ERROR "Legion was not compiled with Legion_USE_Python") + endif() + + # TODO: The following should also be checked, but are not currently reported by Legion: + # Legion_BUILD_BINDINGS else() include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/cpm_helpers.cmake) @@ -179,6 +187,7 @@ function(find_or_configure_legion) FIND_PACKAGE_ARGUMENTS EXACT EXCLUDE_FROM_ALL ${exclude_from_all} OPTIONS ${_legion_cuda_options} + "BUILD_SHARED_LIBS ON" "CMAKE_CXX_STANDARD ${_cxx_std}" "Legion_VERSION ${version}" "Legion_BUILD_BINDINGS ON" @@ -195,19 +204,19 @@ function(find_or_configure_legion) "Legion_USE_CUDA ${Legion_USE_CUDA}" "Legion_NETWORKS ${Legion_NETWORKS}" "Legion_USE_OpenMP ${Legion_USE_OpenMP}" - "Legion_USE_Python ${Legion_USE_Python}" + "Legion_USE_Python ON" "Legion_BOUNDS_CHECKS ${Legion_BOUNDS_CHECKS}" + "Legion_BUILD_JUPYTER ON" + "Legion_EMBED_GASNet_CONFIGURE_ARGS --with-ibv-max-hcas=8" ) endif() set(Legion_USE_CUDA ${Legion_USE_CUDA} PARENT_SCOPE) set(Legion_USE_OpenMP ${Legion_USE_OpenMP} PARENT_SCOPE) - set(Legion_USE_Python ${Legion_USE_Python} PARENT_SCOPE) set(Legion_NETWORKS ${Legion_NETWORKS} PARENT_SCOPE) message(VERBOSE "Legion_USE_CUDA=${Legion_USE_CUDA}") message(VERBOSE "Legion_USE_OpenMP=${Legion_USE_OpenMP}") - message(VERBOSE "Legion_USE_Python=${Legion_USE_Python}") message(VERBOSE "Legion_NETWORKS=${Legion_NETWORKS}") endfunction() diff --git a/conda/conda-build/build.sh b/conda/conda-build/build.sh index 317947dc4..113d5607b 100644 --- a/conda/conda-build/build.sh +++ b/conda/conda-build/build.sh @@ -8,9 +8,7 @@ CMAKE_ARGS="$(echo "$CMAKE_ARGS" | sed -r "s@_INCLUDE=ONLY@_INCLUDE=BOTH@g")" CMAKE_ARGS+=" --log-level=VERBOSE -DBUILD_MARCH=haswell --DLegion_USE_OpenMP=ON --DLegion_USE_Python=ON --DLegion_BUILD_BINDINGS=ON" +-DLegion_USE_OpenMP=ON" # We rely on an environment variable to determine if we need to build cpu-only bits if [ -z "$CPU_ONLY" ]; then diff --git a/install.py b/install.py index 25bf4e799..e50b3228d 100755 --- a/install.py +++ b/install.py @@ -420,11 +420,13 @@ def validate_path(path): if debug or verbose: cmake_flags += [f"--log-level={'DEBUG' if debug else 'VERBOSE'}"] + # NOTE: Any unconditional Legion configuration settings should be added to + # cmake/thirdparty/get_legion.cmake, so that pure-cmake builds will also + # pick them up. cmake_flags += f"""\ -DCMAKE_BUILD_TYPE={( "Debug" if debug else "RelWithDebInfo" if debug_release else "Release" )} --DBUILD_SHARED_LIBS=ON -DBUILD_MARCH={march} -DCMAKE_CUDA_ARCHITECTURES={arch} -DLegion_MAX_DIM={str(maxdim)} @@ -436,13 +438,7 @@ def validate_path(path): -DLegion_USE_LLVM={("ON" if llvm else "OFF")} -DLegion_NETWORKS={";".join(networks)} -DLegion_USE_HDF5={("ON" if hdf else "OFF")} --DLegion_USE_Python=ON -DLegion_Python_Version={pyversion} --DLegion_REDOP_COMPLEX=ON --DLegion_REDOP_HALF=ON --DLegion_BUILD_BINDINGS=ON --DLegion_BUILD_JUPYTER=ON --DLegion_EMBED_GASNet_CONFIGURE_ARGS="--with-ibv-max-hcas=8" """.splitlines() if nccl_dir: @@ -747,14 +743,18 @@ def driver(): dest="legion_dir", required=False, default=None, - help="Path to an existing Legion build directory.", + help="Path to an existing Legion build directory. A recent checkout " + "of the control_replication branch is required, configured with " + "Legion_BUILD_BINDINGS=ON, Legion_REDOP_HALF=ON, " + "Legion_REDOP_COMPLEX=ON, Legion_USE_Python=ON.", ) parser.add_argument( "--legion-src-dir", dest="legion_src_dir", required=False, default=None, - help="Path to an existing Legion source directory.", + help="Path to an existing Legion source directory. A recent checkout " + "of the control_replication branch is required.", ) parser.add_argument( "--legion-url", diff --git a/legate_core_cpp.cmake b/legate_core_cpp.cmake index 588a15b83..d376940b9 100644 --- a/legate_core_cpp.cmake +++ b/legate_core_cpp.cmake @@ -89,11 +89,9 @@ macro(_enable_cuda_language) endif() endmacro() -if(Legion_USE_Python) - _find_package_Python3() - if(Python3_FOUND AND Python3_VERSION) - set(Legion_Python_Version ${Python3_VERSION}) - endif() +_find_package_Python3() +if(Python3_FOUND AND Python3_VERSION) + set(Legion_Python_Version ${Python3_VERSION}) endif() if(Legion_USE_CUDA) @@ -102,8 +100,8 @@ endif() ### # If we find Legion already configured on the system, it will report whether it -# was compiled with Python (Legion_USE_PYTHON), CUDA (Legion_USE_CUDA), OpenMP -# (Legion_USE_OpenMP), and networking (Legion_NETWORKS). +# was compiled with CUDA (Legion_USE_CUDA), OpenMP (Legion_USE_OpenMP), and +# networking (Legion_NETWORKS). # # We use the same variables as Legion because we want to enable/disable each of # these features based on how Legion was configured (it doesn't make sense to @@ -111,11 +109,6 @@ endif() ### include(cmake/thirdparty/get_legion.cmake) -# If Legion_USE_Python was toggled ON by find_package(Legion), find Python3 -if(Legion_USE_Python AND (NOT Python3_FOUND)) - _find_package_Python3() -endif() - if(Legion_NETWORKS) find_package(MPI REQUIRED COMPONENTS CXX) endif() @@ -458,7 +451,6 @@ endif() ]=] "set(Legion_USE_CUDA ${Legion_USE_CUDA})" "set(Legion_USE_OpenMP ${Legion_USE_OpenMP})" - "set(Legion_USE_Python ${Legion_USE_Python})" "set(Legion_NETWORKS ${Legion_NETWORKS})" "set(Legion_BOUNDS_CHECKS ${Legion_BOUNDS_CHECKS})" [=[ diff --git a/legate_core_python.cmake b/legate_core_python.cmake index 3c8b3e234..0ad535a4d 100644 --- a/legate_core_python.cmake +++ b/legate_core_python.cmake @@ -37,8 +37,6 @@ endif() if(NOT legate_core_FOUND) set(SKBUILD OFF) - set(Legion_USE_Python ON) - set(Legion_BUILD_BINDINGS ON) add_subdirectory(. "${CMAKE_CURRENT_SOURCE_DIR}/build") set(SKBUILD ON) endif() diff --git a/scripts/build-separately-no-install.sh b/scripts/build-separately-no-install.sh index e8d1e64c5..f82cc57e1 100755 --- a/scripts/build-separately-no-install.sh +++ b/scripts/build-separately-no-install.sh @@ -20,8 +20,6 @@ if [[ -n "$(which ninja)" ]]; then cmake_args+=" -GNinja"; fi cmake_args+=" -D Legion_USE_CUDA=ON -D Legion_USE_OpenMP=ON --D Legion_USE_Python=ON --D Legion_BUILD_BINDINGS=ON -D CMAKE_CUDA_ARCHITECTURES=NATIVE "; diff --git a/src/legate_defines.h b/src/legate_defines.h index 7c08bc3b1..1920a4beb 100644 --- a/src/legate_defines.h +++ b/src/legate_defines.h @@ -29,6 +29,10 @@ #define LEGATE_DEVICE_PREFIX #endif +#ifndef LEGION_REDOP_COMPLEX +#error "Legate needs Legion to be compiled with -DLEGION_REDOP_COMPLEX" +#endif + #ifndef LEGION_REDOP_HALF #error "Legate needs Legion to be compiled with -DLEGION_REDOP_HALF" #endif