Skip to content
Open
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
24 changes: 18 additions & 6 deletions com_nvidia_gxf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ if(NOT TARGET CUDA::nvtx3)
endif()

find_package(yaml-cpp REQUIRED)
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
if(NOT TARGET yaml-cpp::yaml-cpp)
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
endif()
find_package(nlohmann_json REQUIRED)
find_package(breakpad REQUIRED)
find_package(gflags REQUIRED)
Expand All @@ -115,17 +117,27 @@ find_package(rmm 24.04 REQUIRED)
# https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html
unset(PACKAGE_VERSION)

find_package(Python3
COMPONENTS Interpreter Development
REQUIRED
)
# Need to find Python early to ensure consistent lookup between sub-projects and
# functions
find_package(Python REQUIRED COMPONENTS Interpreter Development)

# Ensure that even other packages that use find_package(Python3 ...) will find
# the same Python
set(Python3_EXECUTABLE
"${Python_EXECUTABLE}"
CACHE FILEPATH "Path to the Python interpreter" FORCE)
set(PYTHON_EXECUTABLE
"${Python_EXECUTABLE}"
CACHE FILEPATH "Path to the Python interpreter" FORCE)
mark_as_advanced(Python3_EXECUTABLE PYTHON_EXECUTABLE)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
find_package(pybind11 REQUIRED)

find_package(GTest REQUIRED)
find_package(gRPC CONFIG REQUIRED)

if(BUILD_TESTING OR GXF_BUILD_TESTING)
enable_testing()
enable_testing()
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
Expand Down
1 change: 1 addition & 0 deletions com_nvidia_gxf/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"hidden": true,
"generator": "Ninja",
"cacheVariables": {
"CMAKE_POLICY_DEFAULT_CMP0167": "OLD",
"CMAKE_BUILD_TYPE": "Release",
"BUILD_TESTING": {
"type": "BOOL",
Expand Down
5 changes: 5 additions & 0 deletions com_nvidia_gxf/cmake/modules/Findbreakpad.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@ find_file(
PATHS
"${breakpad_ROOT}/client/linux/handler"
"${breakpad_ROOT}/include/client/linux/handler"
"${breakpad_ROOT}/include/breakpad/client/linux/handler"
REQUIRED
)

cmake_path(GET breakpad_exception_handler_header PARENT_PATH breakpad_exception_handler_include_dir)
cmake_path(APPEND breakpad_exception_handler_include_dir ../../..)
cmake_path(ABSOLUTE_PATH breakpad_exception_handler_include_dir NORMALIZE OUTPUT_VARIABLE breakpad_INCLUDE_DIR)

add_library(breakpad STATIC IMPORTED)
set_target_properties(breakpad
PROPERTIES IMPORTED_LOCATION ${breakpad_STATIC_LIB}
Expand Down
11 changes: 10 additions & 1 deletion com_nvidia_gxf/gxf/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,17 @@ target_link_libraries(core
)
add_library(GXF::core ALIAS core)

#######################################################################################
# Pybind11 extensions
#######################################################################################

pybind11_add_module(core_pybind SHARED WITHOUT_SOABI "bindings/core.cpp")
set_target_properties(core_pybind PROPERTIES OUTPUT_NAME "core_pybind" PREFIX "")
target_link_libraries(core_pybind PUBLIC GXF::core)


install(
TARGETS core_c_api;core_internal;core
TARGETS core_c_api;core_internal;core;core_pybind
EXPORT gxfCoreTargets
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/core
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
#include "gxf/core/entity_item.hpp"
#include "gxf/core/gxf.h"

TEST(Create_Entity, NULL_Value) {
TEST(Create_Entity, GetItem_NULL_Value) {
gxf_uid_t eid = kNullUid;
const GxfEntityCreateInfo entity_create_info = {0};
void* item_ptr = nullptr;
Expand All @@ -22,7 +22,7 @@ TEST(Create_Entity, NULL_Value) {
ASSERT_EQ(GxfContextDestroy(NULL), GXF_CONTEXT_INVALID);
}

TEST(Create_Entity, valid_context) {
TEST(Create_Entity, GetItem_valid_context) {
gxf_context_t context = kNullContext;
ASSERT_EQ(GxfContextCreate(&context), GXF_SUCCESS);
gxf_uid_t eid = kNullUid;
Expand All @@ -34,7 +34,7 @@ TEST(Create_Entity, valid_context) {
ASSERT_EQ(GxfContextDestroy(context), GXF_SUCCESS);
}

TEST(Create_Entity, NULL_GxfEntityCreateInfo) {
TEST(Create_Entity, GetItem_NULL_GxfEntityCreateInfo) {
gxf_context_t context = kNullContext;
GXF_ASSERT_SUCCESS(GxfContextCreate(&context));
gxf_uid_t eid = kNullUid;
Expand All @@ -43,7 +43,7 @@ TEST(Create_Entity, NULL_GxfEntityCreateInfo) {
ASSERT_EQ(item_ptr, nullptr);
}

TEST(Create_Entity, Invalid_GxfEntityCreateInfo) {
TEST(Create_Entity, GetItem_Invalid_GxfEntityCreateInfo) {
gxf_context_t context = kNullContext;
const char* InValid_Entity_Name = "__Entity1";
const GxfEntityCreateInfo entity_create_info{InValid_Entity_Name};
Expand All @@ -57,7 +57,7 @@ TEST(Create_Entity, Invalid_GxfEntityCreateInfo) {
ASSERT_EQ(GxfContextDestroy(context), GXF_SUCCESS);
}

TEST(Create_Entity, Multiple_Entity_with_same_name) {
TEST(Create_Entity, GetItem_Multiple_Entity_with_same_name) {
gxf_context_t context = kNullContext;
gxf_uid_t eid = kNullUid;
gxf_uid_t eid1 = kNullUid;
Expand All @@ -77,7 +77,7 @@ TEST(Create_Entity, Multiple_Entity_with_same_name) {
ASSERT_EQ(GxfContextDestroy(context), GXF_SUCCESS);
}

TEST(Create_Entity, NULL_eid) {
TEST(Create_Entity, GetItem_NULL_eid) {
gxf_context_t context = kNullContext;
const char* Valid_Entity_Name = "Entity";
GXF_ASSERT_SUCCESS(GxfContextCreate(&context));
Expand Down
99 changes: 68 additions & 31 deletions com_nvidia_gxf/gxf/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,80 @@
# 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
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.

gxf_core_add_extension_library(
NAME cuda
SOURCES
cuda.cpp
cuda_allocator.cpp
cuda_event.cpp
cuda_scheduling_terms.cpp
cuda_stream.cpp
cuda_stream_pool.cpp
cuda_stream_sync.cpp
stream_ordered_allocator.cpp
PUBLIC_HEADERS
cuda_allocator.hpp
cuda_buffer.hpp
cuda_common.hpp
cuda_event.hpp
cuda_scheduling_terms.hpp
cuda_stream.hpp
cuda_stream_id.hpp
cuda_stream_pool.hpp
cuda_stream_sync.hpp
stream_ordered_allocator.hpp
PUBLIC_DEPENDS
GXF::common
GXF::core
GXF::std
CUDA::cudart
set(GXF_CUDA_SOURCES
cuda.cpp
cuda_allocator.cpp
cuda_event.cpp
cuda_scheduling_terms.cpp
cuda_stream.cpp
cuda_stream_pool.cpp
cuda_stream_sync.cpp
stream_ordered_allocator.cpp)
set(GXF_CUDA_HEADERS
cuda_allocator.hpp
cuda_buffer.hpp
cuda_common.hpp
cuda_event.hpp
cuda_scheduling_terms.hpp
cuda_stream.hpp
cuda_stream_id.hpp
cuda_stream_pool.hpp
cuda_stream_sync.hpp
stream_ordered_allocator.hpp)
add_library(cuda SHARED ${GXF_CUDA_SOURCES})
set_target_properties(cuda
PROPERTIES
OUTPUT_NAME "gxf_cuda"
PUBLIC_HEADER "${GXF_CUDA_HEADERS}"
INSTALL_RPATH "$ORIGIN:$ORIGIN/../core:$ORIGIN/../std"
)

target_compile_features(cuda PUBLIC cuda_std_20)
target_compile_options(cuda PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr>)
target_include_directories(cuda PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)
target_link_libraries(cuda PUBLIC GXF::common GXF::core GXF::std CUDA::cudart)
add_library(GXF::cuda ALIAS cuda)

include(GNUInstallDirs)
install(
TARGETS cuda
EXPORT gxfCoreTargets
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/cuda
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/cuda
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/cuda
COMPONENT cuda)
set(GXF_EXTENSION_LIBRARY_TARGETS "cuda;${GXF_EXTENSION_LIBRARY_TARGETS}" PARENT_SCOPE)

#######################################################################################
# Pybind11 extensions
#######################################################################################

pybind11_add_module(cuda_pybind SHARED WITHOUT_SOABI "bindings/cuda.cpp")
set_target_properties(cuda_pybind PROPERTIES OUTPUT_NAME "cuda_pybind" PREFIX "")
target_link_libraries(cuda_pybind PUBLIC GXF::common GXF::core GXF::std CUDA::cudart)


install(
TARGETS cuda_pybind
EXPORT gxfCoreTargets
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/cuda
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/cuda
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/cuda
COMPONENT Core
)

if(BUILD_TESTING)
add_subdirectory(tests)
endif()
add_subdirectory(tests)
endif()
18 changes: 15 additions & 3 deletions com_nvidia_gxf/gxf/cuda/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,39 @@
gxf_core_add_extension_library(
NAME test_cuda
SOURCES test_cuda_ext.cpp
PUBLIC_HEADERS test_cuda_helper.hpp
PUBLIC_HEADERS test_cuda_helper.hpp convolution.h
PUBLIC_DEPENDS
CUDA::cublas
GXF::cuda
GXF::common
GXF::core
GXF::cuda
GXF::std
GTest::gtest_main
NO_INSTALL
)

install(
TARGETS test_cuda
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/cuda/tests
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/cuda/tests
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/cuda/tests
COMPONENT test
COMPONENT test
)

gxf_add_gtests(
EXT_NAME CUDA
SOURCES test_cuda_unit.cpp
DATA_FILES
test_cuda_stream_dotproduct.yaml
test_cuda_unit.yaml
DEPENDS
GXF::cuda
GXF::common
GXF::core
GXF::cuda
GXF::std
GTest::gtest_main
)
22 changes: 11 additions & 11 deletions com_nvidia_gxf/gxf/ipc/grpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
###################################################################################################

find_package(gRPC CONFIG REQUIRED)
include(FetchContent)
set(grpc_health_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/grpc_health_proto-src")
set(grpc_health_BUILD_DIR "${CMAKE_BINARY_DIR}/_deps/grpc_health_proto-build")
FetchContent_Declare(
grpc_health_proto
URM_HASH "MD5=93c62f9d6b1925cf3e8822d590484589"
DOWNLOAD_NO_EXTRACT TRUE
SOURCE_DIR ${grpc_health_SOURCE_DIR}
URL "https://raw.githubusercontent.com/grpc/grpc/v${gRPC_VERSION}/src/proto/grpc/health/v1/health.proto"
)
FetchContent_MakeAvailable(grpc_health_proto)
include(FetchContent)
set(grpc_health_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/grpc_health_proto-src")
set(grpc_health_BUILD_DIR "${CMAKE_BINARY_DIR}/_deps/grpc_health_proto-build")
FetchContent_Declare(
grpc_health_proto
URM_HASH "MD5=93c62f9d6b1925cf3e8822d590484589"
DOWNLOAD_NO_EXTRACT TRUE
SOURCE_DIR ${grpc_health_SOURCE_DIR}
URL "https://raw.githubusercontent.com/grpc/grpc/v${gRPC_VERSION}/src/proto/grpc/health/v1/health.proto"
)
FetchContent_MakeAvailable(grpc_health_proto)

set(grpc_health_proto_SOURCES ${grpc_health_SOURCE_DIR}/health.proto)
set(grpc_health_GEN_SOURCES
Expand Down
11 changes: 11 additions & 0 deletions com_nvidia_gxf/gxf/ipc/http/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ gxf_core_add_extension_library(
GXF::std
)

install(
TARGETS http
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/ipc/http
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/ipc/http
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/ipc/http
COMPONENT http
)

if(BUILD_TESTING)
add_subdirectory(tests)
endif()
Loading