I want to run torch 1.11.0 on old machine equipped by AMD Phenom II N850 (no AVX / AVX2 / AVX 512). So, i decide to build torch from sources:
wget https://github.com/pytorch/pytorch/releases/download/v1.11.0/pytorch-v1.11.0.tar.gz && \
tar -xvzf pytorch-v1.11.0.tar.gz && rm pytorch-v1.11.0.tar.gz && \
cd pytorch-v1.11.0 && mkdir build && cd build && \
cmake -D CMAKE_BUILD_TYPE=Release \
-D C_HAS_AVX_2=OFF \
-D C_HAS_AVX2_2=OFF \
-D CXX_HAS_AVX_2=OFF \
-D CXX_HAS_AVX2_2=OFF \
-D CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS=OFF \
.. && \
make -j4 && \
sudo make install && \
sudo ldconfig
Building process successfully finishes. But in my test application, however, when inferences should be done, application crashes with OS-message:
Illegal instruction (core dumped)
So, what i am doing wrong? It seems fro me, that I do not properly disable all AVX-specfic flags at build time. Please help.
AMD Phenom II N850 specs, as reported by OS:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 3
On-line CPU(s) list: 0-2
Thread(s) per core: 1
Core(s) per socket: 3
Socket(s): 1
NUMA node(s): 1
Vendor ID: AuthenticAMD
CPU family: 16
Model: 5
Model name: AMD Phenom(tm) II N850 Triple-Core Processor
Stepping: 3
CPU MHz: 800.000
CPU max MHz: 2200,0000
CPU min MHz: 800,0000
BogoMIPS: 4389.27
Virtualization: AMD-V
L1d cache: 64K
L1i cache: 64K
L2 cache: 512K
NUMA node0 CPU(s): 0-2
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt nodeid_msr hw_pstate vmmcall npt lbrv svm_lock nrip_save
Finally I have found set of flags, that allows me to properly build torch for my hardware. So, I want to share with the community:
cmake -D CMAKE_BUILD_TYPE=Release \
-D USE_AVX=OFF \
-D USE_NNPACK=OFF \
-D USE_MKLDNN=OFF \
-D C_HAS_AVX_2=OFF \
-D C_HAS_AVX2_2=OFF \
-D CXX_HAS_AVX_2=OFF \
-D CXX_HAS_AVX2_2=OFF \
-D CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS=OFF \
..
1 Like