[tensorpipe] update to latest (#23569)

* [tensorpipe] version update

* update patch files
* support find_package for https://github.com/microsoft/vcpkg/pull/17199

* [tensorpipe] update versions JSON

* [tensorpipe] use mainstream PR

* rename existing patch files
* update versions JSON

* [tensorpipe] update license

* [tensorpipe] fix patch's SHA512 value

* Add cuda-nvml-dev-11-6 to VMs.

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
This commit is contained in:
Park DongHa 2022-05-18 15:57:56 +09:00 committed by GitHub
parent 0fbc2d9633
commit b34ae2aff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 98 additions and 137 deletions

View File

@ -1,71 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 640054e..18de9ea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,6 @@ include(MiscCheck)
add_subdirectory(tensorpipe)
-install(EXPORT TensorpipeTargets
- DESTINATION share/cmake/Tensorpipe
- FILE TensorpipeTargets.cmake)
+install(EXPORT tensorpipeTargets
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME} # share/tensorpipe
+ FILE tensorpipeTargets.cmake)
diff --git a/tensorpipe/CMakeLists.txt b/tensorpipe/CMakeLists.txt
index d8624b4..dce5c6f 100644
--- a/tensorpipe/CMakeLists.txt
+++ b/tensorpipe/CMakeLists.txt
@@ -168,8 +168,9 @@ set(TP_PUBLIC_HEADERS ${TP_PUBLIC_HEADERS}
transport/uv/error.h
transport/uv/factory.h
transport/uv/utility.h)
-find_package(uv REQUIRED)
-target_link_libraries(tensorpipe PRIVATE uv::uv)
+# `libuv` in vcpkg
+find_package(unofficial-libuv CONFIG REQUIRED)
+target_link_libraries(tensorpipe PUBLIC unofficial::libuv::libuv ${CMAKE_DL_LIBS})
### shm
@@ -233,11 +234,14 @@ configure_file(config.h.in config.h)
## Libnop
-# 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).
-target_include_directories(tensorpipe PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third_party/libnop/include>)
-
+# `libnop` in vcpkg
+find_path(LIBNOP_INCLUDE_DIRS "nop/serializer.h")
+if(LIBNOP_INCLUDE_DIRS-NOTFOUND)
+ message(FATAL_ERROR "Failed to find header of the 'libnop' package from vcpkg.")
+else()
+ message(STATUS "Using 'libnop': ${LIBNOP_INCLUDE_DIRS}")
+endif()
+target_include_directories(tensorpipe PUBLIC $<BUILD_INTERFACE:${LIBNOP_INCLUDE_DIRS}>)
## Python bindings
@@ -262,10 +266,17 @@ endif()
## Install
+install(DIRECTORY channel common core transport util
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tensorpipe
+ FILES_MATCHING PATTERN "*.h")
+install(FILES tensorpipe.h
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tensorpipe)
+
install(TARGETS tensorpipe
- EXPORT TensorpipeTargets
- LIBRARY DESTINATION ${TP_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${TP_INSTALL_LIBDIR})
+ EXPORT tensorpipeTargets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
foreach(_header_file ${TP_PUBLIC_HEADERS})
get_filename_component(_TP_HEADER_SUBDIR "${_header_file}" DIRECTORY)

View File

@ -1,14 +1,20 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_download_distfile(INSTALL_PACKAGE_CONFIG_PATCH
URLS "https://patch-diff.githubusercontent.com/raw/pytorch/tensorpipe/pull/435.diff"
FILENAME tensorpipe-pr-435.patch
SHA512 7bcf604a967da36b8af936f8b8ab87b442834024b0b2cb886811c15e80893be842fbee2667bbbc39886814ec9b2f4ed0c2527de51fdb7dc293b25cce515f5e4b
)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO pytorch/tensorpipe
REF c5a21994bc766659f7f85edb75478e13f429f46c
SHA512 05a3989286610edea2f0fcfb9197c563e947f0386f2b52110dd060053d68b62477fcd4778a45a3030b9a53b6ceccead91e4dd96c9f0153023e97414459fbd8dd
REF 52791a2fd214b2a9dc5759d36725909c1daa7f2e
SHA512 1e5faf17a7236c5506c08cb28be16069b11bb929bbca64ed9745ce4277d46739186ab7d6597da7437d90ed2d166d4c37ef2f3bceabe8083ef3adbb0e8e5f227e
PATCHES
fix-cmakelists.patch
"${INSTALL_PACKAGE_CONFIG_PATCH}"
use-vcpkg.patch
support-test.patch
support-pybind11.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
@ -25,7 +31,7 @@ if("pybind11" IN_LIST FEATURES)
endif()
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DTP_ENABLE_SHM=${VCPKG_TARGET_IS_LINUX}
@ -33,12 +39,15 @@ vcpkg_cmake_configure(
-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()
vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/Tensorpipe")
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/share
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)

View File

@ -1,30 +0,0 @@
diff --git a/tensorpipe/python/CMakeLists.txt b/tensorpipe/python/CMakeLists.txt
index 41958dd..02562b4 100644
--- a/tensorpipe/python/CMakeLists.txt
+++ b/tensorpipe/python/CMakeLists.txt
@@ -4,13 +4,17 @@
# 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)
+set_target_properties(pytensorpipe
+PROPERTIES
+ CXX_STANDARD 14
+)
+target_link_libraries(pytensorpipe PRIVATE tensorpipe pybind11::module)
+
+install(TARGETS pytensorpipe
+ EXPORT tensorpipeTargets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -1,39 +1,39 @@
diff --git a/tensorpipe/test/CMakeLists.txt b/tensorpipe/test/CMakeLists.txt
index c0320aa..1414bdd 100644
index 53e8643..c49ada6 100644
--- a/tensorpipe/test/CMakeLists.txt
+++ b/tensorpipe/test/CMakeLists.txt
@@ -86,11 +86,8 @@ if(TP_USE_CUDA)
endif()
-add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/googletest
- ${PROJECT_BINARY_DIR}/third_party/googletest)
+find_package(GTest CONFIG REQUIRED)
target_link_libraries(tensorpipe_test PRIVATE
tensorpipe
- uv::uv
- gmock
- gtest_main)
+ unofficial::libuv::libuv GTest::gmock GTest::gtest_main)
diff --git a/tensorpipe/test/CMakeLists.txt b/tensorpipe/test/CMakeLists.txt
index fecc731..031e40d 100644
--- a/tensorpipe/test/CMakeLists.txt
+++ b/tensorpipe/test/CMakeLists.txt
@@ -80,10 +80,11 @@ if(TP_USE_CUDA)
@@ -93,25 +93,24 @@ if(TP_USE_CUDA)
channel/cuda_ipc/cuda_ipc_test.cc
)
endif()
-
- target_sources(tensorpipe_test PRIVATE
- list(APPEND TP_TEST_SRCS
- channel/cuda_gdr/cuda_gdr_test.cc
- )
-
+ if(TP_ENABLE_CUDA_GDR)
+ target_sources(tensorpipe_test PRIVATE
+ 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)
list(APPEND TP_TEST_LINK_LIBRARIES
tensorpipe
- uv::uv
- gmock
- gtest_main)
+ unofficial::libuv::libuv
+ GTest::gmock
+ GTest::gtest_main)
add_executable(tensorpipe_test ${TP_TEST_SRCS})

View File

@ -0,0 +1,48 @@
diff --git a/tensorpipe/CMakeLists.txt b/tensorpipe/CMakeLists.txt
index efcffc2..e167fae 100644
--- a/tensorpipe/CMakeLists.txt
+++ b/tensorpipe/CMakeLists.txt
@@ -119,8 +119,8 @@ 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(unofficial-libuv CONFIG REQUIRED)
+list(APPEND TP_LINK_LIBRARIES unofficial::libuv::libuv)
### shm
@@ -184,7 +184,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

View File

@ -1,9 +1,9 @@
{
"name": "tensorpipe",
"version-date": "2021-04-26",
"port-version": 1,
"version-date": "2022-03-16",
"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",

View File

@ -6921,8 +6921,8 @@
"port-version": 2
},
"tensorpipe": {
"baseline": "2021-04-26",
"port-version": 1
"baseline": "2022-03-16",
"port-version": 0
},
"termcolor": {
"baseline": "2.1.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "f78594bb71084f0ea1b9e0bba9b9804696e4c011",
"version-date": "2022-03-16",
"port-version": 0
},
{
"git-tree": "fc442cfbc144a4fc95ca41d9349ef04564d7ce5a",
"version-date": "2021-04-26",