diff options
Diffstat (limited to 'gnu/packages/patches/python-pytorch-system-libraries.patch')
| -rw-r--r-- | gnu/packages/patches/python-pytorch-system-libraries.patch | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/gnu/packages/patches/python-pytorch-system-libraries.patch b/gnu/packages/patches/python-pytorch-system-libraries.patch new file mode 100644 index 00000000000..c8d14b3f566 --- /dev/null +++ b/gnu/packages/patches/python-pytorch-system-libraries.patch | |||
| @@ -0,0 +1,131 @@ | |||
| 1 | Use our own googletest rather than the bundled one. | ||
| 2 | Get NNPACK to use our own PeachPy rather than the bundled one. | ||
| 3 | |||
| 4 | diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake | ||
| 5 | index 5d57b9ca78..620cca4e60 100644 | ||
| 6 | --- a/cmake/Dependencies.cmake | ||
| 7 | +++ b/cmake/Dependencies.cmake | ||
| 8 | @@ -644,11 +644,6 @@ if(BUILD_TEST OR BUILD_MOBILE_BENCHMARK OR BUILD_MOBILE_TEST) | ||
| 9 | # this shouldn't be necessary anymore. | ||
| 10 | get_property(INC_DIR_temp DIRECTORY PROPERTY INCLUDE_DIRECTORIES) | ||
| 11 | set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "") | ||
| 12 | - add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/googletest) | ||
| 13 | - set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES ${INC_DIR_temp}) | ||
| 14 | - | ||
| 15 | - include_directories(BEFORE SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../third_party/googletest/googletest/include) | ||
| 16 | - include_directories(BEFORE SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../third_party/googletest/googlemock/include) | ||
| 17 | |||
| 18 | # We will not need to test benchmark lib itself. | ||
| 19 | set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable benchmark testing as we don't need it.") | ||
| 20 | @@ -1485,7 +1480,7 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX) | ||
| 21 | endif() | ||
| 22 | set_property(TARGET onnx_proto PROPERTY IMPORTED_LOCATION ${ONNX_PROTO_LIBRARY}) | ||
| 23 | message("-- Found onnx: ${ONNX_LIBRARY} ${ONNX_PROTO_LIBRARY}") | ||
| 24 | - list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx) | ||
| 25 | + list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx onnx_optimizer) | ||
| 26 | endif() | ||
| 27 | include_directories(${FOXI_INCLUDE_DIRS}) | ||
| 28 | list(APPEND Caffe2_DEPENDENCY_LIBS foxi_loader) | ||
| 29 | |||
| 30 | diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt | ||
| 31 | index 50ebb224ce..5953d9ddf7 100644 | ||
| 32 | --- a/caffe2/CMakeLists.txt | ||
| 33 | +++ b/caffe2/CMakeLists.txt | ||
| 34 | @@ -1632,7 +1632,7 @@ if(BUILD_TEST) | ||
| 35 | if(NOT MSVC) | ||
| 36 | add_executable(${test_name}_${CPU_CAPABILITY} "${test_src}" ../aten/src/ATen/native/quantized/affine_quantizer_base.cpp) | ||
| 37 | # TODO: Get rid of c10 dependency (which is only needed for the implementation of AT_ERROR) | ||
| 38 | - target_link_libraries(${test_name}_${CPU_CAPABILITY} c10 sleef gtest_main) | ||
| 39 | + target_link_libraries(${test_name}_${CPU_CAPABILITY} c10 sleef gtest_main gtest) | ||
| 40 | if(USE_FBGEMM) | ||
| 41 | target_link_libraries(${test_name}_${CPU_CAPABILITY} fbgemm) | ||
| 42 | endif() | ||
| 43 | @@ -1655,7 +1655,7 @@ if(BUILD_TEST) | ||
| 44 | foreach(test_src ${Caffe2_CPU_TEST_SRCS}) | ||
| 45 | get_filename_component(test_name ${test_src} NAME_WE) | ||
| 46 | add_executable(${test_name} "${test_src}") | ||
| 47 | - target_link_libraries(${test_name} torch_library gtest_main) | ||
| 48 | + target_link_libraries(${test_name} torch_library gtest_main gtest) | ||
| 49 | target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>) | ||
| 50 | target_include_directories(${test_name} PRIVATE $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>) | ||
| 51 | target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE}) | ||
| 52 | @@ -1673,7 +1673,7 @@ if(BUILD_TEST) | ||
| 53 | foreach(test_src ${Caffe2_GPU_TEST_SRCS}) | ||
| 54 | get_filename_component(test_name ${test_src} NAME_WE) | ||
| 55 | cuda_add_executable(${test_name} "${test_src}") | ||
| 56 | - target_link_libraries(${test_name} torch_library gtest_main) | ||
| 57 | + target_link_libraries(${test_name} torch_library gtest_main gtest) | ||
| 58 | target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>) | ||
| 59 | target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE}) | ||
| 60 | add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>) | ||
| 61 | @@ -1691,7 +1691,7 @@ if(BUILD_TEST) | ||
| 62 | foreach(test_src ${Caffe2_VULKAN_TEST_SRCS}) | ||
| 63 | get_filename_component(test_name ${test_src} NAME_WE) | ||
| 64 | add_executable(${test_name} "${test_src}") | ||
| 65 | - target_link_libraries(${test_name} torch_library gtest_main) | ||
| 66 | + target_link_libraries(${test_name} torch_library gtest_main gtest) | ||
| 67 | target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>) | ||
| 68 | target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE}) | ||
| 69 | add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>) | ||
| 70 | @@ -1709,7 +1709,7 @@ if(BUILD_TEST) | ||
| 71 | foreach(test_src ${Caffe2_HIP_TEST_SRCS}) | ||
| 72 | get_filename_component(test_name ${test_src} NAME_WE) | ||
| 73 | add_executable(${test_name} "${test_src}") | ||
| 74 | - target_link_libraries(${test_name} torch_library gtest_main) | ||
| 75 | + target_link_libraries(${test_name} torch_library gtest_main gtest) | ||
| 76 | target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>) | ||
| 77 | target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE} ${Caffe2_HIP_INCLUDE}) | ||
| 78 | target_compile_options(${test_name} PRIVATE ${HIP_CXX_FLAGS}) | ||
| 79 | |||
| 80 | diff --git a/torch/lib/c10d/test/CMakeLists.txt b/torch/lib/c10d/test/CMakeLists.txt | ||
| 81 | index b74d4b65f7..fc7c207505 100644 | ||
| 82 | --- a/torch/lib/c10d/test/CMakeLists.txt | ||
| 83 | +++ b/torch/lib/c10d/test/CMakeLists.txt | ||
| 84 | @@ -16,25 +16,25 @@ function(c10d_add_test test_src) | ||
| 85 | add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>) | ||
| 86 | endfunction() | ||
| 87 | |||
| 88 | -c10d_add_test(FileStoreTest.cpp c10d gtest_main) | ||
| 89 | -c10d_add_test(TCPStoreTest.cpp c10d gtest_main) | ||
| 90 | +c10d_add_test(FileStoreTest.cpp c10d gtest_main gtest) | ||
| 91 | +c10d_add_test(TCPStoreTest.cpp c10d gtest_main gtest) | ||
| 92 | if(NOT WIN32) | ||
| 93 | - c10d_add_test(HashStoreTest.cpp c10d gtest_main) | ||
| 94 | + c10d_add_test(HashStoreTest.cpp c10d gtest_main gtest) | ||
| 95 | endif() | ||
| 96 | |||
| 97 | if(USE_CUDA) | ||
| 98 | if(USE_C10D_GLOO) | ||
| 99 | - c10d_add_test(ProcessGroupGlooTest.cpp c10d c10d_cuda_test gtest_main) | ||
| 100 | - c10d_add_test(ProcessGroupGlooAsyncTest.cpp c10d c10d_cuda_test gtest_main) | ||
| 101 | + c10d_add_test(ProcessGroupGlooTest.cpp c10d c10d_cuda_test gtest_main gtest) | ||
| 102 | + c10d_add_test(ProcessGroupGlooAsyncTest.cpp c10d c10d_cuda_test gtest_main gtest) | ||
| 103 | endif() | ||
| 104 | if(USE_C10D_NCCL) | ||
| 105 | - c10d_add_test(ProcessGroupNCCLTest.cpp c10d c10d_cuda_test gtest_main) | ||
| 106 | + c10d_add_test(ProcessGroupNCCLTest.cpp c10d c10d_cuda_test gtest_main gtest) | ||
| 107 | c10d_add_test(ProcessGroupNCCLErrorsTest.cpp c10d c10d_cuda_test | ||
| 108 | - gtest_main) | ||
| 109 | + gtest_main gtest) | ||
| 110 | endif() | ||
| 111 | else() | ||
| 112 | if(USE_C10D_GLOO) | ||
| 113 | - c10d_add_test(ProcessGroupGlooTest.cpp c10d gtest_main) | ||
| 114 | + c10d_add_test(ProcessGroupGlooTest.cpp c10d gtest_main gtest) | ||
| 115 | endif() | ||
| 116 | endif() | ||
| 117 | |||
| 118 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| 119 | index 5ecd2df..24feae3 100644 | ||
| 120 | --- a/third_party/NNPACK/CMakeLists.txt | ||
| 121 | +++ b/third_party/NNPACK/CMakeLists.txt | ||
| 122 | @@ -427,8 +427,7 @@ IF(NNPACK_BACKEND STREQUAL "x86-64") | ||
| 123 | FILE(MAKE_DIRECTORY ${obj_dir}) | ||
| 124 | ADD_CUSTOM_COMMAND( | ||
| 125 | OUTPUT ${obj} | ||
| 126 | - COMMAND "PYTHONPATH=${PEACHPY_PYTHONPATH}" | ||
| 127 | - ${PYTHON_EXECUTABLE} -m peachpy.x86_64 | ||
| 128 | + COMMAND ${PYTHON_EXECUTABLE} -m peachpy.x86_64 | ||
| 129 | -mabi=sysv -g4 -mimage-format=${PEACHPY_IMAGE_FORMAT} | ||
| 130 | "-I${PROJECT_SOURCE_DIR}/src" "-I${PROJECT_SOURCE_DIR}/src/x86_64-fma" "-I${FP16_SOURCE_DIR}/include" | ||
| 131 | -o ${obj} "${PROJECT_SOURCE_DIR}/${src}" | ||
