2019-09-09 21:48:04 +00:00
|
|
|
Pod::Spec.new do |s|
|
|
|
|
|
s.name = 'LibTorch'
|
2023-09-10 19:08:15 +00:00
|
|
|
s.version = 'IOS_BUILD_VERSION'
|
2019-09-09 21:48:04 +00:00
|
|
|
s.authors = 'PyTorch Team'
|
|
|
|
|
s.license = { :type => 'BSD' }
|
|
|
|
|
s.homepage = 'https://github.com/pytorch/pytorch'
|
2019-09-25 19:12:52 +00:00
|
|
|
s.source = { :http => "https://ossci-ios.s3.amazonaws.com/libtorch_ios_#{s.version}.zip" }
|
2019-09-09 21:48:04 +00:00
|
|
|
s.summary = 'The PyTorch C++ library for iOS'
|
|
|
|
|
s.description = <<-DESC
|
|
|
|
|
The PyTorch C++ library for iOS.
|
|
|
|
|
DESC
|
2019-09-14 18:05:53 +00:00
|
|
|
s.ios.deployment_target = '12.0'
|
2019-09-09 21:48:04 +00:00
|
|
|
s.default_subspec = 'Core'
|
|
|
|
|
s.subspec 'Core' do |ss|
|
|
|
|
|
ss.dependency 'LibTorch/Torch'
|
2019-09-13 21:58:18 +00:00
|
|
|
ss.source_files = 'src/*.{h,cpp,c,cc}'
|
2019-09-09 21:48:04 +00:00
|
|
|
ss.public_header_files = ['src/LibTorch.h']
|
|
|
|
|
end
|
|
|
|
|
s.subspec 'Torch' do |ss|
|
|
|
|
|
ss.header_mappings_dir = 'install/include/'
|
2019-12-03 22:29:00 +00:00
|
|
|
ss.preserve_paths = 'install/include/**/*.{h,cpp,cc,c}'
|
2019-09-13 21:58:18 +00:00
|
|
|
ss.vendored_libraries = 'install/lib/*.a'
|
2019-09-09 21:48:04 +00:00
|
|
|
ss.libraries = ['c++', 'stdc++']
|
|
|
|
|
end
|
|
|
|
|
s.user_target_xcconfig = {
|
2019-12-03 22:29:00 +00:00
|
|
|
'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/LibTorch/install/include/"',
|
Split libtorch.so back into libtorch_{cpu,cuda,hip} (#30315)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30315
The new structure is that libtorch_cpu contains the bulk of our
code, and libtorch depends on libtorch_cpu and libtorch_cuda.
This is a reland of https://github.com/pytorch/pytorch/pull/29731 but
I've extracted all of the prep work into separate PRs which can be
landed before this one.
Some things of note:
* torch/csrc/cuda/nccl.cpp was added to the wrong list of SRCS, now fixed (this didn't matter before because previously they were all in the same library)
* The dummy file for libtorch was brought back from the dead; it was previously deleted in #20774
In an initial version of the patch, I forgot to make torch_cuda explicitly depend on torch_cpu. This lead to some very odd errors, most notably "bin/blob_test: hidden symbol `_ZNK6google8protobuf5Arena17OnArenaAllocationEPKSt9type_infom' in lib/libprotobuf.a(arena.cc.o) is referenced by DSO"
* A number of places in Android/iOS builds have to add torch_cuda explicitly as a library, as they do not have transitive dependency calculation working correctly
* I had to torch_cpu/torch_cuda caffe2_interface_library so that they get whole-archived linked into torch when you statically link. And I had to do this in an *exported* fashion because torch needs to depend on torch_cpu_library. In the end I exported everything and removed the redefinition in the Caffe2Config.cmake. However, I am not too sure why the old code did it in this way in the first place; however, it doesn't seem to have broken anything to switch it this way.
* There's some uses of `__HIP_PLATFORM_HCC__` still in `torch_cpu` code, so I had to apply it to that library too (UGH). This manifests as a failer when trying to run the CUDA fuser. This doesn't really matter substantively right now because we still in-place HIPify, but it would be good to fix eventually. This was a bit difficult to debug because of an unrelated HIP bug, see https://github.com/ROCm-Developer-Tools/HIP/issues/1706
Fixes #27215 (as our libraries are smaller), and executes on
part of the plan in #29235.
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: Imported from OSS
Differential Revision: D18790941
Pulled By: ezyang
fbshipit-source-id: 01296f6089d3de5e8365251b490c51e694f2d6c7
2019-12-04 16:03:10 +00:00
|
|
|
'OTHER_LDFLAGS' => '-force_load "$(PODS_ROOT)/LibTorch/install/lib/libtorch.a" -force_load "$(PODS_ROOT)/LibTorch/install/lib/libtorch_cpu.a"',
|
2024-09-24 02:03:33 +00:00
|
|
|
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
|
2019-09-09 21:48:04 +00:00
|
|
|
'CLANG_CXX_LIBRARY' => 'libc++'
|
|
|
|
|
}
|
2019-12-03 22:29:00 +00:00
|
|
|
s.pod_target_xcconfig = {
|
|
|
|
|
'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/LibTorch/install/include/"',
|
|
|
|
|
'VALID_ARCHS' => 'x86_64 arm64'
|
2019-09-13 21:58:18 +00:00
|
|
|
}
|
2019-09-09 21:48:04 +00:00
|
|
|
s.library = ['c++', 'stdc++']
|
2023-09-10 19:08:15 +00:00
|
|
|
s.frameworks = 'Accelerate', 'MetalPerformanceShaders', 'CoreML'
|
2019-11-05 22:48:50 +00:00
|
|
|
end
|