concept-collection / libflame2wasm
libflame2wasm / build-all-wasm.sh
49 lines · 1.6 KBBlameHistoryRaw
1#!/bin/bash
2# Build every WASM artifact downstream projects need, from a clean checkout.
3# Produces the four static libraries that (e.g.) concept-collection/matmul-bench
4# links against:
5#
6# install/lib/libflame.a single-threaded libflame
7# install/lib/libflame-mt.a libflame compiled with -pthread
8# install/lib/libblis-st.a single-threaded BLIS (BLAS backend)
9# blis/lib/generic/libblis.a BLIS compiled with pthreads
11# Each variant is built in a freshly re-cloned tree (rm -rf before each build):
12# the single- and multi-threaded objects differ only by compile flags, and
13# libflame's make does not rebuild objects when just config.mk changes, so a
14# clean tree is the only reliable way to get correct -pthread archives.
16# This is slow (libflame is built twice, BLIS twice). Downstream CI should
17# cache the outputs keyed on this repo's commit SHA.
19# Requires: emsdk (expected at ~/emsdk, or already on PATH), git, a C toolchain.
20set -euo pipefail
22cd "$(dirname "$0")"
24if ! command -v emcc >/dev/null 2>&1; then
25 source ~/emsdk/emsdk_env.sh
26fi
28echo "==> [1/4] libflame (single-threaded)"
29rm -rf libflame
30./build-wasm.sh
32echo "==> [2/4] libflame (pthreads)"
33rm -rf libflame
34PTHREAD=1 ./build-wasm.sh
36echo "==> [3/4] BLIS (single-threaded)"
37rm -rf blis
38./build-blis-wasm.sh
39mkdir -p install/lib
40cp blis/lib/generic/libblis.a install/lib/libblis-st.a
42echo "==> [4/4] BLIS (pthreads)"
43rm -rf blis
44THREADING=pthreads ./build-blis-wasm.sh
46echo
47echo "Done. Artifacts:"
48ls -la install/lib/libflame.a install/lib/libflame-mt.a \
49 install/lib/libblis-st.a blis/lib/generic/libblis.a