#!/bin/bash #SBATCH --job-name=mathlib-cache #SBATCH --time=01:00:00 #SBATCH --cpus-per-task=4 #SBATCH --mem=6144 set -euo pipefail route="$PWD" base="$(git rev-parse --show-toplevel)/../.." mkdir -p "$base/.shoal/tmp" "$base/private-environment/mathlib-cache" export PATH="$base/private-environment/lean-4.33.1-linux/bin:/usr/bin:/bin" export MATHLIB_CACHE_DIR="$base/private-environment/mathlib-cache" export MATHLIB_CACHE_GET_URL=https://cache.mathlib.org/mathlib4 export LAKE_CACHE_DIR="$base/private-environment/lake-cache" export LAKE_ARTIFACT_CACHE=false export TMPDIR="$base/.shoal/tmp" export LEAN_ABORT_ON_PANIC=1 cd "$base/private-environment/original-source" python3 - <<'PY' import os os.sched_setaffinity(0,set(sorted(os.sched_getaffinity(0))[:4])) os.execvp('lake',['lake','exe','mathlib/cache','get-']) PY python3 - "$route/mathlib-download-report.json" <<'PY' import json,os,sys from pathlib import Path root=Path(os.environ['MATHLIB_CACHE_DIR']) files=list(root.glob('*.ltar')) if not files:raise SystemExit('No Mathlib cache files downloaded') Path(sys.argv[1]).write_text(json.dumps({'archive_count':len(files),'archive_bytes':sum(p.stat().st_size for p in files),'command':'lake exe mathlib/cache get-','mathlib_revision':'0df444a360eaa60ab8c11dca51a86af692955474','scope':'Stock Mathlib cache download only; not decompressed or independently rebuilt.'},indent=2)+'\n') print('Mathlib cache download command completed; decompression still required.') PY