Skip to content

Commit

Permalink
legion: merge master into control replication and resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsighter committed Dec 23, 2021
2 parents 45d9999 + 8077278 commit e67a940
Show file tree
Hide file tree
Showing 50 changed files with 4,374 additions and 1,660 deletions.
14 changes: 9 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ variables:
USE_LLVM: "1"
.cuda: &cuda
USE_CUDA: "1"
.cuda_dynamic: &cuda_dynamic
EXTRA_CMAKE_ARGS: "-DLegion_CUDA_DYNAMIC_LOAD=ON -DLegion_HIJACK_CUDART=OFF"
.gasnet1_mpi: &gasnet1_mpi
REALM_NETWORKS: "gasnet1"
CONDUIT: "mpi"
Expand Down Expand Up @@ -335,6 +337,11 @@ before_script:
export LAUNCHER="mpirun -n 2 -x TERRA_PATH -x INCLUDE_PATH -x LD_LIBRARY_PATH -x LG_RT_DIR -x USE_RDIR"
fi
fi
- |
if [[ "$USE_CUDA" -eq 1 ]]; then
# make sure dynamic loading finds the right libcudart.so
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${CUDA}/lib64"
fi
- |
if [[ "$USE_KOKKOS" -eq 1 ]]; then
# Kokkos requires cmake 3.16 - grab it here so the default can remain
Expand Down Expand Up @@ -374,9 +381,6 @@ before_script:
# detection as well as for nvcc_wrapper (if used)
PATH=$PATH:${CUDA}/bin
# libkokkoscore.so doesn't remember where libcudart.so is?
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${CUDA}/lib64"
if [[ "$CXX" == *clang* ]]; then
# clang speaks cuda, so can be used as Kokkos' "C++" compiler
export KOKKOS_CXX_COMPILER="$CXX"
Expand Down Expand Up @@ -1246,10 +1250,10 @@ p100_cuda102_gcc8_cxx11_release_cmake_cuda_legion:
<<: [*p100, *tests]
variables:
<<: [*gcc8, *release, *cxx11_normal, *p100_cuda102, *cmake, *legion, *ctest]
p100_cuda110_gcc9_cxx14_debug_cmake_cuda_legion:
p100_cuda110_gcc9_cxx14_debug_cmake_cuda_dynamic_legion:
<<: [*p100, *tests]
variables:
<<: [*gcc9, *debug, *cxx14_normal, *p100_cuda110, *cmake, *legion, *ctest, *short]
<<: [*gcc9, *debug, *cxx14_normal, *p100_cuda110, *cmake, *legion, *cuda_dynamic, *ctest, *short]
p100_cuda110_gcc9_cxx14_release_cuda_legion:
<<: [*p100, *tests]
variables:
Expand Down
13 changes: 13 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
This file lists the major changes as they appear in the stable branch. No
attempt is made to keep this list accurate for the master branch.

Version 21.12.0 (December ??, 2021)
* Realm
- Performance improvements for multi-dimensional copies, especially
inter-process transfers
- Support for loading CUDA driver (if present) at runtime instead of
link time, allowing same binary to be used on systems with and without
CUDA-capable GPUs (enabled with -DLegion_CUDA_DYNAMIC_LOAD=ON in
cmake build)
* Build
- Cmake allows control of max nodes (-DLegion_MAX_NUM_NODES=...) and
max processors/node (-DLegion_MAX_NUM_PROCS=...) supported by
Legion build

Version 21.09.0 (September 28, 2021)
* Realm
- Numerous bug fixes in the `gasnetex` network layer
Expand Down
66 changes: 56 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ set(CMAKE_ENABLE_EXPORTS ON)
#------------------------------------------------------------------------------#

# 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
# builds so we override the cmake defaults here for release, this changes
# -O3 to -O2 and removes -DNDEBUG
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
Expand Down Expand Up @@ -302,6 +302,7 @@ endif()
option(Legion_USE_CUDA "Enable support for the CUDA runtime" OFF)
if(Legion_USE_CUDA)
set(Legion_CUDA_ARCH "" CACHE STRING "Comma-separated list of CUDA architectures to build for (e.g. 60,70)")
option(Legion_CUDA_DYNAMIC_LOAD "Load cuda libraries at runtime" OFF)

if(NOT BUILD_SHARED_LIBS)
set(CUDA_USE_STATIC_CUDA_RUNTIME ON)
Expand Down Expand Up @@ -341,9 +342,19 @@ if(Legion_USE_CUDA)
if(Legion_HIJACK_CUDART)
set(REALM_USE_CUDART_HIJACK ON)
endif()
<<<<<<< HEAD

# runtime.cc uses cuda.h
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CUDA_INCLUDE_DIRS}")
=======
if(Legion_CUDA_DYNAMIC_LOAD)
# not compatible with runtime hijack
if(Legion_HIJACK_CUDART)
message(FATAL_ERROR "Dynamic CUDA library loading (Legion_CUDA_DYNAMIC_LOAD) is not compatible with CUDA runtime hijack (Legion_HIJACK_CUDART)")
endif()
set(REALM_CUDA_DYNAMIC_LOAD ON)
endif()
>>>>>>> master
endif()

#------------------------------------------------------------------------------#
Expand All @@ -369,9 +380,9 @@ if(Legion_USE_HIP)
install(FILES ${Legion_SOURCE_DIR}/cmake/newcmake/FindCUDA.cmake
DESTINATION ${CMAKE_INSTALL_DATADIR}/Legion/cmake/newcmake
)
set(HIPCC_FLAGS "-D__HIP_PLATFORM_NVCC__")
set(HIPCC_FLAGS "-D__HIP_PLATFORM_NVCC__")
endif()

if (Legion_HIP_TARGET STREQUAL "ROCM")
set(Legion_HIP_ARCH "" CACHE STRING "Comma-separated list of HIP architectures to build for (e.g. gfx906,gfx908)")

Expand All @@ -385,7 +396,7 @@ if(Legion_USE_HIP)
set(HIP_GENCODE "--amdgpu-target=${Legion_HIP_ARCH}")
endif()
endif()

# find the hip library
find_package(HIP REQUIRED)

Expand Down Expand Up @@ -574,7 +585,7 @@ if(Legion_USE_ZLIB)
# define variable for legion_defines.h
set(LEGION_USE_ZLIB ON)
endif()

#------------------------------------------------------------------------------#
# Fortran configuration
#------------------------------------------------------------------------------#
Expand All @@ -595,12 +606,47 @@ mark_as_advanced(Legion_MAX_DIM)
set(LEGION_MAX_DIM ${Legion_MAX_DIM})
set(REALM_MAX_DIM ${Legion_MAX_DIM})

set(Legion_MAX_FIELDS 512 CACHE STRING "Maximum number of fields allocated to a single field space")
set_property(CACHE Legion_MAX_FIELDS PROPERTY STRINGS 32 64 128 256 512 1024)
mark_as_advanced(Legion_MAX_FIELDS)
# legion uses statically-sized arrays for performance in some cases - make
# sure they're big enough for your use case
set(Legion_MAX_FIELDS 512 CACHE STRING
"Maximum number of fields allocated to a single field space -- MUST be a power of two.")
set(Legion_MAX_NUM_NODES 1024 CACHE STRING
"Maximum number of nodes supported by the runtime -- MUST be a power of two.")
set(Legion_MAX_NUM_PROCS 64 CACHE STRING
"Maximum number of processors (per node) supported by the runtime -- MUST be a power of two.")

# define variable for legion_defines.h
# check that they're all powers of two

function(is_power_of_two x ret)
set(${ret} FALSE PARENT_SCOPE)
if (${x} LESS_EQUAL 0)
return()
endif()
math(EXPR y "${x} & (${x} - 1)")
if (${y} EQUAL 0)
set(${ret} TRUE PARENT_SCOPE)
endif()
endfunction()

is_power_of_two(${Legion_MAX_FIELDS} is_pow_two)
if (NOT is_pow_two)
message(FATAL_ERROR "Legion_MAX_FIELDS must be a power of two.")
endif()

is_power_of_two(${Legion_MAX_NUM_NODES} is_pow_two)
if (NOT is_pow_two)
message(FATAL_ERROR "Legion_MAX_NUM_NODES must be a power of two.")
endif()

is_power_of_two(${Legion_MAX_NUM_PROCS} is_pow_two)
if (NOT is_pow_two)
message(FATAL_ERROR "Legion_MAX_NUM_PROCS must be a power of two.")
endif()

# define variables for legion_defines.h
set(LEGION_MAX_FIELDS ${Legion_MAX_FIELDS})
set(LEGION_MAX_NUM_NODES ${Legion_MAX_NUM_NODES})
set(LEGION_MAX_NUM_PROCS ${Legion_MAX_NUM_PROCS})

option(Legion_WARNINGS_FATAL "Make all runtime warnings fatal" OFF)
set(LEGION_WARNINGS_FATAL ${Legion_WARNINGS_FATAL})
Expand Down Expand Up @@ -740,7 +786,7 @@ if(Legion_BUILD_ALL OR Legion_BUILD_APPS OR Legion_BUILD_BINDINGS OR Legion_BUIL
set(PROP $<TARGET_PROPERTY:Legion::Legion,INTERFACE_INCLUDE_DIRECTORIES>)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} $<$<BOOL:${PROP}>:-I$<JOIN:${PROP}, -I>>")
endif()

if(Legion_HIP_TARGET STREQUAL "CUDA")
set(PROP $<TARGET_PROPERTY:Legion::Legion,INTERFACE_COMPILE_OPTIONS>)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} ${PROP}")
Expand Down
4 changes: 4 additions & 0 deletions cmake/legion_defines.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

#cmakedefine LEGION_MAX_FIELDS @LEGION_MAX_FIELDS@

#cmakedefine LEGION_MAX_NUM_NODES @LEGION_MAX_NUM_NODES@

#cmakedefine LEGION_MAX_NUM_PROCS @LEGION_MAX_NUM_PROCS@

#cmakedefine LEGION_USE_CUDA

#cmakedefine LEGION_GPU_REDUCTIONS
Expand Down
1 change: 1 addition & 0 deletions cmake/realm_defines.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#cmakedefine REALM_USE_CUDA
#cmakedefine REALM_USE_CUDART_HIJACK
#cmakedefine REALM_CUDA_DYNAMIC_LOAD

#cmakedefine REALM_USE_HIP
#cmakedefine REALM_USE_HIP_HIJACK
Expand Down
2 changes: 1 addition & 1 deletion language/src/regent/cudahelper.t
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ function cudahelper.codegen_kernel_call(cx, kernel_id, count, args, shared_mem_s
else
[grid].x, [grid].y, [grid].z =
MAX_NUM_BLOCK, MAX_NUM_BLOCK,
[round_exp(num_blocks, MAX_NUM_BLOCK, MAX_NUM_BLOCK)]
[round_exp(num_blocks, MAX_NUM_BLOCK * MAX_NUM_BLOCK)]
end
end

Expand Down
4 changes: 2 additions & 2 deletions language/src/regent/std_base.t
Original file line number Diff line number Diff line change
Expand Up @@ -898,11 +898,11 @@ local symbol = {}
function symbol:__index(field)
local value = symbol[field]
if value ~= nil then return value end
error("symbol has no field '" .. field .. "' (in lookup)", 2)
error("symbol has no field '" .. tostring(field) .. "' (in lookup)", 2)
end

function symbol:__newindex(field, value)
error("symbol has no field '" .. field .. "' (in assignment)", 2)
error("symbol has no field '" .. tostring(field) .. "' (in assignment)", 2)
end

do
Expand Down
8 changes: 6 additions & 2 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,15 @@ if(Legion_USE_CUDA)
string(REGEX REPLACE "[^\;]*cudart[^\;]*(\;?)" "" CUDA_LIBRARIES "${CUDA_LIBRARIES}")
set(CUDA_LIBRARIES ${CUDA_LIBRARIES} PARENT_SCOPE)
else()
target_link_libraries(RealmRuntime PRIVATE ${CUDA_CUDART_LIBRARY})
if(NOT REALM_CUDA_DYNAMIC_LOAD)
target_link_libraries(RealmRuntime PRIVATE ${CUDA_CUDART_LIBRARY})
endif()
endif()

target_include_directories(RealmRuntime PRIVATE ${CUDA_INCLUDE_DIRS})
target_link_libraries(RealmRuntime PRIVATE ${CUDA_CUDA_LIBRARY})
if(NOT REALM_CUDA_DYNAMIC_LOAD)
target_link_libraries(RealmRuntime PRIVATE ${CUDA_CUDA_LIBRARY})
endif()
# for backwards compatibility in applications
target_compile_definitions(RealmRuntime INTERFACE USE_CUDA)
endif()
Expand Down
Loading

0 comments on commit e67a940

Please sign in to comment.