# # common Makefile # # gets included after the local Makefile in the example sub-directory # #CC=gcc CC=icc ifeq ($(CC), icc) OPT_FLAGS=-fast -I/usr/include else # for gcc OPT_FLAGS :=-fopenmp -O3 -ftree-vectorize -msse3 #-ftree-parallelize-loops=4; endif CFLAGS = -DTIME -lm PLCFLAGS += TILEFLAGS += #PERFCTR=perfctr ifdef PERFCTR CFLAGS += -DPERFCTR -L/usr/local/lib64 -lpapi endif PLC=../../polycc all: orig opt tiled par orig: $(SRC).c decls.h papi_defs.h util.h $(CC) $(OPT_FLAGS) -lm $(SRC).c -o orig $(CFLAGS) orig_par: decls.h papi_defs.h util.h $(SRC).c $(CC) -parallel $(OPT_FLAGS) -lm $(SRC).c -o orig_par $(CFLAGS) $(SRC).opt.c: $(PLC) $(SRC).c $(PLCFLAGS) $(SRC).tiled.c: $(PLC) $(SRC).c --tile $(TILEFLAGS) $(PLCFLAGS) $(SRC).par.c: $(PLC) $(SRC).c --tile --parallel $(TILEFLAGS) $(PLCFLAGS) opt: $(SRC).opt.c decls.h papi_defs.h util.h $(CC) $(OPT_FLAGS) -lm $(SRC).opt.c -o opt $(CFLAGS) tiled: $(SRC).tiled.c decls.h papi_defs.h util.h $(CC) $(OPT_FLAGS) -lm $(SRC).tiled.c -o tiled $(CFLAGS) par: $(SRC).par.c decls.h papi_defs.h util.h $(CC) $(OPT_FLAGS) -openmp -lm $(SRC).par.c -o par $(CFLAGS) orig_test: $(SRC).c decls.h papi_defs.h util.h $(CC) $(OPT_FLAGS) -lm $(SRC).c -o orig_test -DTEST $(CFLAGS) opt_test: $(SRC).opt.c decls.h papi_defs.h util.h $(CC) $(OPT_FLAGS) -lm $(SRC).opt.c -o opt_test -DTEST $(CFLAGS) tiled_test: $(SRC).tiled.c decls.h papi_defs.h util.h $(CC) $(OPT_FLAGS) -lm $(SRC).tiled.c -o tiled_test -DTEST $(CFLAGS) par_test: $(SRC).par.c decls.h papi_defs.h util.h $(CC) $(OPT_FLAGS) -openmp -lm $(SRC).par.c -o par_test -DTEST $(CFLAGS) test: opt_test tiled_test orig_test par_test ./orig_test 2> out_orig ./opt_test 2> out_opt diff -q out_orig out_opt ./tiled_test 2> out_tiled diff -q out_orig out_tiled export OMP_NUM_THREADS=4; ./par_test 2> out_par4 diff -q out_orig out_par4 @echo Success! clean: rm -f out_* *.tiled.c *.opt.c *_test opt orig tiled sched_test sched hopt hopt_test *.par.c par *.par2d.c orig_par *.out.* *.kernel.* a.out \ $(EXTRA_CLEAN) tags tmp* gmon.out *~ .unroll .vectorize par2d exec-clean: rm -f out_* *_test opt orig tiled sched_test sched hopt hopt_test par orig_par *.out.* *.kernel.* a.out \ $(EXTRA_CLEAN) tags tmp* gmon.out *~ par2d