Build PyTorch without AVX/AVX2 or CUDA for old systems

C++ torch.compile deployment
Hey everyone,
I’ve been trying to see how old of a device you could actually build PyTorch on, I have a dozen apple mac desktops from 2009 with intel core2 quads and would like to run an llm exo cluster on them (just for fun he thought, foolishly :joy:).
I wrote a short script to help make the build process repeatable, but the build process keeps failing with diverse dependencies issues and failed tests, my best attempt at a functioning set of commands is joined below.

The problem at hand is that those old cpus don’t even support AVX nor AVX2 (cuda is just not required by the lack of GPU), and to make exo run, you need PyTorch >= 2.0.0.
I have found instructions on an old post for an even older version of PyTorch here, but this process obviously doesn’t work for 2.0 and above.
I’d appreciate any input on that matter!

Here is my script currently, (and error log pastebin below), I’m running Ubuntu Server 24.01:

VERSION=2.0.0

# Dependencies

apt install libopenblas-dev cmake -y
apt install python3-typing-extensions python3-numpy -y
apt install intel-mkl-full -y
apt install python3-pip -y
apt install python3-typing-extensions python3-numpy -y

# Download

wget https://github.com/pytorch/pytorch/archive/refs/tags/v2.0.0.tar.gz
tar -xvzf v2.0.0.tar.gz >> /dev/null
rm v2.0.0.tar.gz

cd pytorch-2.0.0

git submodule deinit -f .
git submodule sync --recursive
git submodule update --init --recursive

mkdir build && cd build

# Are those env variables even useful??

export MKLROOT=/opt/intel/mkl
export LD_LIBRARY_PATH=$MKLROOT/lib/intel64:$LD_LIBRARY_PATH
export CMAKE_PREFIX_PATH=$MKLROOT
export BLAS=MKL
export USE_MKLDNN=OFF

# Start build

cmake -DCMAKE_BUILD_TYPE=Release \
      -DUSE_CUDA=OFF \
      -DUSE_NNPACK=OFF \
      -DUSE_MKLDNN=OFF \
      -DCMAKE_C_FLAGS="-mno-avx -mno-avx2" \
      -DCMAKE_CXX_FLAGS="-mno-avx -mno-avx2" \
      ..

make -j4
sudo make install
sudo ldconfig

ERROR LOG: here