|
| 1 | +# possible values <INTEL,GNU> |
| 2 | +COMPILER ?=INTEL |
| 3 | +# possible values <YES,NO> |
| 4 | +PERFORM_IO ?=NO |
| 5 | +# possible values <YES,NO> |
| 6 | +IO_STATS ?=NO |
| 7 | +# possible values <YES,NO> |
| 8 | +DEBUG ?=NO |
| 9 | + |
| 10 | +# Add include directory |
| 11 | +CINCS =-I../common -I./ |
| 12 | + |
| 13 | +ifeq ($(COMPILER),INTEL) |
| 14 | + CC = icc |
| 15 | + # CFLAGS = -std=c99 -O2 -restrict -qopenmp #-qopt-report=2 |
| 16 | + # -opt-streaming-cache-evict=0 -opt-streaming-stores always |
| 17 | + CFLAGS = -std=c99 -xHost -qopenmp -restrict -prec-div -fp-model precise -ftz -qopt-prefetch-distance=64 |
| 18 | + # CFLAGS = -std=c99 -O2 -qopenmp -restrict |
| 19 | + CINCS += |
| 20 | + CLIBS = -lm |
| 21 | +else |
| 22 | + CC = gcc |
| 23 | + CFLAGS = -std=c99 -O3 -march=native -fopenmp -Wall |
| 24 | + CINCS += |
| 25 | + CLIBS = -lm |
| 26 | +endif |
| 27 | + |
| 28 | +ifeq ($(PERFORM_IO),NO) |
| 29 | + DEFINES += -DDO_NOT_PERFORM_IO |
| 30 | +endif |
| 31 | + |
| 32 | +ifeq ($(IO_STATS),NO) |
| 33 | + DEFINES += |
| 34 | + CFLAGS += -Wno-unused-variable -Wno-unused-but-set-variable |
| 35 | +else |
| 36 | + DEFINES += -DLOG_IO_STATS |
| 37 | + CFLAGS += |
| 38 | +endif |
| 39 | + |
| 40 | +ifeq ($(DEBUG),YES) |
| 41 | + DEFINES += -DDEBUG |
| 42 | + CFLAGS += -g |
| 43 | +endif |
| 44 | + |
| 45 | +TARGET=fwi.intel64 ModelGenerator |
| 46 | + |
| 47 | +all:$(TARGET) |
| 48 | + |
| 49 | +fwi.intel64:fwi_main.o fwi_common.o fwi_kernel.o fwi_propagator.o |
| 50 | + $(CC) $(DEFINES) $(CFLAGS) $(CINCS) $+ -o $@ $(CLIBS) |
| 51 | + |
| 52 | +ModelGenerator:fwi_generatemodel.o fwi_common.o fwi_kernel.o fwi_propagator.o |
| 53 | + $(CC) $(DEFINES) $(CFLAGS) $(CINCS) $+ -o $@ $(CLIBS) |
| 54 | + |
| 55 | +fwi_generatemodel.o:../common/fwi_generatemodel.c |
| 56 | + $(CC) $(DEFINES) $(CFLAGS) $(CINCS) $^ -c -o $@ |
| 57 | + |
| 58 | +fwi_main.o:fwi_main.c |
| 59 | + $(CC) $(DEFINES) $(CFLAGS) $(CINCS) $^ -c -o $@ |
| 60 | + |
| 61 | +fwi_common.o:../common/fwi_common.c |
| 62 | + $(CC) $(DEFINES) $(CFLAGS) $(CINCS) $^ -c -o $@ |
| 63 | + |
| 64 | +fwi_kernel.o:../common/fwi_kernel.c |
| 65 | + $(CC) $(DEFINES) $(CFLAGS) $(CINCS) $^ -c -o $@ |
| 66 | + |
| 67 | +fwi_propagator.o:fwi_propagator.c |
| 68 | + $(CC) $(DEFINES) $(CFLAGS) $(CINCS) $^ -c -o $@ |
| 69 | + |
| 70 | + |
| 71 | +.PHONY:all clean run debug memcheck input printvars |
| 72 | + |
| 73 | +clean: |
| 74 | + rm -rf *.o *.optrpt *.log $(TARGET) *.log *.csv ../Results/* |
| 75 | + |
| 76 | +input: ModelGenerator |
| 77 | + ./ModelGenerator ../SetupParams/fwi_params.txt ../SetupParams/fwi_frequencies.txt |
| 78 | + |
| 79 | +run: fwi.intel64 |
| 80 | + ./fwi.intel64 ../SetupParams/fwi_params.txt ../SetupParams/fwi_frequencies.txt |
| 81 | + |
| 82 | +debug: fwi.intel64 |
| 83 | + gdb --args fwi.intel64 ../SetupParams/fwi_params.txt ../SetupParams/fwi_frequencies.txt |
| 84 | + |
| 85 | +memcheck: fwi.intel64 |
| 86 | + valgrind --leak-check=full ./fwi.intel64 ../SetupParams/fwi_params.txt ../SetupParams/fwi_frequencies.txt > valgrind.log 2>&1 |
| 87 | + |
0 commit comments