/ proof-of-concept / fmm3dbie-gpu-poc
Sign in
proof-of-concept / fmm3dbie-gpu-poc
fmm3dbie-gpu-poc / scripts / build_fmm3dbie.sh
28 lines · 1.3 KBBlameHistoryRaw
1#!/bin/bash
2# Build the fmm3dbie shared library that the reference backend loads through ctypes.
3# Usage: scripts/build_fmm3dbie.sh [install_dir] (default ~/src/fmm3dbie)
4# Needs git, gfortran, make and an OpenBLAS (or other BLAS/LAPACK) library.
5set -euo pipefail
6DEST="${1:-$HOME/src/fmm3dbie}"
7# The commit used for the results in the README; set FMM3DBIE_COMMIT= (empty) for the latest.
8COMMIT="${FMM3DBIE_COMMIT-94cb732e1660f74864ef0f527ef713d308453d09}"
9if [ ! -d "$DEST/.git" ]; then
10 git clone https://github.com/fastalgorithms/fmm3dbie "$DEST"
11fi
12cd "$DEST"
13if [ -n "$COMMIT" ]; then git checkout -q "$COMMIT"; fi
14git submodule update --init
15if [ ! -f make.inc ]; then
16 cp make.inc.linux.gnu.openblas make.inc
17 # Some systems ship only the versioned runtime library (libopenblas.so.0) without the
18 # development link; link against it directly in that case.
19 if ! ld -lopenblas -o /dev/null --unresolved-symbols=ignore-all 2>/dev/null; then
20 for lib in /usr/lib64/libopenblas.so.0 /usr/lib/x86_64-linux-gnu/libopenblas.so.0; do
21 if [ -f "$lib" ]; then sed -i "s|^LBLAS=.*|LBLAS=-l:libopenblas.so.0|" make.inc; break; fi
22 done
23 fi
24fi
25make lib -j"$(nproc)"
26echo
27echo "Built $DEST/lib/libfmm3dbie.so. If it is not at ~/src/fmm3dbie, set"
28echo " export FMM3DBIE_LIB=$DEST/lib/libfmm3dbie.so"
↑↓ move↵openescclose