#!/bin/bash # Build the fmm3dbie shared library that the reference backend loads through ctypes. # Usage: scripts/build_fmm3dbie.sh [install_dir] (default ~/src/fmm3dbie) # Needs git, gfortran, make and an OpenBLAS (or other BLAS/LAPACK) library. set -euo pipefail DEST="${1:-$HOME/src/fmm3dbie}" # The commit used for the results in the README; set FMM3DBIE_COMMIT= (empty) for the latest. COMMIT="${FMM3DBIE_COMMIT-94cb732e1660f74864ef0f527ef713d308453d09}" if [ ! -d "$DEST/.git" ]; then git clone https://github.com/fastalgorithms/fmm3dbie "$DEST" fi cd "$DEST" if [ -n "$COMMIT" ]; then git checkout -q "$COMMIT"; fi git submodule update --init if [ ! -f make.inc ]; then cp make.inc.linux.gnu.openblas make.inc # Some systems ship only the versioned runtime library (libopenblas.so.0) without the # development link; link against it directly in that case. if ! ld -lopenblas -o /dev/null --unresolved-symbols=ignore-all 2>/dev/null; then for lib in /usr/lib64/libopenblas.so.0 /usr/lib/x86_64-linux-gnu/libopenblas.so.0; do if [ -f "$lib" ]; then sed -i "s|^LBLAS=.*|LBLAS=-l:libopenblas.so.0|" make.inc; break; fi done fi fi make lib -j"$(nproc)" echo echo "Built $DEST/lib/libfmm3dbie.so. If it is not at ~/src/fmm3dbie, set" echo " export FMM3DBIE_LIB=$DEST/lib/libfmm3dbie.so"