mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 13:49:23 -05:00
gnu: Add python-pytorch-for-r-torch.
* gnu/packages/patches/python-pytorch-1.9.0-system-libraries.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/machine-learning.scm (python-pytorch-for-r-torch): New variable.
This commit is contained in:
parent
8b787eb929
commit
7b676317b3
3 changed files with 187 additions and 0 deletions
|
@ -1741,6 +1741,7 @@ dist_patch_DATA = \
|
|||
%D%/packages/patches/python-pytest-asyncio-python-3.8.patch \
|
||||
%D%/packages/patches/python-pytorch-runpath.patch \
|
||||
%D%/packages/patches/python-pytorch-system-libraries.patch \
|
||||
%D%/packages/patches/python-pytorch-1.9.0-system-libraries.patch \
|
||||
%D%/packages/patches/python-robotframework-source-date-epoch.patch \
|
||||
%D%/packages/patches/python-seaborn-kde-test.patch \
|
||||
%D%/packages/patches/python-seaborn-2690.patch \
|
||||
|
|
|
@ -3034,6 +3034,53 @@ (define-public python-pytorch
|
|||
Note: currently this package does not provide GPU support.")
|
||||
(license license:bsd-3)))
|
||||
|
||||
(define-public python-pytorch-for-r-torch
|
||||
(package
|
||||
(inherit python-pytorch)
|
||||
(name "python-pytorch")
|
||||
(version "1.9.0")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/pytorch/pytorch")
|
||||
(commit (string-append "v" version))
|
||||
(recursive? #t)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"0cznsh68hwk5761gv7iijb4g6jgjpvs3bbixwpzzmkbkbn2q96c1"))
|
||||
(patches (search-patches "python-pytorch-1.9.0-system-libraries.patch"
|
||||
"python-pytorch-runpath.patch"))
|
||||
(modules '((guix build utils)))
|
||||
(snippet
|
||||
'(begin
|
||||
;; XXX: Let's be clear: this package is a bundling fest. We
|
||||
;; delete as much as we can, but there's still a lot left.
|
||||
(for-each (lambda (directory)
|
||||
(delete-file-recursively
|
||||
(string-append "third_party/" directory)))
|
||||
'("benchmark" "cpuinfo" "eigen"
|
||||
|
||||
;; FIXME: QNNPACK (of which XNNPACK is a fork)
|
||||
;; needs these.
|
||||
;; "FP16" "FXdiv" "gemmlowp" "psimd"
|
||||
|
||||
"gloo" "googletest" "ios-cmake" "NNPACK"
|
||||
"onnx" "protobuf" "pthreadpool"
|
||||
"pybind11" "python-enum" "python-peachpy"
|
||||
"python-six" "tbb" "XNNPACK" "zstd"))
|
||||
|
||||
;; Adjust references to the onnx-optimizer headers.
|
||||
(substitute* "caffe2/onnx/backend.cc"
|
||||
(("onnx/optimizer/")
|
||||
"onnxoptimizer/"))))))
|
||||
(arguments
|
||||
(substitute-keyword-arguments (package-arguments python-pytorch)
|
||||
((#:phases phases '%standard-phases)
|
||||
`(modify-phases ,phases
|
||||
;; No module named 'onnx.optimizer'
|
||||
(delete 'sanity-check)))))))
|
||||
|
||||
(define-public python-hmmlearn
|
||||
(package
|
||||
(name "python-hmmlearn")
|
||||
|
|
139
gnu/packages/patches/python-pytorch-1.9.0-system-libraries.patch
Normal file
139
gnu/packages/patches/python-pytorch-1.9.0-system-libraries.patch
Normal file
|
@ -0,0 +1,139 @@
|
|||
Use our own googletest rather than the bundled one.
|
||||
Get NNPACK to use our own PeachPy rather than the bundled one.
|
||||
|
||||
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
|
||||
index 5d57b9ca78..620cca4e60 100644
|
||||
--- a/cmake/Dependencies.cmake
|
||||
+++ b/cmake/Dependencies.cmake
|
||||
@@ -644,11 +644,6 @@ if(BUILD_TEST OR BUILD_MOBILE_BENCHMARK OR BUILD_MOBILE_TEST)
|
||||
# this shouldn't be necessary anymore.
|
||||
get_property(INC_DIR_temp DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
|
||||
set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "")
|
||||
- add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/googletest)
|
||||
- set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES ${INC_DIR_temp})
|
||||
-
|
||||
- include_directories(BEFORE SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../third_party/googletest/googletest/include)
|
||||
- include_directories(BEFORE SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../third_party/googletest/googlemock/include)
|
||||
|
||||
# We will not need to test benchmark lib itself.
|
||||
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable benchmark testing as we don't need it.")
|
||||
@@ -1485,7 +1480,7 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
|
||||
endif()
|
||||
set_property(TARGET onnx_proto PROPERTY IMPORTED_LOCATION ${ONNX_PROTO_LIBRARY})
|
||||
message("-- Found onnx: ${ONNX_LIBRARY} ${ONNX_PROTO_LIBRARY}")
|
||||
- list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx)
|
||||
+ list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx onnx_optimizer)
|
||||
endif()
|
||||
include_directories(${FOXI_INCLUDE_DIRS})
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS foxi_loader)
|
||||
|
||||
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
|
||||
index 50ebb224ce..5953d9ddf7 100644
|
||||
--- a/caffe2/CMakeLists.txt
|
||||
+++ b/caffe2/CMakeLists.txt
|
||||
@@ -1632,7 +1632,7 @@ if(BUILD_TEST)
|
||||
if(NOT MSVC)
|
||||
add_executable(${test_name}_${CPU_CAPABILITY} "${test_src}" ../aten/src/ATen/native/quantized/affine_quantizer_base.cpp)
|
||||
# TODO: Get rid of c10 dependency (which is only needed for the implementation of AT_ERROR)
|
||||
- target_link_libraries(${test_name}_${CPU_CAPABILITY} c10 sleef gtest_main)
|
||||
+ target_link_libraries(${test_name}_${CPU_CAPABILITY} c10 sleef gtest_main gtest)
|
||||
if(USE_FBGEMM)
|
||||
target_link_libraries(${test_name}_${CPU_CAPABILITY} fbgemm)
|
||||
endif()
|
||||
@@ -1655,7 +1655,7 @@ if(BUILD_TEST)
|
||||
foreach(test_src ${Caffe2_CPU_TEST_SRCS})
|
||||
get_filename_component(test_name ${test_src} NAME_WE)
|
||||
add_executable(${test_name} "${test_src}")
|
||||
- target_link_libraries(${test_name} torch_library gtest_main)
|
||||
+ target_link_libraries(${test_name} torch_library gtest_main gtest)
|
||||
target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>)
|
||||
target_include_directories(${test_name} PRIVATE $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
|
||||
target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE})
|
||||
@@ -1673,7 +1673,7 @@ if(BUILD_TEST)
|
||||
foreach(test_src ${Caffe2_GPU_TEST_SRCS})
|
||||
get_filename_component(test_name ${test_src} NAME_WE)
|
||||
cuda_add_executable(${test_name} "${test_src}")
|
||||
- target_link_libraries(${test_name} torch_library gtest_main)
|
||||
+ target_link_libraries(${test_name} torch_library gtest_main gtest)
|
||||
target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>)
|
||||
target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE})
|
||||
add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>)
|
||||
@@ -1691,7 +1691,7 @@ if(BUILD_TEST)
|
||||
foreach(test_src ${Caffe2_VULKAN_TEST_SRCS})
|
||||
get_filename_component(test_name ${test_src} NAME_WE)
|
||||
add_executable(${test_name} "${test_src}")
|
||||
- target_link_libraries(${test_name} torch_library gtest_main)
|
||||
+ target_link_libraries(${test_name} torch_library gtest_main gtest)
|
||||
target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>)
|
||||
target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE})
|
||||
add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>)
|
||||
@@ -1709,7 +1709,7 @@ if(BUILD_TEST)
|
||||
foreach(test_src ${Caffe2_HIP_TEST_SRCS})
|
||||
get_filename_component(test_name ${test_src} NAME_WE)
|
||||
add_executable(${test_name} "${test_src}")
|
||||
- target_link_libraries(${test_name} torch_library gtest_main)
|
||||
+ target_link_libraries(${test_name} torch_library gtest_main gtest)
|
||||
target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>)
|
||||
target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE} ${Caffe2_HIP_INCLUDE})
|
||||
target_compile_options(${test_name} PRIVATE ${HIP_CXX_FLAGS})
|
||||
|
||||
diff --git a/torch/lib/c10d/test/CMakeLists.txt b/torch/lib/c10d/test/CMakeLists.txt
|
||||
index b74d4b65f7..fc7c207505 100644
|
||||
--- a/torch/lib/c10d/test/CMakeLists.txt
|
||||
+++ b/torch/lib/c10d/test/CMakeLists.txt
|
||||
@@ -16,24 +16,24 @@ function(c10d_add_test test_src)
|
||||
add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>)
|
||||
endfunction()
|
||||
|
||||
-c10d_add_test(FileStoreTest.cpp c10d gtest_main)
|
||||
-c10d_add_test(TCPStoreTest.cpp c10d gtest_main)
|
||||
+c10d_add_test(FileStoreTest.cpp c10d gtest_main gtest)
|
||||
+c10d_add_test(TCPStoreTest.cpp c10d gtest_main gtest)
|
||||
if(NOT WIN32)
|
||||
- c10d_add_test(HashStoreTest.cpp c10d gtest_main)
|
||||
+ c10d_add_test(HashStoreTest.cpp c10d gtest_main gtest)
|
||||
endif()
|
||||
|
||||
if(USE_CUDA)
|
||||
if(USE_C10D_GLOO)
|
||||
- c10d_add_test(ProcessGroupGlooTest.cpp c10d c10d_cuda_test gtest_main)
|
||||
- c10d_add_test(ProcessGroupGlooAsyncTest.cpp c10d c10d_cuda_test gtest_main)
|
||||
+ c10d_add_test(ProcessGroupGlooTest.cpp c10d c10d_cuda_test gtest_main gtest)
|
||||
+ c10d_add_test(ProcessGroupGlooAsyncTest.cpp c10d c10d_cuda_test gtest_main gtest)
|
||||
endif()
|
||||
if(USE_C10D_NCCL)
|
||||
- c10d_add_test(ProcessGroupNCCLTest.cpp c10d c10d_cuda_test gtest_main)
|
||||
+ c10d_add_test(ProcessGroupNCCLTest.cpp c10d c10d_cuda_test gtest_main gtest)
|
||||
c10d_add_test(ProcessGroupNCCLErrorsTest.cpp c10d c10d_cuda_test
|
||||
- gtest_main)
|
||||
+ gtest_main gtest)
|
||||
endif()
|
||||
else()
|
||||
if(USE_C10D_GLOO)
|
||||
- c10d_add_test(ProcessGroupGlooTest.cpp c10d gtest_main)
|
||||
+ c10d_add_test(ProcessGroupGlooTest.cpp c10d gtest_main gtest)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
diff --git a/cmake/External/nnpack.cmake b/cmake/External/nnpack.cmake
|
||||
index a41343cbb5..6075bdd0a4 100644
|
||||
--- a/cmake/External/nnpack.cmake
|
||||
+++ b/cmake/External/nnpack.cmake
|
||||
@@ -40,7 +40,7 @@ endif()
|
||||
# (3) Android, iOS, Linux, macOS - supported
|
||||
##############################################################################
|
||||
|
||||
-if(ANDROID OR IOS OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
+if(FALSE)
|
||||
message(STATUS "Brace yourself, we are building NNPACK")
|
||||
set(CAFFE2_THIRD_PARTY_ROOT ${PROJECT_SOURCE_DIR}/third_party)
|
||||
|
||||
@@ -114,6 +114,5 @@ endif()
|
||||
# (4) Catch-all: not supported.
|
||||
##############################################################################
|
||||
|
||||
-message(WARNING "Unknown platform - I don't know how to build NNPACK. "
|
||||
- "See cmake/External/nnpack.cmake for details.")
|
||||
-set(USE_NNPACK OFF)
|
||||
+set(NNPACK_FOUND TRUE)
|
||||
+set(USE_NNPACK ON)
|
Loading…
Reference in a new issue