summaryrefslogtreecommitdiff
path: root/packaging/pytorch.spec
blob: 77c2975ea1f1ffc479207c7b785ab4103dd26f06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
Name:		pytorch
Summary:	PyTorch
Version:	1.10.2
Release:	1
License:	BSD-3-Clause and Apache-2.0

Source0:	%{name}-%{version}.tar.gz
Source1001:	pytorch.manifest
Source1002:	pytorch.pc.in

Source10001: benchmark.tar.gz
Source10002: breakpad.tar.gz
Source10003: cpuinfo.tar.gz
Source10004: cub.tar.gz
Source10005: cudnn_frontend.tar.gz
Source10006: eigen.tar.gz
Source10007: fbgemm.tar.gz
Source10008: fmt.tar.gz
Source10009: foxi.tar.gz
Source10010: FP16.tar.gz
Source10011: FXdiv.tar.gz
Source10012: gemmlowp.tar.gz
Source10013: gloo.tar.gz
Source10014: googletest.tar.gz
Source10015: ideep.tar.gz
Source10016: ios-cmake.tar.gz
Source10017: kineto.tar.gz
Source10018: miniz-2.0.8.tar.gz
Source10019: nccl.tar.gz
Source10020: neon2sse.tar.gz
Source10021: NNPACK.tar.gz
Source10022: onnx.tar.gz
Source10023: onnx-tensorrt.tar.gz
Source10024: pocketfft.tar.gz
Source10025: protobuf.tar.gz
Source10026: psimd.tar.gz
Source10027: pthreadpool.tar.gz
Source10028: pybind11.tar.gz
Source10029: python-enum.tar.gz
Source10030: python-peachpy.tar.gz
Source10031: python-six.tar.gz
Source10032: QNNPACK.tar.gz
Source10033: sleef.tar.gz
Source10034: tbb.tar.gz
Source10035: tensorflow_cuda_bazel_build.tar.gz
Source10036: tensorpipe.tar.gz
Source10037: valgrind-headers.tar.gz
Source10038: XNNPACK.tar.gz
Source10039: zstd.tar.gz
Patch0: 0001-Local-Fix-build-breaks-on-Tizen-GCC-13.patch
BuildRequires:	cmake
BuildRequires:  ninja
BuildRequires:	openblas-devel
BuildRequires:	python3
BuildRequires:	python3-devel
BuildRequires:	python3-numpy-devel
BuildRequires:	python3-PyYAML
BuildRequires:	protobuf-devel
BuildRequires:	libyaml-devel

# Appears to support 64bit only
ExclusiveArch:	x86_64 aarch64

%description
PyTorch is a Python package that provides two high-level features:
Tensor computation (like NumPy) with strong GPU acceleration
Deep neural networks built on a tape-based autograd system
You can reuse your favorite Python packages such as NumPy, SciPy and Cython to extend PyTorch when needed.

%prep
%setup -q
%patch0 -p1
cp %{SOURCE1001} .

mkdir -p third_party
tar -xf %SOURCE10001 -C third_party/
tar -xf %SOURCE10002 -C third_party/
tar -xf %SOURCE10003 -C third_party/
tar -xf %SOURCE10004 -C third_party/
tar -xf %SOURCE10005 -C third_party/
tar -xf %SOURCE10006 -C third_party/
tar -xf %SOURCE10007 -C third_party/
tar -xf %SOURCE10008 -C third_party/
tar -xf %SOURCE10009 -C third_party/
tar -xf %SOURCE10010 -C third_party/
tar -xf %SOURCE10011 -C third_party/
tar -xf %SOURCE10012 -C third_party/
tar -xf %SOURCE10013 -C third_party/
tar -xf %SOURCE10014 -C third_party/
tar -xf %SOURCE10015 -C third_party/
tar -xf %SOURCE10016 -C third_party/
tar -xf %SOURCE10017 -C third_party/
tar -xf %SOURCE10018 -C third_party/
tar -xf %SOURCE10019 -C third_party/
tar -xf %SOURCE10020 -C third_party/
tar -xf %SOURCE10021 -C third_party/
tar -xf %SOURCE10022 -C third_party/
tar -xf %SOURCE10023 -C third_party/
tar -xf %SOURCE10024 -C third_party/
tar -xf %SOURCE10025 -C third_party/
tar -xf %SOURCE10026 -C third_party/
tar -xf %SOURCE10027 -C third_party/
tar -xf %SOURCE10028 -C third_party/
tar -xf %SOURCE10029 -C third_party/
tar -xf %SOURCE10030 -C third_party/
tar -xf %SOURCE10031 -C third_party/
tar -xf %SOURCE10032 -C third_party/
tar -xf %SOURCE10033 -C third_party/
tar -xf %SOURCE10034 -C third_party/
tar -xf %SOURCE10035 -C third_party/
tar -xf %SOURCE10036 -C third_party/
tar -xf %SOURCE10037 -C third_party/
tar -xf %SOURCE10038 -C third_party/
tar -xf %SOURCE10039 -C third_party/

%build
export PYTHON_EXECUTABLE=/usr/bin/python3
export PYTHONPATH="$PYTHONPATH:./packaging/python_module"

mkdir -p build
pushd build
alias python=python3
CFLAGS=`echo $CFLAGS | sed -e "s|-Wall|-Wall -Wno-unused-function -Wno-array-parameter -Wno-missing-braces -Wno-nonnull|"`
CXXFLAGS=`echo $CXXFLAGS | sed -e "s|-Wall|-Wall -Wno-unused-function -Wno-array-parameter -Wno-missing-braces -Wno-nonnull|"`
cmake .. \
  -DCMAKE_INSTALL_PREFIX=./install \
  -DCMAKE_VERBOSE_MAKEFILE=1 \
  -DBUILD_BINARY=OFF \
  -DBUILD_CUSTOM_PROTOBUF=OFF \
  -DBUILD_PYTHON=OFF \
  -DUSE_CUDA=OFF \
  -DUSE_MPI=OFF \
  -DUSE_NCCL=OFF \
  -DUSE_METAL=OFF \
  -DUSE_NUMA=OFF \
  -DPYTHON_EXECUTABLE=/usr/bin/python3 \
  -DUSE_NUMPY=OFF \
  -DUSE_MKLDNN=OFF \
  -DUSE_FBGEMM=OFF \
  -DUSE_DISTRIBUTED=OFF

cmake --build . --target install %{?_smp_mflags}

popd

%install
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_libdir}/pkgconfig
mkdir -p %{buildroot}%{_includedir}

# install built shared libs
cp ./build/lib/*.so %{buildroot}%{_libdir}/

# install include files
cp -r ./build/install/include/* %{buildroot}%{_includedir}/

# install pc file
cp %{SOURCE1002} .
sed -i 's:@libdir@:%{_libdir}:g' ./pytorch.pc.in
sed -i 's:@includedir@:%{_includedir}:g' ./pytorch.pc.in
install -m 0644 -p pytorch.pc.in %{buildroot}%{_libdir}/pkgconfig/pytorch.pc

%post -p %{_sbindir}/ldconfig
%postun -p %{_sbindir}/ldconfig

%package devel
Summary:	PyTorch Development Package

%description devel
PyTorch development files

%files devel
%manifest pytorch.manifest
%license LICENSE
%{_libdir}/pkgconfig/pytorch.pc
%{_libdir}/*.so
%{_includedir}/*

%changelog
* Fri Feb 4 2022 Yongjoo Ahn <yongjoo1.ahn@samsung.com>
 - Initial Tizen package to use PyTorch v1.10.2