Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2025 Stanford University, NVIDIA Corporation
# Copyright 2025 Stanford University, NVIDIA Corporation, Los Alamos National Laboratory
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -512,8 +512,7 @@ if(REALM_ENABLE_KOKKOS)
find_package(Kokkos COMPONENTS separable_compilation)
if (Kokkos_FOUND)
enable_language(${Kokkos_COMPILE_LANGUAGE})
list(APPEND REALM_STATIC_DEPENDS Kokkos)
list(APPEND REALM_LIBRARIES Kokkos::kokkoscore)
list(APPEND REALM_LIBRARIES realm_kokkos)
endif()
endif()

Expand Down
4 changes: 2 additions & 2 deletions cmake/RealmConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2025 Stanford University, NVIDIA Corporation
# Copyright 2025 Stanford University, NVIDIA Corporation, Los Alamos National Laboratory
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -90,7 +90,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
# TODO(cperry): move this to be header only / optional, maybe after the c++ api
# is implemented on top of the c api
if(REALM_USE_KOKKOS)
find_dependency(Kokkos)
find_dependency(Kokkos COMPONENTS separable_compilation)
endif()

macro(Realm_load_targets type)
Expand Down
16 changes: 15 additions & 1 deletion cmake/RealmPackaging.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2025 Stanford University, NVIDIA Corporation
# Copyright 2025 Stanford University, NVIDIA Corporation, Los Alamos National Laboratory
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -30,6 +30,20 @@ install(
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/realm"
)

# Install the realm_kokkos as well when needed
if(REALM_USE_KOKKOS)
install(
TARGETS realm_kokkos
EXPORT Realm_targets
RUNTIME COMPONENT Realm_runtime
LIBRARY COMPONENT Realm_runtime
ARCHIVE COMPONENT Realm_devel
PUBLIC_HEADER COMPONENT Realm_devel DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/realm"
INCLUDES
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/realm"
)
endif()

# Install the realm_gex_wrapper as well if we have to link directly to it
if(REALM_INSTALL_GASNETEX_WRAPPER)
install(
Expand Down
9 changes: 2 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2025 Stanford University, NVIDIA Corporation
# Copyright 2025 Stanford University, NVIDIA Corporation, Los Alamos National Laboratory
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -131,12 +131,7 @@ if(REALM_USE_MPI)
endif()

if(REALM_USE_KOKKOS)
list(APPEND REALM_SOURCES kokkos_interop.cc)
set_source_files_properties("${REALM_SOURCE_DIR}/kokkos_interop.cc"
DIRECTORY ${PROJECT_SOURCE_DIR}
PROPERTIES
LANGUAGE ${Kokkos_COMPILE_LANGUAGE}
)
add_subdirectory(${REALM_SOURCE_DIR}/kokkos)
endif()

# Replace me later
Expand Down
82 changes: 82 additions & 0 deletions src/realm/kokkos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Copyright 2025 Stanford University, NVIDIA Corporation, Los Alamos National Laboratory
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Kokkos interop library - compiled separately with Kokkos-specific compiler settings
set(CMAKE_CXX_COMPILER "${Kokkos_CXX_COMPILER}")

set(REALM_KOKKOS_SOURCES
kokkos_interop.cc
)

# if this library is STATIC, the Kokkos INTERFACE options will propagate up
# and force us to use the same compiler (wrapper) as Kokkos globally.
add_library(realm_kokkos ${REALM_KOKKOS_SOURCES})
if(NOT "${Kokkos_COMPILE_LANGUAGE}" STREQUAL "CXX")
# explicitly setting it to CXX adds a `-x c++`, which breaks hipcc compilation
set_source_files_properties(${REALM_KOKKOS_SOURCES} PROPERTIES LANGUAGE ${Kokkos_COMPILE_LANGUAGE})
endif()
kokkos_compilation(SOURCE ${REALM_KOKKOS_SOURCES})

target_compile_features(realm_kokkos PUBLIC cxx_std_${REALM_CXX_STANDARD})

target_include_directories(
realm_kokkos
PUBLIC
$<BUILD_INTERFACE:${REALM_SOURCE_DIR}/..>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>
PRIVATE
$<$<TARGET_EXISTS:CUDA::cuda_driver>:${CUDAToolkit_CUPTI_INCLUDE_DIR}>
$<$<TARGET_EXISTS:CUDA::cuda_driver>:${CUDAToolkit_INCLUDE_DIR}>
$<$<TARGET_EXISTS:hip::host>:${HIP_INCLUDE_DIR}>
)

# Link privately to Kokkos - this prevents Kokkos from propagating to the rest of the build
target_link_libraries(realm_kokkos PRIVATE Kokkos::kokkoscore)

# Apply standard compile options
target_compile_options(
realm_kokkos
PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall
-Wextra
-Wno-unused-parameter>
$<$<CXX_COMPILER_ID:MSVC>:
/W4
/Zc:alignedNew
/utf-8
/Zi
/permissive-
/Zc:tlsGuards
/wd4100>
PUBLIC
$<$<CXX_COMPILER_ID:MSVC>:/Zc:__cplusplus>
)

# Set visibility properties to match main library
set_target_properties(
realm_kokkos
PROPERTIES
C_VISIBILITY_PRESET hidden
CXX_VISIBILITY_PRESET hidden
CUDA_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
POSITION_INDEPENDENT_CODE ON
)

# Apply coverage flags if enabled
if(REALM_ENABLE_COVERAGE AND NOT OPENCPPCOV_PATH)
append_coverage_compiler_flags_to_target(realm_kokkos)
endif()
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Stanford University, NVIDIA Corporation
* Copyright 2025 Stanford University, NVIDIA Corporation, Los Alamos National Laboratory
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,7 +17,7 @@

// Realm+Kokkos interop support

#include "realm/kokkos_interop.h"
#include "realm/kokkos/kokkos_interop.h"

#include "realm/mutex.h"
#include "realm/processor.h"
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/realm/runtime_impl.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 Stanford University, NVIDIA Corporation
* Copyright 2025 Stanford University, NVIDIA Corporation, Los Alamos National Laboratory
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -43,7 +43,7 @@
#include "realm/transfer/channel_disk.h"

#ifdef REALM_USE_KOKKOS
#include "realm/kokkos_interop.h"
#include "realm/kokkos/kokkos_interop.h"
#endif

#ifdef REALM_USE_NVTX
Expand Down
Loading