From e1babc4f71ba2e3fa3139dddb6d77f1c7b5a9683 Mon Sep 17 00:00:00 2001 From: Connor Moore Date: Fri, 30 Jan 2026 23:13:40 -0500 Subject: Added support for OpenMP. Cleaned up makefile. Added gnuplot file for `make plots`. --- Makefile | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 39b5bdf..32449de 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,31 @@ -gnu: - gfortran matrixproduct.f90 -o bin/gcc.out -lblas -O3 -fopenmp -intel: - ifx matrixproduct.f90 -o bin/intel.out -lblas -O3 -fopenmp -heap-arrays +GCC=gfortran +oneAPI=ifx -dir: - mkdir results bin +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 dir gnu intel - ./bin/gcc.out 100 100 3500 yes > results/gcc_short - ./bin/intel.out 100 100 3500 yes > results/intel_short +tests: clean all + mkdir -p results/ - ./bin/gcc.out 3500 1000 10500 no > results/gcc_long - ./bin/intel.out 3500 1000 10500 no > results/gcc_long + # 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 plots: gnuplot -p plots.gnu -- cgit v1.2.3