From a8abd18483cd113d1b0ee066621caf83bafe87f8 Mon Sep 17 00:00:00 2001 From: Connor Moore Date: Wed, 4 Feb 2026 17:47:21 -0500 Subject: Added more comments in Makefile --- Makefile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Makefile b/Makefile index d822d45..261eb4a 100644 --- a/Makefile +++ b/Makefile @@ -8,17 +8,23 @@ OPTFLAGS ?= O3 # For the parallel runs, use all available processors NPROC := $(shell nproc) +# Make some pretty colours MAGENTA := \033[1;35m RESET := \033[0m +# Define the start, stop, and step for "short" runs (including triple loops) S_START:= 100 S_END := 300 S_STEP := 100 +# And the step and end for "long" runs without triple loops. +# Automatically they start at S_END defined earlier L_END := 800 L_STEP := 500 + all: + # This target simply compiles the binaries @mkdir -p bin/ @echo "$(MAGENTA)Compiling serial and parallel binaries with $(OPTFLAGS)$(RESET)" $(GCC) matrixproduct.f90 -o bin/$(GCC).serial.out -$(OPTFLAGS) -fexternal-blas -lopenblas -march=native @@ -27,6 +33,7 @@ all: $(oneAPI) matrixproduct.f90 -o bin/$(oneAPI).parallel.out -qmkl=parallel -$(OPTFLAGS) -heap-arrays -xHost -fopenmp tests: clean + # Run the parametric tests and sweep over compiler flags @mkdir -p results/ @for opt in $(FLAGS); do \ $(MAKE) all OPTFLAGS=$$opt; \ @@ -36,7 +43,14 @@ tests: clean $(MAKE) parallel OPTFLAGS=$$opt; \ done + +## NOTE: For the below two, it is very important that lines have the '\' postfix +## By default, these are all executed on a different shell session, so to preserve +## the enivronment variables for OMP/MKL they need to be run as one "big" command +## serially. The backslash is the 'line continuation' operator that does this. + serial: ./bin/gfortran.serial.out ./bin/ifx.serial.out + # run the serial tests. ensures that only one thread is used for blas and mkl export OMP_NUM_THREADS=1 && \ export MKL_NUM_THREADS=1 && \ ./bin/$(GCC).serial.out $(S_START) $(S_END) $(S_STEP) yes | tee results/$(GCC)_short_serial_$(OPTFLAGS).out; \ @@ -45,6 +59,8 @@ serial: ./bin/gfortran.serial.out ./bin/ifx.serial.out ./bin/$(oneAPI).serial.out $(S_END) $(L_END) $(L_STEP) no | tee results/$(oneAPI)_long_serial_$(OPTFLAGS).out; parallel: ./bin/gfortran.parallel.out ./bin/ifx.parallel.out + # run the parallel tests. ensures that all threads are used for the loops, blas, and mkl + export OMP_NUM_THREADS=1 && \ export OMP_NUM_THREADS=${NPROC} && \ export MKL_NUM_THREADS=${NPROC} && \ ./bin/$(GCC).parallel.out $(S_START) $(S_END) $(S_STEP) yes | tee results/$(GCC)_short_parallel_$(OPTFLAGS)_$(NPROC).out; \ @@ -54,9 +70,11 @@ parallel: ./bin/gfortran.parallel.out ./bin/ifx.parallel.out plots: + # Deprecated. Plot some things in GNUPLOT. Currently unused. gnuplot -p plots.gnu clean: + # Clean up after ourselves @echo "$(MAGENTA)Cleaning bin/ and results/$(RESET)" @rm -rf bin/ @rm -rf results/ -- cgit v1.2.3