gpt4 book ai didi

macos - 无法在macOS 10.14上从源代码构建pytorch,以获得CUDA支持: “no member named ‘out_of_range’ in namespace ‘std’ ”

转载 作者:行者123 更新时间:2023-12-02 10:57:39 26 4
gpt4 key购买 nike

我正在遵循Pytorch网站的get started page的说明在Mac OS 10.14(Mojave)上构建具有CUDA支持的pytorch,但出现错误:

[ 80%] Building CXX object 
caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/alias_analysis.cpp.o
In file included from /Users/adriantineo/dev/python/pytorch/torch/csrc/jit/passes/alias_analysis.cpp:1:
In file included from /Users/adriantineo/dev/python/pytorch/torch/csrc/jit/passes/alias_analysis.h:3:
/Users/adriantineo/dev/python/pytorch/c10/util/flat_hash_map.h:1367:24: error: no
member named 'out_of_range' in namespace 'std'
throw std::out_of_range("Argument passed to at() was not in the map.");
~~~~~^
/Users/adriantineo/dev/python/pytorch/c10/util/flat_hash_map.h:1374:24: error: no
member named 'out_of_range' in namespace 'std'
throw std::out_of_range("Argument passed to at() was not in the map.");
~~~~~^
[ 80%] Building CXX object caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/batch_mm.cpp.o
[ 80%] Building CXX object caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/bailout_graph.cpp.o
[ 80%] Building CXX object caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/canonicalize.cpp.o
[ 80%] Building CXX object caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/constant_propagation.cpp.o
[ 80%] Building CXX object caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/constant_pooling.cpp.o
[ 81%] Building CXX object caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/common_subexpression_elimination.cpp.o
2 errors generated.
make[2]: *** [caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/alias_analysis.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [caffe2/CMakeFiles/torch.dir/all] Error 2
make: *** [all] Error 2
Traceback (most recent call last):
File "setup.py", line 749, in <module>
build_deps()
File "setup.py", line 323, in build_deps
cmake=cmake)
File "/Users/adriantineo/dev/python/pytorch/tools/build_pytorch_libs.py", line 64, in build_caffe2
cmake.build(my_env)
File "/Users/adriantineo/dev/python/pytorch/tools/setup_helpers/cmake.py", line 340, in build
self.run(build_args, my_env)
File "/Users/adriantineo/dev/python/pytorch/tools/setup_helpers/cmake.py", line 93, in run
check_call(command, cwd=self.build_dir, env=env)
File "/Users/adriantineo/anaconda3/lib/python3.7/subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '8']' returned non-zero exit status 2.

我已按照 prerequisites as stated in the documentation的步骤进行操作。我正在使用Anaconda 4.7.5,Python 3.7.3和CUDA Toolkit 10.1。

最重要的是,我正在为Xcode 8.2使用Xcode命令行工具,因为Xcode 10的工具给错误消息 fatal error: 'string.h' file not found带来了麻烦。我找到了使用旧版本Xcode命令行工具 here的技巧。

有关构建的更多信息:
-- ******** Summary ********
-- CMake version : 3.14.5
-- CMake command : /Users/adriantineo/anaconda3/bin/cmake
-- System : Darwin
-- C++ compiler : /Library/Developer/CommandLineTools/usr/bin/clang++
-- C++ compiler version : 8.0.0.8000042
-- CXX flags : -Wno-deprecated -fvisibility-inlines-hidden -Wno-deprecated-declarations -Wnon-virtual-dtor
-- Build type : Release
-- Compile definitions : TH_BLAS_MKL;ONNX_ML=1
-- CMAKE_PREFIX_PATH : /Users/adriantineo/anaconda3/lib/python3.7/site-packages
-- CMAKE_INSTALL_PREFIX : /Users/adriantineo/dev/python/pytorch/torch
-- CMAKE_MODULE_PATH : /Users/adriantineo/dev/python/pytorch/cmake/Modules;/Users/adriantineo/dev/python/pytorch/cmake/public/../Modules_CUDA_fix
--
-- ONNX version : 1.5.0
-- ONNX NAMESPACE : onnx_torch
-- ONNX_BUILD_TESTS : OFF
-- ONNX_BUILD_BENCHMARKS : OFF
-- ONNX_USE_LITE_PROTO : OFF
-- ONNXIFI_DUMMY_BACKEND : OFF
-- ONNXIFI_ENABLE_EXT : OFF
--
-- Protobuf compiler :
-- Protobuf includes :
-- Protobuf libraries :
-- BUILD_ONNX_PYTHON : OFF
--

[...]
--   USE_CUDA              : True
-- CUDA static link : OFF
-- USE_CUDNN : OFF
-- CUDA version : 10.1
-- CUDA root directory : /usr/local/cuda
-- CUDA library : /usr/local/cuda/lib/libcuda.dylib
-- cudart library : /usr/local/cuda/lib/libcudart.dylib
-- cublas library : /usr/local/cuda/lib/libcublas.dylib
-- cufft library : /usr/local/cuda/lib/libcufft.dylib
-- curand library : /usr/local/cuda/lib/libcurand.dylib
-- nvrtc : /usr/local/cuda/lib/libnvrtc.dylib
-- CUDA include path : /usr/local/cuda/include
-- NVCC executable : /usr/local/cuda/bin/nvcc
-- CUDA host compiler : /Library/Developer/CommandLineTools/usr/bin/clang

有任何技巧来解决构建问题吗?

最佳答案

Cuda驱动程序不适用于Mojave。 ta田

关于macos - 无法在macOS 10.14上从源代码构建pytorch,以获得CUDA支持: “no member named ‘out_of_range’ in namespace ‘std’ ”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57072639/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com