【问题标题】:PyTorch: Build from source with TBB failedPyTorch:使用 TBB 从源代码构建失败
【发布时间】:2021-06-08 07:37:34
【问题描述】:

我正在尝试使用 TBB 而不是 OpenMP 从源代码构建 PyTorch,但我每次都收到以下错误:

    /usr/bin/ld: <PATH>/pytorch/build/lib/libtorch_cpu.so: undefined reference to `omp_get_max_threads'
    /usr/bin/ld: <PATH>/pytorch/build/lib/libtorch_cpu.so: undefined reference to `omp_get_num_threads'
    /usr/bin/ld: <PATH>/pytorch/build/lib/libtorch_cpu.so: undefined reference to `GOMP_barrier'
    /usr/bin/ld: <PATH>/pytorch/build/lib/libtorch_cpu.so: undefined reference to `GOMP_parallel'
    /usr/bin/ld: <PATH>/pytorch/build/lib/libtorch_cpu.so: undefined reference to `omp_in_parallel'
    /usr/bin/ld: <PATH>/pytorch/build/lib/libtorch_cpu.so: undefined reference to `omp_get_thread_num'
    collect2: error: ld returned 1 exit status
    make[2]: *** [caffe2/CMakeFiles/kernel_function_legacy_test.dir/build.make:109: bin/kernel_function_legacy_test] Error 1

你可以找到完整的日志文件HERE:

复制

重现行为的步骤:

  1. git clone https://github.com/pytorch/pytorch
  2. cd pytorch
  3. ATEN_THREADING=TBB BUILD_BINARY=1 USE_EIGEN_THREADPOOL=1 USE_CUDA=0 PARALLEL_BACKEND=NATIVE_TBB USE_OPENMP=0 USE_TBB=1 MKL_THREADING=TBB BLAS=MKL USE_MKLDNN=1 MKLDNN_THREADING=TBB BUILD_BINARY=1 python setup.py build --cmake 2&gt;&amp;1 | tee ~/output.txt
  • PyTorch 版本(例如 1.0):1.10.0a0+git1798ff0
  • 操作系统(例如 Linux):Manjaro
  • 如何安装 PyTorch(conda,pip,来源):pip
  • Python 版本:3.9.5
  • CUDA/cuDNN 版本:否
  • GPU 型号和配置:否

【问题讨论】:

    标签: python build pytorch openmp tbb


    【解决方案1】:

    Caffe2 CMake 文件似乎存在问题。 您是否尝试过将 CMake 更新到最新版本。

    可以在 github 上找到类似的问题。通过升级 cmake 解决了问题。

    https://github.com/pytorch/pytorch/issues/8370

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-02-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-17
      • 1970-01-01
      • 2019-06-26
      相关资源
      最近更新 更多