aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/tensorpipe
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/tensorpipe')
-rw-r--r--vcpkg/ports/tensorpipe/portfile.cmake48
-rw-r--r--vcpkg/ports/tensorpipe/support-find-package.patch58
-rw-r--r--vcpkg/ports/tensorpipe/support-test.patch45
-rw-r--r--vcpkg/ports/tensorpipe/use-vcpkg.patch52
-rw-r--r--vcpkg/ports/tensorpipe/vcpkg.json41
5 files changed, 244 insertions, 0 deletions
diff --git a/vcpkg/ports/tensorpipe/portfile.cmake b/vcpkg/ports/tensorpipe/portfile.cmake
new file mode 100644
index 0000000..290d97d
--- /dev/null
+++ b/vcpkg/ports/tensorpipe/portfile.cmake
@@ -0,0 +1,48 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO pytorch/tensorpipe
+ REF 52791a2fd214b2a9dc5759d36725909c1daa7f2e
+ SHA512 1e5faf17a7236c5506c08cb28be16069b11bb929bbca64ed9745ce4277d46739186ab7d6597da7437d90ed2d166d4c37ef2f3bceabe8083ef3adbb0e8e5f227e
+ PATCHES
+ "${INSTALL_PACKAGE_CONFIG_PATCH}"
+ support-find-package.patch
+ use-vcpkg.patch
+ support-test.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ cuda TP_USE_CUDA
+ cuda TP_ENABLE_CUDA_IPC
+ pybind11 TP_BUILD_PYTHON
+ test TP_BUILD_TESTING
+)
+
+if("pybind11" IN_LIST FEATURES)
+ vcpkg_find_acquire_program(PYTHON3)
+ list(APPEND FEATURE_OPTIONS -DPYTHON_EXECUTABLE=${PYTHON3})
+endif()
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DTP_ENABLE_SHM=${VCPKG_TARGET_IS_LINUX}
+ -DTP_ENABLE_IBV=OFF
+ -DTP_ENABLE_CMA=OFF
+ -DTP_BUILD_LIBUV=OFF # will use libuv package
+ -DTP_ENABLE_CUDA_GDR=OFF
+ MAYBE_UNUSED_VARIABLES
+ TP_ENABLE_CUDA_GDR
+ TP_ENABLE_CUDA_IPC
+)
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/unofficial-tensorpipe" PACKAGE_NAME "unofficial-tensorpipe")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include"
+ "${CURRENT_PACKAGES_DIR}/debug/share"
+)
diff --git a/vcpkg/ports/tensorpipe/support-find-package.patch b/vcpkg/ports/tensorpipe/support-find-package.patch
new file mode 100644
index 0000000..85278a2
--- /dev/null
+++ b/vcpkg/ports/tensorpipe/support-find-package.patch
@@ -0,0 +1,58 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 77df76d..bebb8c8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -24,5 +24,17 @@ include(MiscCheck)
+ add_subdirectory(tensorpipe)
+
+ install(EXPORT TensorpipeTargets
+- DESTINATION share/cmake/Tensorpipe
+- FILE TensorpipeTargets.cmake)
++ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/unofficial-tensorpipe
++ NAMESPACE unofficial::tensorpipe::
++ FILE unofficial-tensorpipe-targets.cmake)
++
++# Create TensorpipeConfig.cmake for find_package(unofficial-tensorpipe CONFIG)
++include(CMakePackageConfigHelpers)
++get_filename_component(CONFIG_FILE_PATH ${CMAKE_CURRENT_BINARY_DIR}/unofficial-tensorpipe-config.cmake ABSOLUTE)
++configure_package_config_file(
++ cmake/unofficial-tensorpipe-config.cmake.in ${CONFIG_FILE_PATH}
++ INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/unofficial-tensorpipe)
++
++# Install the generated config file
++install(FILES ${CONFIG_FILE_PATH}
++ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/unofficial-tensorpipe)
+diff --git a/cmake/unofficial-tensorpipe-config.cmake.in b/cmake/unofficial-tensorpipe-config.cmake.in
+new file mode 100644
+index 000000000..f2ea8ce47
+--- /dev/null
++++ b/cmake/unofficial-tensorpipe-config.cmake.in
+@@ -0,0 +1,15 @@
++@PACKAGE_INIT@
++include(CMakeFindDependencyMacro)
++
++find_dependency(libuv REQUIRED)
++
++get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
++file(GLOB CONFIG_FILES "${_DIR}/unofficial-tensorpipe-config-*.cmake")
++foreach(f ${CONFIG_FILES})
++ include(${f})
++endforeach()
++
++# import targets
++include("${_DIR}/unofficial-tensorpipe-targets.cmake")
++
++check_required_components(@PROJECT_NAME@)
+diff --git a/tensorpipe/python/CMakeLists.txt b/tensorpipe/python/CMakeLists.txt
+index ce494722f..b722381f8 100644
+--- a/tensorpipe/python/CMakeLists.txt
++++ b/tensorpipe/python/CMakeLists.txt
+@@ -14,3 +14,8 @@ endif()
+ set(PYBIND11_CPP_STANDARD -std=c++14)
+ pybind11_add_module(pytensorpipe tensorpipe.cc)
+ target_link_libraries(pytensorpipe PRIVATE tensorpipe)
++
++install(TARGETS pytensorpipe
++ EXPORT TensorpipeTargets
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
diff --git a/vcpkg/ports/tensorpipe/support-test.patch b/vcpkg/ports/tensorpipe/support-test.patch
new file mode 100644
index 0000000..107e916
--- /dev/null
+++ b/vcpkg/ports/tensorpipe/support-test.patch
@@ -0,0 +1,45 @@
+diff --git a/tensorpipe/test/CMakeLists.txt b/tensorpipe/test/CMakeLists.txt
+index 53e8643..09baaa0 100644
+--- a/tensorpipe/test/CMakeLists.txt
++++ b/tensorpipe/test/CMakeLists.txt
+@@ -93,25 +93,30 @@ if(TP_USE_CUDA)
+ channel/cuda_ipc/cuda_ipc_test.cc
+ )
+ endif()
+-
+- list(APPEND TP_TEST_SRCS
+- channel/cuda_gdr/cuda_gdr_test.cc
+- )
+-
++ if(TP_ENABLE_CUDA_GDR)
++ list(APPEND TP_TEST_SRCS
++ channel/cuda_gdr/cuda_gdr_test.cc
++ )
++ endif()
+ cuda_add_library(tensorpipe_cuda_kernel channel/kernel.cu)
+ list(APPEND TP_TEST_LINK_LIBRARIES tensorpipe_cuda_kernel)
+
+ list(APPEND TP_TEST_LINK_LIBRARIES tensorpipe_cuda)
+ endif()
+
+-add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/googletest
+- ${PROJECT_BINARY_DIR}/third_party/googletest EXCLUDE_FROM_ALL)
++find_package(GTest CONFIG REQUIRED)
++
++if (TARGET libuv::uv)
++ set(LIBUV_LIBRARY libuv::uv)
++else()
++ set(LIBUV_LIBRARY libuv::uv_a)
++endif()
+
+ list(APPEND TP_TEST_LINK_LIBRARIES
+ tensorpipe
+- uv::uv
+- gmock
+- gtest_main)
++ ${LIBUV_LIBRARY}
++ GTest::gmock
++ GTest::gtest_main)
+
+ add_executable(tensorpipe_test ${TP_TEST_SRCS})
+
diff --git a/vcpkg/ports/tensorpipe/use-vcpkg.patch b/vcpkg/ports/tensorpipe/use-vcpkg.patch
new file mode 100644
index 0000000..4afcd1a
--- /dev/null
+++ b/vcpkg/ports/tensorpipe/use-vcpkg.patch
@@ -0,0 +1,52 @@
+diff --git a/tensorpipe/CMakeLists.txt b/tensorpipe/CMakeLists.txt
+index efcffc2..dd9bd16 100644
+--- a/tensorpipe/CMakeLists.txt
++++ b/tensorpipe/CMakeLists.txt
+@@ -119,8 +119,12 @@ list(APPEND TP_PUBLIC_HDRS
+ transport/uv/utility.h)
+
+ # Add uv package
+-find_package(uv REQUIRED)
+-list(APPEND TP_LINK_LIBRARIES uv::uv)
++find_package(libuv CONFIG REQUIRED)
++if (TARGET libuv::uv)
++list(APPEND TP_LINK_LIBRARIES libuv::uv)
++else()
++list(APPEND TP_LINK_LIBRARIES libuv::uv_a)
++endif()
+
+ ### shm
+
+@@ -184,7 +188,8 @@ configure_file(config.h.in config.h)
+ # We should keep libnop headers private as they should not be exposed to downstream users,
+ # but they're currently transitively included by tensorpipe/transport/connection.h (which
+ # is still unclear whether it should be a public or private header).
+-list(APPEND TP_INCLUDE_DIRS $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third_party/libnop/include>)
++find_path(LIBNOP_INCLUDE_DIRS "nop/serializer.h" REQUIRED)
++list(APPEND TP_INCLUDE_DIRS $<BUILD_INTERFACE:${LIBNOP_INCLUDE_DIRS}>)
+
+
+ ## Target
+diff --git a/tensorpipe/python/CMakeLists.txt b/tensorpipe/python/CMakeLists.txt
+index b722381..688886a 100644
+--- a/tensorpipe/python/CMakeLists.txt
++++ b/tensorpipe/python/CMakeLists.txt
+@@ -4,16 +4,11 @@
+ # This source code is licensed under the BSD-style license found in the
+ # LICENSE file in the root directory of this source tree.
+
+-if(NOT (COMMAND pybind11_add_module))
+- add_subdirectory(
+- ${PROJECT_SOURCE_DIR}/third_party/pybind11
+- ${PROJECT_BINARY_DIR}/third_party/pybind11
+- EXCLUDE_FROM_ALL)
+-endif()
++find_package(pybind11 CONFIG REQUIRED)
+
+ set(PYBIND11_CPP_STANDARD -std=c++14)
+ pybind11_add_module(pytensorpipe tensorpipe.cc)
+-target_link_libraries(pytensorpipe PRIVATE tensorpipe)
++target_link_libraries(pytensorpipe PRIVATE tensorpipe pybind11::module)
+
+ install(TARGETS pytensorpipe
+ EXPORT TensorpipeTargets
diff --git a/vcpkg/ports/tensorpipe/vcpkg.json b/vcpkg/ports/tensorpipe/vcpkg.json
new file mode 100644
index 0000000..6e81397
--- /dev/null
+++ b/vcpkg/ports/tensorpipe/vcpkg.json
@@ -0,0 +1,41 @@
+{
+ "name": "tensorpipe",
+ "version-date": "2022-03-16",
+ "port-version": 5,
+ "description": "A tensor-aware point-to-point communication primitive for machine learning",
+ "homepage": "https://github.com/pytorch/tensorpipe",
+ "license": "BSD-3-Clause",
+ "supports": "linux | osx",
+ "dependencies": [
+ "libnop",
+ "libuv",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "cuda": {
+ "description": "Enable support for CUDA tensors, CUDA IPC channel",
+ "dependencies": [
+ "cuda"
+ ]
+ },
+ "pybind11": {
+ "description": "Build Python bindings",
+ "dependencies": [
+ "pybind11"
+ ]
+ },
+ "test": {
+ "description": "Build with Google.Test",
+ "dependencies": [
+ "gtest"
+ ]
+ }
+ }
+}