|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +export SPACK_COMPILER_WRAPPER_PATH="$PWD" |
| 4 | +export SPACK_DEBUG_LOG_DIR="/tmp" |
| 5 | +export SPACK_DEBUG_LOG_ID="bench" |
| 6 | +export SPACK_SHORT_SPEC="py-torch@2.11.0%gcc@14.2.0 arch=linux-ubuntu24.04-aarch64" |
| 7 | +export SPACK_SYSTEM_DIRS="/usr/*|/lib/*" |
| 8 | +export SPACK_CXX="true" |
| 9 | +export SPACK_CC="true" |
| 10 | +export SPACK_FC="true" |
| 11 | +export SPACK_F77="true" |
| 12 | +export SPACK_CC_LINKER_ARG="-Wl," |
| 13 | +export SPACK_CC_RPATH_ARG="-Wl,-rpath," |
| 14 | +export SPACK_CXX_LINKER_ARG="-Wl," |
| 15 | +export SPACK_CXX_RPATH_ARG="-Wl,-rpath," |
| 16 | +export SPACK_FC_LINKER_ARG="-Wl," |
| 17 | +export SPACK_FC_RPATH_ARG="-Wl,-rpath," |
| 18 | +export SPACK_F77_LINKER_ARG="-Wl," |
| 19 | +export SPACK_F77_RPATH_ARG="-Wl,-rpath," |
| 20 | +export SPACK_CXX_HAS_FRANDOM_SEED=true |
| 21 | +export SPACK_DTAGS_TO_ADD="--enable-new-dtags" |
| 22 | +export SPACK_DTAGS_TO_STRIP="--disable-new-dtags" |
| 23 | + |
| 24 | +_P="/home/software/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeh/linux-aarch64" |
| 25 | + |
| 26 | +export SPACK_MANAGED_DIRS="$_P/*" |
| 27 | + |
| 28 | +# Hash generator: produces a fake 32-char hex from an index. |
| 29 | +_h() { |
| 30 | + printf '%032x' "$1" |
| 31 | +} |
| 32 | + |
| 33 | +# Build large dependency lists to stress the wrapper. |
| 34 | +_store_pkgs="python-3.13.2 py-numpy-2.4.1 py-setuptools-80.7.1 py-pyyaml-6.0.2 openblas-0.3.33 cuda-12.9.1 py-pip-24.2 py-wheel-0.43.0 py-cython-3.0.11 py-pybind11-2.13.6 py-typing-extensions-4.12.2 py-sympy-1.13.3 py-mpmath-1.3.0 py-filelock-3.16.1 py-jinja2-3.1.4 py-markupsafe-2.1.5 py-networkx-3.4.2 py-fsspec-2024.10.0 py-packaging-24.1 py-six-1.16.0 zlib-ng-2.2.2 bzip2-1.0.8 xz-5.4.6 zstd-1.5.6 openssl-3.3.2 sqlite-3.46.1 ncurses-6.5 readline-8.2 libffi-3.4.6 expat-2.6.4 gdbm-1.24 util-linux-uuid-2.40.2 tar-1.35 gettext-0.22.5 libiconv-1.17 pcre2-10.44 ca-certificates-2024 cmake-3.31.0 ninja-1.12.1" |
| 35 | + |
| 36 | +_dep_pkgs="libxfixes-6.0.1 libxdamage-1.1.6 libxshmfence-1.3.2 libxxf86vm-1.1.5 libxcursor-1.2.3 libxcomposite-0.4.6 libxinerama-1.1.5 libxrandr-1.5.4 libxrender-0.9.11 libxext-1.3.6 libxi-1.8.2 libxtst-1.2.5 libxkbcommon-1.7.0 libxkbfile-1.1.3 libxmu-1.2.1 libxt-1.3.0 libxaw-1.0.16 libxpm-3.5.17 libxft-2.3.8 libxss-1.2.4 libx11-1.8.10 libxcb-1.17.0 libxau-1.0.11 libxdmcp-1.1.5 libxres-1.2.2 libxv-1.0.12 libxvmc-1.0.14 libpciaccess-0.18.1 libdrm-2.4.123 mesa-24.2.5 libglvnd-1.7.0 libglx-1.7.0 libegl-1.7.0 libgles-1.7.0 wayland-1.23.1 xorgproto-2024.1 xtrans-1.5.1 fontconfig-2.15.0 freetype-2.13.3 harfbuzz-10.0.1 libpng-1.6.44 libjpeg-turbo-3.0.4 libtiff-4.7.0 libwebp-1.4.0 giflib-5.2.2 librsvg-2.59.0 cairo-1.18.2 pixman-0.43.4 pango-1.54.0 fribidi-1.0.16 graphite2-1.3.14" |
| 37 | + |
| 38 | +_idx=0 |
| 39 | +_store_include="" |
| 40 | +_store_link="" |
| 41 | +for _pkg in $_store_pkgs; do |
| 42 | + _hash=$(_h $_idx) |
| 43 | + _store_include="$_store_include$_P/$_pkg-$_hash/include:" |
| 44 | + _store_link="$_store_link$_P/$_pkg-$_hash/lib:" |
| 45 | + _idx=$((_idx + 1)) |
| 46 | +done |
| 47 | + |
| 48 | +_dep_include="" |
| 49 | +_dep_link="" |
| 50 | +for _pkg in $_dep_pkgs; do |
| 51 | + _hash=$(_h $_idx) |
| 52 | + _dep_include="$_dep_include$_P/$_pkg-$_hash/include:" |
| 53 | + _dep_link="$_dep_link$_P/$_pkg-$_hash/lib:" |
| 54 | + _idx=$((_idx + 1)) |
| 55 | +done |
| 56 | + |
| 57 | +export SPACK_STORE_INCLUDE_DIRS="${_store_include%:}" |
| 58 | +export SPACK_STORE_LINK_DIRS="${_store_link%:}" |
| 59 | +export SPACK_STORE_RPATH_DIRS="$SPACK_STORE_LINK_DIRS" |
| 60 | + |
| 61 | +export SPACK_INCLUDE_DIRS="${_dep_include%:}" |
| 62 | +export SPACK_LINK_DIRS="${_dep_link%:}" |
| 63 | +export SPACK_RPATH_DIRS="$SPACK_LINK_DIRS" |
| 64 | + |
| 65 | +export SPACK_COMPILER_IMPLICIT_RPATHS="\ |
| 66 | +$_P/gcc-16.1.0-a30491defb3c2a8a14f43c8c93ec2ef2/lib" |
| 67 | + |
| 68 | +export SPACK_COMPILER_EXTRA_RPATHS="\ |
| 69 | +$_P/gcc-runtime-stuff-16.1.0-6bce6552b41bbeed94e4faee72dcbe96/lib" |
| 70 | + |
| 71 | +export SPACK_CFLAGS="" |
| 72 | +export SPACK_CXXFLAGS="" |
| 73 | +export SPACK_FFLAGS="" |
| 74 | +export SPACK_CPPFLAGS="" |
| 75 | +export SPACK_LDFLAGS="" |
| 76 | +export SPACK_LDLIBS="" |
| 77 | +export SPACK_ALWAYS_CFLAGS="" |
| 78 | +export SPACK_ALWAYS_CXXFLAGS="" |
| 79 | +export SPACK_ALWAYS_CPPFLAGS="" |
| 80 | +export SPACK_ALWAYS_FFLAGS="" |
| 81 | +export SPACK_TARGET_ARGS_CC="" |
| 82 | +export SPACK_TARGET_ARGS_CXX="" |
| 83 | +export SPACK_TARGET_ARGS_FORTRAN="" |
| 84 | +export SPACK_COMPILER_FLAGS_KEEP="" |
| 85 | +export SPACK_COMPILER_FLAGS_REPLACE="" |
| 86 | + |
| 87 | +# Warmup |
| 88 | +./g++ -c foo.c -o foo.o |
| 89 | + |
| 90 | +# Do a 1000 runs |
| 91 | +N=1000 |
| 92 | +_start=$(date +%s) |
| 93 | +_i=0 |
| 94 | +while [ $_i -lt $N ]; do |
| 95 | + ./g++ -c foo.c -o foo.o |
| 96 | + _i=$((_i + 1)) |
| 97 | +done |
| 98 | +_end=$(date +%s) |
| 99 | +_elapsed=$((_end - _start)) |
| 100 | +printf '%s runs in %ss (avg %sms)\n' "$N" "$_elapsed" "$((_elapsed * 1000 / N))" |
0 commit comments