CC = icc FC = ifort CFLAGS = -O3 -qopenmp -mkl FFLAGS = $(CFLAGS) EXECS = work work_serial daxpy daxpy2 hello_c hello_f90 all: $(EXECS) info info: @echo "info : $(SYSTEM) $(HOSTNAME) $(CC) $(FC)" work_serial: work_serial.f90 $(FC) -O3 -o $@ $? daxpy: daxpy.f90 $(FC) $(FFLAGS) -o $@ $? daxpy2: daxpy2.f90 $(FC) $(FFLAGS) $(LIBS) -o $@ $? work: work.f90 $(FC) $(FFLAGS) -o $@ $? hello_f90: hello.f90 $(FC) $(FFLAGS) -o $@ $? hello_c: hello.c $(CC) $(CFLAGS) -o $@ $? run_hello_f90: hello_f90 @for n in 2 4 8 12 16; do echo Number of threads=$$n; export OMP_NUM_THREADS=$$n; ./$?; echo; done run_hello_c: hello_c @for n in 2 4 8 12 16; do echo Number of threads=$$n; export OMP_NUM_THREADS=$$n; ./$?; echo; done run_work: work @for n in 1 2 4 8 12 16; do echo Number of threads=$$n; export OMP_NUM_THREADS=$$n; echo OMP_SCHEDULE=$$OMP_SCHEDULE; ./$?; echo; done run_daxpy: daxpy @rm -f plot_$? nt @for n in 1 2 4 8 12 16 24 32 40 48; do echo Number of threads=$$n; echo $$n >> nt; export OMP_NUM_THREADS=$$n; ./$? 2>&1 | tee -a plot_$?; echo; done # error unless run_daxpy is done prior to plot_daxpy plot_daxpy: FORCE @awk '{print $$2}' $@ > temp @paste nt temp > $@ @rm -f temp @echo 'set xlabel "thread count"' > plot @echo 'set ylabel "MFLOPS"' >> plot @echo 'plot "$@" with linespoints' >> plot @gnuplot -persist plot run_daxpy2: daxpy2 @rm -f plot_$? nt @for n in 1 2 4 8 12 16 24 32 40 48; do echo Number of threads=$$n; echo $$n >> nt; export OMP_NUM_THREADS=$$n; ./$? 2>&1 | tee -a plot_$?; echo; done # error unless run_daxpy2 is done prior to plot_daxpy2 plot_daxpy2: FORCE @awk '{print $$2}' $@ > temp @paste nt temp > $@ @rm -f temp @echo 'set xlabel "thread count"' > plot @echo 'set ylabel "MFLOPS"' >> plot @echo 'plot "$@" with linespoints' >> plot @gnuplot -persist plot plot_daxpys: FORCE plot_daxpy plot_daxpy2 @echo 'set xlabel "thread count"' > plot @echo 'set ylabel "MFLOPS"' >> plot @echo 'plot "plot_daxpy" with linespoints' >> plot @echo 'replot "plot_daxpy2" with linespoints' >> plot @gnuplot -persist plot clean: rm -f $(EXECS) realclean: clean FORCE rm -f plot* nt FORCE: @rm -f plot temp