#CC=g++ CC=mpic++ LIBSRCS=utils.cpp testlib.cpp data_type.cpp LIBOBJS=$(LIBSRCS:.cpp=.o) LIBPROFOBJS=$(addprefix prof/, $(LIBOBJS)) CLASSSRCS=IsingModel.cpp monte_carlo.cpp CLASSOBJS=$(CLASSSRCS:.cpp=.o) CLASSPROFOBJS=$(addprefix prof/, $(CLASSOBJS)) INCLUDE=../include CFLAGS=-Wall -larmadillo -std=c++11 -O3 -fomit-frame-pointer #CFLAGS=-Wall -larmadillo -lblas -llapack -std=c++11 -O3 -fomit-frame-pointer OPENMP=-fopenmp # Add a debug flag when compiling (For the DEBUG macro in utils.hpp) DEBUG ?= 0 ifeq ($(DEBUG), 1) DBGFLAG=-DDBG -g else DBGFLAG= endif # Add profiling for serial code PROFILE ?= 0 ifeq ($(PROFILE), 1) PROFFLAG=-pg -fno-inline-functions else PROFFLAG= endif .PHONY: clean instrument all: main phase_transition_mpi test_suite time #all: main # Instrumentation using scorep for parallel analysis instrument: prof/phase_transition_mpi.o $(LIBPROFOBJS) $(CLASSPROFOBJS) scorep $(CC) $(LIBPROFOBJS) $(CLASSPROFOBJS) $< -o phase_transition_mpi_prof $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP) # Rules for executables main: main.o $(LIBOBJS) $(CLASSOBJS) $(CC) $^ -o $@ $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP) phase_transition_mpi: phase_transition_mpi.o $(LIBOBJS) $(CLASSOBJS) $(CC) $^ -o $@ $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP) test_suite: test_suite.o $(LIBOBJS) $(CLASSOBJS) $(CC) $^ -o $@ $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP) time: time.o $(LIBOBJS) $(CLASSOBJS) $(CC) $^ -o $@ $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP) # Rule for object files %.o: %.cpp $(CC) -c $^ -o $@ $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP) # Rule for instrumented object files prof/%.o: %.cpp scorep $(CC) -c $^ -o $@ $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP) clean: find . -maxdepth 2 -name "*.o" -type f -delete rm test_suite main phase_transition_mpi phase_transition_mpi_prof time