Hello, I’m trying to build PyTorch from source with prepacked Metal backend as explained here but have following error building PyTorch
Python 3.8.5
cmake version 3.19.7
[ 69%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/aten/src/ATen/native/metal/MetalCommandBuffer.mm.o
[ 69%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/aten/src/ATen/native/metal/MetalConvParams.mm.o
[ 69%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/aten/src/ATen/native/metal/MetalGuardImpl.cpp.o
[ 69%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/aten/src/ATen/native/metal/MetalPrepackOpRegister.cpp.o
[ 70%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/aten/src/ATen/native/metal/MetalTensorImplStorage.mm.o
/pytorch/aten/src/ATen/native/metal/MetalCommandBuffer.mm:8:1: error: cannot synthesize weak property
in file using manual reference counting
@implementation MetalCommandBuffer {
^
/pytorch/aten/src/ATen/native/metal/MetalCommandBuffer.h:6:48: note: property declared here
@property(nonatomic, weak, readonly) NSThread* thread;
^
1 error generated.
make[2]: *** [caffe2/CMakeFiles/torch_cpu.dir/__/aten/src/ATen/native/metal/MetalCommandBuffer.mm.o] Error 1
make[2]: *** Waiting for unfinished jobs....
324 warnings generated.
make[1]: *** [caffe2/CMakeFiles/torch_cpu.dir/all] Error 2
make: *** [all] Error 2
Traceback (most recent call last):
File "setup.py", line 876, in <module>
build_deps()
File "setup.py", line 354, in build_deps
build_caffe2(version=version,
File "/pytorch/tools/build_pytorch_libs.py", line 58, in build_caffe2
cmake.build(my_env)
File "l/pytorch/tools/setup_helpers/cmake.py", line 345, in build
self.run(build_args, my_env)
File "/pytorch/tools/setup_helpers/cmake.py", line 140, in run
check_call(command, cwd=self.build_dir, env=env)
File "/opt/anaconda3/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '8']' returned non-zero exit status 2.