aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPark DongHa <luncliff@gmail.com>2021-05-18 15:03:33 +0900
committerGitHub <noreply@github.com>2021-05-17 23:03:33 -0700
commitc76ec6f7f719ba2c35ed6f1155c0ae65875c867c (patch)
treeb01370d0b8f1fe0a5cefe521e61e80e6942e8c00
parente120407c0fbef92a1a02885d1dfa5ab2c07b1248 (diff)
downloadvcpkg-c76ec6f7f719ba2c35ed6f1155c0ae65875c867c.tar.gz
vcpkg-c76ec6f7f719ba2c35ed6f1155c0ae65875c867c.zip
[tensorpipe] create a new port (#16472)
* [tensorpipe] create a new port * [tensorpipe] create patch for libuv * [libnop] create a new port * [libnop] update baseline and port SHA * [tensorpipe] fix header/target install * [tensorpipe] remove support of Windows/UWP * [tensorpipe] update baseline and port SHA * Update ports/tensorpipe/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update ports/tensorpipe/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * [tensorpipe] support 'test' feature for Linux * it will be helpful to check output binaries are valid * update code snapshot(2021/03/02) and port SHA * [tensorpipe] fix build failures in Linux * TC for 'ibv' failes * link with CMAKE_DL_LIBS for <dlfcn.h> * [tensorpipe] apply PR feedback * [tensorpipe] update version-date and patches * [tensorpipe] FATAL_ERROR if feature requires Linux * [tensorpipe] reduce features and code base * simplify features * fix `pybind11` build failures * updates source code base and CMake export file names * use GNUInstallDirs variable * [tensorpipe] update baseline * [tensorpipe] update support * use more correct "support" exporession * [tensorpipe] fix Linux/CUDA test options * [tensorpipe] fix corrupted patch * [tensorpipe] fix wrong support expression Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
-rw-r--r--ports/tensorpipe/fix-cmakelists.patch71
-rw-r--r--ports/tensorpipe/portfile.cmake45
-rw-r--r--ports/tensorpipe/support-pybind11.patch30
-rw-r--r--ports/tensorpipe/support-test.patch39
-rw-r--r--ports/tensorpipe/vcpkg.json39
-rw-r--r--versions/baseline.json4
-rw-r--r--versions/t-/tensorpipe.json9
7 files changed, 237 insertions, 0 deletions
diff --git a/ports/tensorpipe/fix-cmakelists.patch b/ports/tensorpipe/fix-cmakelists.patch
new file mode 100644
index 000000000..172ac1e67
--- /dev/null
+++ b/ports/tensorpipe/fix-cmakelists.patch
@@ -0,0 +1,71 @@
+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)
diff --git a/ports/tensorpipe/portfile.cmake b/ports/tensorpipe/portfile.cmake
new file mode 100644
index 000000000..d6e941d72
--- /dev/null
+++ b/ports/tensorpipe/portfile.cmake
@@ -0,0 +1,45 @@
+vcpkg_fail_port_install(ON_TARGET "windows" "uwp")
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO pytorch/tensorpipe
+ REF c5a21994bc766659f7f85edb75478e13f429f46c
+ SHA512 05a3989286610edea2f0fcfb9197c563e947f0386f2b52110dd060053d68b62477fcd4778a45a3030b9a53b6ceccead91e4dd96c9f0153023e97414459fbd8dd
+ PATCHES
+ fix-cmakelists.patch
+ support-test.patch
+ support-pybind11.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
+)
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_cmake_config_fixup()
+
+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
+)
diff --git a/ports/tensorpipe/support-pybind11.patch b/ports/tensorpipe/support-pybind11.patch
new file mode 100644
index 000000000..7a87cd285
--- /dev/null
+++ b/ports/tensorpipe/support-pybind11.patch
@@ -0,0 +1,30 @@
+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})
diff --git a/ports/tensorpipe/support-test.patch b/ports/tensorpipe/support-test.patch
new file mode 100644
index 000000000..16c54ab37
--- /dev/null
+++ b/ports/tensorpipe/support-test.patch
@@ -0,0 +1,39 @@
+diff --git a/tensorpipe/test/CMakeLists.txt b/tensorpipe/test/CMakeLists.txt
+index c0320aa..1414bdd 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)
+ channel/cuda_ipc/cuda_ipc_test.cc
+ )
+ endif()
+-
+- target_sources(tensorpipe_test PRIVATE
+- channel/cuda_gdr/cuda_gdr_test.cc
+- )
++ if(TP_ENABLE_CUDA_GDR)
++ target_sources(tensorpipe_test PRIVATE
++ channel/cuda_gdr/cuda_gdr_test.cc
++ )
++ endif()
+ endif()
+
+
diff --git a/ports/tensorpipe/vcpkg.json b/ports/tensorpipe/vcpkg.json
new file mode 100644
index 000000000..82971d8ad
--- /dev/null
+++ b/ports/tensorpipe/vcpkg.json
@@ -0,0 +1,39 @@
+{
+ "name": "tensorpipe",
+ "version-date": "2021-04-26",
+ "description": "A tensor-aware point-to-point communication primitive for machine learning",
+ "homepage": "https://github.com/pytorch/tensorpipe",
+ "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"
+ ]
+ }
+ }
+}
diff --git a/versions/baseline.json b/versions/baseline.json
index 75e404944..f5918e86d 100644
--- a/versions/baseline.json
+++ b/versions/baseline.json
@@ -5964,6 +5964,10 @@
"baseline": "2.4.1",
"port-version": 1
},
+ "tensorpipe": {
+ "baseline": "2021-04-26",
+ "port-version": 0
+ },
"termcolor": {
"baseline": "2.0.0",
"port-version": 0
diff --git a/versions/t-/tensorpipe.json b/versions/t-/tensorpipe.json
new file mode 100644
index 000000000..534b63696
--- /dev/null
+++ b/versions/t-/tensorpipe.json
@@ -0,0 +1,9 @@
+{
+ "versions": [
+ {
+ "git-tree": "ab0e7e22e13c4ebe8c308008aaabb803dca57cdc",
+ "version-date": "2021-04-26",
+ "port-version": 0
+ }
+ ]
+}