Repository navigation
Expand file tree
/
Copy pathMakefile_multipole
More file actions
47 lines (39 loc) · 2.02 KB
/
Copy pathMakefile_multipole
File metadata and controls
47 lines (39 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Builds the Fortran extension modules. FLAGS MATTER: a plain
# `f2py -c` build measured 2.5x SLOWER end-to-end than this recipe
# (-O3 -march=native -funroll-loops); -march=native also means the
# machine-local byte anchors in validation/run_baseline.sh re-base per
# machine, which is expected. Requires numpy (meson-backend f2py),
# gfortran and FFTW3 development headers.
PY ?= python3
F77FLAGS = -cpp -O3 -march=native -funroll-loops
all: mp_fortran fmmtop f_setup meshgraph_aux krylov_kernels hodlrnat
# optional: the H-LU native solve (hodlr.py falls back to python
# without it, but validate_hodlr_native requires it)
hodlrnat:
cd src && (gcc -O2 -shared -fPIC hodlr_native.c -o libhodlrnat.so -lopenblas || \
gcc -O2 -shared -fPIC hodlr_native.c -o libhodlrnat.so -l:libopenblas.so.0 || \
gcc -O2 -shared -fPIC hodlr_native.c -o libhodlrnat.so -lblas)
# -fopenmp/-lgomp are LOAD-BEARING: without them the !$OMP directives
# in multipole_aux.f (P2P, MID_M2L) compile as comments and the
# kernels run SERIAL. That is exactly what shipped -- the directives
# were present but this recipe lacked the flags, found 2026-08-25
# when OMP_NUM_THREADS measured as a no-op on the R4 rung.
mp_fortran:
cd src && FC=gfortran $(PY) -m numpy.f2py -c -m mp_fortran multipole_aux.f \
--f77flags="$(F77FLAGS) -fopenmp" --opt="-O3" -lfftw3 -lgomp
fmmtop:
cd src && FC=gfortran $(PY) -m numpy.f2py -c -m FMMtop fmmtop.f \
--f77flags="$(F77FLAGS) -fopenmp" --opt="-O3" -lgomp
f_setup:
cd src && FC=gfortran $(PY) -m numpy.f2py -c -m f_setup f_setup.f \
--f77flags="$(F77FLAGS)" --opt="-O3"
meshgraph_aux:
cd src && FC=gfortran $(PY) -m numpy.f2py -c -m meshgraph_aux meshgraph_aux.f \
--f77flags="$(F77FLAGS)" --opt="-O3"
# the streamed-basis projections (krylov_stream falls back to a numpy
# loop without it, ~5x slower per basis vector at R4 size)
krylov_kernels:
cd src && FC=gfortran $(PY) -m numpy.f2py -c -m krylov_kernels krylov_kernels.f90 \
--f90flags="-O3 -march=native -funroll-loops -fopenmp" --opt="-O3" -lgomp
clean:
rm -f src/*.so