diff options
| author | Connor Moore <connor@hhmoore.ca> | 2026-01-31 00:32:06 -0500 |
|---|---|---|
| committer | Connor Moore <connor@hhmoore.ca> | 2026-01-31 00:32:06 -0500 |
| commit | c896807fd9fc5b5f2cdbec9eef717f815af3779a (patch) | |
| tree | 3267fd9331ea6337d327f407063f53a798a79bce /Makefile | |
| parent | e1babc4f71ba2e3fa3139dddb6d77f1c7b5a9683 (diff) | |
Added ANSI colours for error messages. Major update for the makefile, including parametrized start/stop/step and looping over optimization flags (O0/O1/O2/O3/Ofast)
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 76 |
1 files changed, 48 insertions, 28 deletions
@@ -1,35 +1,55 @@ -GCC=gfortran -oneAPI=ifx +GCC = gfortran +oneAPI = ifx + +# These flags will be looped over to generate different datasets +FLAGS := O0 O1 O2 O3 Ofast +# Also specify a default (note the conditional assignment operation, ?=) +OPTFLAGS ?= O3 + +GREEN := \033[0;32m +RESET := \033[0m + +S_START:= 100 +S_END := 3500 +S_STEP := 100 + +L_END := 20000 +L_STEP := 500 all: - mkdir -p bin/ - $(GCC) matrixproduct.f90 -o bin/$(GCC).serial.out -O3 -fexternal-blas -lopenblas -march=native - $(oneAPI) matrixproduct.f90 -o bin/$(oneAPI).serial.out -qmkl=sequential -O3 -heap-arrays -xHost - $(GCC) matrixproduct.f90 -o bin/$(GCC).parallel.out -O3 -fexternal-blas -lopenblas -march=native -fopenmp - $(oneAPI) matrixproduct.f90 -o bin/$(oneAPI).parallel.out -qmkl=parallel -O3 -heap-arrays -xHost -fopenmp - -tests: clean all - mkdir -p results/ - - # Serial runs - export OMP_NUM_THREADS=1 - ./bin/$(GCC).serial.out 100 3500 100 yes > results/$(GCC)_short_serial - ./bin/$(oneAPI).serial.out 100 3500 100 yes > results/$(oneAPI)_short_serial - - ./bin/$(GCC).serial.out 3500 20000 500 no > results/$(GCC)_long_serial - ./bin/$(oneAPI).serial.out 3500 20000 500 no > results/$(oneAPI)_long_serial - - # Parallel runs - export OMP_NUM_THREADS=8 - ./bin/$(GCC).parallel.out 100 3500 100 yes > results/$(GCC)_short_parallel - ./bin/$(oneAPI).parallel.out 100 3500 100 yes > results/$(oneAPI)_short_parallel - - ./bin/$(GCC).parallel.out 3500 20000 500 no > results/$(GCC)_long_parallel - ./bin/$(oneAPI).parallel.out 3500 20000 500 no > results/$(oneAPI)_long_parallel + @mkdir -p bin/ + @echo "$(GREEN)Compiling serial and parallel binaries with $(OPTFLAGS)$(RESET)" + $(GCC) matrixproduct.f90 -o bin/$(GCC).serial.out -$(OPTFLAGS) -fexternal-blas -lopenblas -march=native + $(oneAPI) matrixproduct.f90 -o bin/$(oneAPI).serial.out -qmkl=sequential -$(OPTFLAGS) -heap-arrays -xHost + $(GCC) matrixproduct.f90 -o bin/$(GCC).parallel.out -$(OPTFLAGS) -fexternal-blas -lopenblas -march=native -fopenmp + $(oneAPI) matrixproduct.f90 -o bin/$(oneAPI).parallel.out -qmkl=parallel -$(OPTFLAGS) -heap-arrays -xHost -fopenmp + +tests: clean + @mkdir -p results/ + @for opt in $(FLAGS); do \ + $(MAKE) all OPTFLAGS=$$opt; \ + echo "$(GREEN)Running serial short runs with $$opt$(RESET)"; \ + export OMP_NUM_THREADS=1; \ + export MKL_NUM_THREADS=1; \ + ./bin/$(GCC).serial.out $(S_START) $(S_END) $(S_STEP) yes > results/$(GCC)_short_serial_$$opt.out; \ + ./bin/$(oneAPI).serial.out $(S_START) $(S_END) $(S_STEP) yes > results/$(oneAPI)_short_serial_$$opt.out; \ + echo "$(GREEN)Running serial long runs with $$opt$(RESET)"; \ + ./bin/$(GCC).serial.out $(S_END) $(L_END) $(L_STEP) no > results/$(GCC)_long_serial_$$opt.out; \ + ./bin/$(oneAPI).serial.out $(S_END) $(L_END) $(L_STEP) no > results/$(oneAPI)_long_serial_$$opt.out; \ + echo "$(GREEN)Running parallel short runs with $$opt$(RESET)"; \ + export OMP_NUM_THREADS=8; \ + export MKL_NUM_THREADS=8; \ + ./bin/$(GCC).parallel.out $(S_START) $(S_END) $(S_STEP) yes > results/$(GCC)_short_parallel; \ + ./bin/$(oneAPI).parallel.out $(S_START) $(S_END) $(S_STEP) yes > results/$(oneAPI)_short_parallel; \ + echo "$(GREEN)Running parallel long runs with $$opt$(RESET)"; \ + ./bin/$(GCC).parallel.out $(S_END) $(L_END) $(L_STEP) no > results/$(GCC)_long_parallel; \ + ./bin/$(oneAPI).parallel.out $(S_END) $(L_END) $(L_STEP) no > results/$(oneAPI)_long_parallel; \ + done plots: gnuplot -p plots.gnu clean: - rm -rf bin/ - rm -rf results/ + @echo "$(GREEN)Cleaning bin/ and results/$(RESET)" + @rm -rf bin/ + @rm -rf results/ |
