@@ -10,7 +10,20 @@ FEEDSIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
1010BENCHPRESS_ROOT=" $( readlink -f " $FEEDSIM_ROOT /../.." ) "
1111FEEDSIM_ROOT_SRC=" ${BENCHPRESS_ROOT} /benchmarks/feedsim"
1212FEEDSIM_THIRD_PARTY_SRC=" ${FEEDSIM_ROOT_SRC} /third_party"
13- LIBTORCH_VERSION=" 2.8.0"
13+ LIBTORCH_VERSION=" ${LIBTORCH_VERSION:- 2.13.0} "
14+ # When 1, fetch LibTorch by extracting it from the prebuilt torch CPU wheel
15+ # (download.pytorch.org/whl/cpu) instead of the libtorch-shared-with-deps zip.
16+ # Required for LibTorch >=2.9 (2.13.0 and later publish a wheel but no
17+ # standalone zip); harmless for older versions. Default 1 pairs with the
18+ # LIBTORCH_VERSION=2.13.0 default so the out-of-box install works without
19+ # additional env overrides.
20+ LIBTORCH_FROM_WHEEL=" ${LIBTORCH_FROM_WHEEL:- 1} "
21+ # Dependency versions are env-overridable so experiments can bump them without
22+ # forking this script; defaults reproduce the v2 baseline exactly.
23+ JEMALLOC_VERSION=" ${FEEDSIM_JEMALLOC_VERSION:- 5.3.0} "
24+ LIBEVENT_VERSION=" ${FEEDSIM_LIBEVENT_VERSION:- 2.1.12-stable} "
25+ # Export so the aarch64 sub-installer (dispatched below) inherits the pins.
26+ export LIBTORCH_VERSION LIBTORCH_FROM_WHEEL FEEDSIM_JEMALLOC_VERSION FEEDSIM_LIBEVENT_VERSION
1427DLRM_MODEL_URL=" https://github.com/facebookresearch/DCPerf-datasets/releases/download/feedsim-dlrm/dlrm_small.tar.gz"
1528echo " BENCHPRESS_ROOT is ${BENCHPRESS_ROOT} "
1629
@@ -45,7 +58,7 @@ dnf install -y bc ninja-build flex bison git texinfo binutils-devel \
4558 libsodium-devel libunwind-devel bzip2-devel double-conversion-devel \
4659 libzstd-devel lz4-devel xz-devel snappy-devel libtool bzip2 openssl-devel \
4760 zlib-devel libdwarf libdwarf-devel libaio-devel libatomic patch jq \
48- xxhash xxhash-devel unzip rsync liburing-devel
61+ xxhash xxhash-devel unzip rsync liburing-devel python3-pip
4962
5063# Creates feedsim directory under benchmarks/
5164mkdir -p " ${BENCHPRESS_ROOT} /benchmarks/feedsim"
@@ -178,30 +191,30 @@ else
178191fi
179192
180193# Installing JEMalloc
181- if ! [ -d " jemalloc-5.3.0 " ]; then
182- wget " https://github.com/jemalloc/jemalloc/releases/download/5.3.0 /jemalloc-5.3.0 .tar.bz2"
183- bunzip2 " jemalloc-5.3.0 .tar.bz2"
184- tar -xvf " jemalloc-5.3.0 .tar"
185- cd " jemalloc-5.3.0 "
194+ if ! [ -d " jemalloc-${JEMALLOC_VERSION} " ]; then
195+ wget " https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_VERSION} /jemalloc-${JEMALLOC_VERSION} .tar.bz2"
196+ bunzip2 " jemalloc-${JEMALLOC_VERSION} .tar.bz2"
197+ tar -xvf " jemalloc-${JEMALLOC_VERSION} .tar"
198+ cd " jemalloc-${JEMALLOC_VERSION} "
186199 ./configure --enable-prof --enable-prof-libunwind
187200 make -j" $( nproc) "
188201 make install
189202 cd ../
190203else
191- msg " [SKIPPED] jemalloc-5.3.0 "
204+ msg " [SKIPPED] jemalloc-${JEMALLOC_VERSION} "
192205fi
193206
194207# Installing libevent
195- if ! [ -d " libevent-2.1.12-stable " ]; then
196- wget " https://github.com/libevent/libevent/releases/download/release-2.1.12-stable /libevent-2.1.12-stable .tar.gz"
197- tar -xzf " libevent-2.1.12-stable .tar.gz"
198- cd " libevent-2.1.12-stable "
208+ if ! [ -d " libevent-${LIBEVENT_VERSION} " ]; then
209+ wget " https://github.com/libevent/libevent/releases/download/release-${LIBEVENT_VERSION} /libevent-${LIBEVENT_VERSION} .tar.gz"
210+ tar -xzf " libevent-${LIBEVENT_VERSION} .tar.gz"
211+ cd " libevent-${LIBEVENT_VERSION} "
199212 ./configure
200213 make -j" $( nproc) "
201214 make install
202215 cd ../
203216else
204- msg " [SKIPPED] libevent-2.1.12-stable "
217+ msg " [SKIPPED] libevent-${LIBEVENT_VERSION} "
205218fi
206219
207220msg " Installing third-party dependencies ... DONE"
@@ -218,12 +231,33 @@ else
218231fi
219232
220233if ! [ -d " libtorch" ]; then
221- msg " Downloading LibTorch ${LIBTORCH_VERSION} ..."
222- wget " ${LIBTORCH_URL} " -O libtorch.zip
223- msg " Extracting LibTorch..."
224- unzip -q libtorch.zip
225- rm libtorch.zip
226- msg " LibTorch installed to ${FEEDSIM_THIRD_PARTY_SRC} /libtorch"
234+ if [ " ${LIBTORCH_FROM_WHEEL} " = " 1" ]; then
235+ # Extract LibTorch from the prebuilt torch CPU wheel. The wheel's
236+ # torch/ dir has the same lib/ include/ share/cmake/Torch/ layout as
237+ # the standalone libtorch zip, so we just rename it to libtorch/.
238+ msg " Downloading LibTorch ${LIBTORCH_VERSION} from torch CPU wheel..."
239+ # pip on the box (3.9, or an internal stale mirror) can't see the cp310
240+ # 2.13 wheels, so resolve the wheel href straight from the PEP-503 index
241+ # and wget it. The C++ libtorch inside (torch/lib, torch/share/cmake) is
242+ # Python-version independent, so the cp310 wheel is fine for our C++ link.
243+ WHEEL_HREF=" $( curl -s " https://download.pytorch.org/whl/cpu/torch/" \
244+ | grep -oE " https://[^\" ]*torch-${LIBTORCH_VERSION} [^\" ]*cp310-cp310-manylinux_2_28_x86_64\.whl" \
245+ | head -1) "
246+ [ -n " ${WHEEL_HREF} " ] || die " Could not find torch ${LIBTORCH_VERSION} x86_64 wheel in index"
247+ msg " Wheel: ${WHEEL_HREF} "
248+ wget " ${WHEEL_HREF} " -O torch.whl
249+ unzip -q torch.whl -d ./_torch_whl_x
250+ mv ./_torch_whl_x/torch libtorch
251+ rm -rf ./_torch_whl_x torch.whl
252+ msg " LibTorch ${LIBTORCH_VERSION} extracted from wheel to ${FEEDSIM_THIRD_PARTY_SRC} /libtorch"
253+ else
254+ msg " Downloading LibTorch ${LIBTORCH_VERSION} ..."
255+ wget " ${LIBTORCH_URL} " -O libtorch.zip
256+ msg " Extracting LibTorch..."
257+ unzip -q libtorch.zip
258+ rm libtorch.zip
259+ msg " LibTorch installed to ${FEEDSIM_THIRD_PARTY_SRC} /libtorch"
260+ fi
227261else
228262 msg " [SKIPPED] LibTorch already installed"
229263fi
0 commit comments