########################## Makefile ############################################## # June 15, 2012 # # Copyright CNRS - Universite d'Orleans - BRGM (France) # contributors: Ulrich Razafison (2008), Christian Laguerre (2010), Frédéric Darboux (2012), Marco Mancini (2019) # ulrich.razafison@math.cnrs.fr, christian.laguerre@math.cnrs.fr,frederic.darboux@orleans.inra.fr, marco.mancini@univ-orleans.fr # # This file is part of FullSWOF_2D software. # FullSWOF_2D = Full Shallow-Water equations for Overland Flow, # in two dimensions of space. # This software is a computer program whose purpose is to compute # solutions for 2D Shallow-Water equations. # # This software is governed by the CeCILL license under French law and # abiding by the rules of distribution of free software. You can use, # modify and/ or redistribute the software under the terms of the CeCILL # license as circulated by CEA, CNRS and INRIA at the following URL # "http://www.cecill.info". # # As a counterpart to the access to the source code and rights to copy, # modify and redistribute granted by the license, users are provided only # with a limited warranty and the software's author, the holder of the # economic rights, and the successive licensors have only limited # liability. # # In this respect, the user's attention is drawn to the risks associated # with loading, using, modifying and/or developing or reproducing the # software by the user in light of its specific status of free software, # that may mean that it is complicated to manipulate, and that also # therefore means that it is reserved for developers and experienced # professionals having in-depth computer knowledge. Users are therefore # encouraged to load and test the software's suitability as regards their # requirements in conditions enabling the security of their systems and/or # data to be ensured and, more generally, to use and operate it in the # same conditions as regards security. # # The fact that you are presently reading this means that you have had # knowledge of the CeCILL license and that you accept its terms. # ################################################################################## SHELL:=/bin/bash ## include specify options for configuration include ./make_config ### CXX := mpic++ TARGET_EXEC ?= FullSWOF_2D DIR_BENCH := ./Benchmarks BUILD_DIR ?= ./build SRC_DIRS ?= ./Sources INC_DIRS ?= ./Headers BENCHEXE := BenchEvalFS2D.sh BENCHPS2DEXE := BenchEvalFS2Dpseudo2D.sh DIFFCMPEXE := diffCMPFS2D.sh REPORTDIFFEXE := reportDiffFS2D.sh SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s -type f \( ! -iname ".*" \)) OBJS := $(SRCS:%=$(BUILD_DIR)/%.o) DEPS := $(OBJS:.o=.d) INC_DIRS := $(shell find $(INC_DIRS) -type d) INC_FLAGS := $(addprefix -I,$(INC_DIRS)) CPPFLAGS += $(INC_FLAGS) -MMD -MP MKDIR_P ?= mkdir -p ifeq ($(DEBUG),yes) Compil_msg=" Compiling using debug mode " else Compil_msg=" Compiling using release mode" endif .PHONY: $(TARGET_EXEC) clean start_prt $(TARGET_EXEC) : start_prt $(BUILD_DIR)/$(TARGET_EXEC) @echo " $(TARGET_EXEC) => $(BIN)" @cp $(BUILD_DIR)/$(TARGET_EXEC) $(BIN)/ $(BUILD_DIR)/$(TARGET_EXEC): $(OBJS) @echo " Linking $@" @$(CXX) $(OBJS) -o $@ $(LDFLAGS) -include $(DEPS) # assembly $(BUILD_DIR)/%.s.o: %.s @$(MKDIR_P) $(dir $@) @$(AS) $(ASFLAGS) -c $< -o $@ # c source $(BUILD_DIR)/%.c.o: %.c @$(MKDIR_P) $(dir $@) @$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ # c++ source $(BUILD_DIR)/%.cpp.o: %.cpp @echo " Compiling $<" @$(MKDIR_P) $(dir $@) @$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ start_prt : @echo $(Compil_msg) clean: $(RM) -r $(BUILD_DIR) construction_tools : @cd $(DIR_TOOLS)/ConvertFormat && make $(Display_command) @cd $(DIR_TOOLS)/ExtractWindow && make $(Display_command) ################################################### # Rules to run Benchmarks ################################################### benchcalc: @ # if the code is not compiled, print a message. @ if [ ! -x $(BIN)/$(TARGET_EXEC) ]; then \ echo "ERROR: $(BIN)/$(TARGET_EXEC) not found.";\ echo "Please compile the code by running 'make'. "; exit 1; \ fi @ echo -e "\n\n***** Emerged bump at rest ******************************" @ cd $(DIR_BENCH)/Bump_restemerged && ../../$(BIN)/$(TARGET_EXEC) @ echo -e "\n\n***** MacDonald: Rain fluvial Darcy-Weisbach ************" @ cd $(DIR_BENCH)/MacDo_Rain_flu_DW && ../../$(BIN)/$(TARGET_EXEC) @ echo -e "\n\n***** MacDonald: Rain torrential Darcy-Weisbach *********" @ cd $(DIR_BENCH)/MacDo_Rain_tor_DW && ../../$(BIN)/$(TARGET_EXEC) @ echo -e "\n\n***** MacDonald: Smooth transition with shock Manning ***" @ cd $(DIR_BENCH)/MacDo_flu_tor_flu_Man && ../../$(BIN)/$(TARGET_EXEC) @ echo -e "\n\n***** MacDonald: Pseudo 2D torrential Manning ***********" @ cd $(DIR_BENCH)/MacDoP2D_tor_Man && ../../$(BIN)/$(TARGET_EXEC) @ echo -e "\n\n***** MacDonald: Pseudo 2D fluvial Manning **************" @ cd $(DIR_BENCH)/MacDoP2D_flu_Man && ../../$(BIN)/$(TARGET_EXEC) @ echo -e "\n\n***** Dry dam break *************************************" @ cd $(DIR_BENCH)/Dry_Dam_Break && ../../$(BIN)/$(TARGET_EXEC) @ echo -e "\n\n***** Thacker planar ************************************" @ cd $(DIR_BENCH)/Thacker_planar && ../../$(BIN)/$(TARGET_EXEC) benchB: @ echo " " @ echo "WARNING: you will compute all the Benchmark solutions." @ echo "This might take a few minutes." @ echo " " @ sleep 5 @ # Compute benchmarks @ make benchcalc @ echo " " @ echo "*** Comparison between current and reference results ***" @ # Compare results @ cd $(DIR_BENCH)/Bump_restemerged && ../../$(BIN)/$(BENCHEXE) analytic.dat 29 Outputs/huz_final.dat 6 > comp_USER.dat @ cd $(DIR_BENCH)/Bump_restemerged && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_USER.dat > diff_REF_USER.dat @ cd $(DIR_BENCH)/Bump_restemerged && echo -n "Emerged bump at rest: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_USER.dat @ cd $(DIR_BENCH)/MacDo_Rain_flu_DW && ../../$(BIN)/$(BENCHEXE) analytic.dat 33 Outputs/huz_final.dat 6 > comp_USER.dat @ cd $(DIR_BENCH)/MacDo_Rain_flu_DW && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_USER.dat > diff_REF_USER.dat @ cd $(DIR_BENCH)/MacDo_Rain_flu_DW && echo -n "MacDonald: Rain fluvial Darcy-Weisbach: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_USER.dat @ cd $(DIR_BENCH)/MacDo_Rain_tor_DW && ../../$(BIN)/$(BENCHEXE) analytic.dat 32 Outputs/huz_final.dat 6 > comp_USER.dat @ cd $(DIR_BENCH)/MacDo_Rain_tor_DW && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_USER.dat > diff_REF_USER.dat @ cd $(DIR_BENCH)/MacDo_Rain_tor_DW && echo -n "MacDonald: Rain torrential Darcy-Weisbach: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_USER.dat @ cd $(DIR_BENCH)/MacDo_flu_tor_flu_Man && ../../$(BIN)/$(BENCHEXE) analytic.dat 32 Outputs/huz_final.dat 6 > comp_USER.dat @ cd $(DIR_BENCH)/MacDo_flu_tor_flu_Man && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_USER.dat > diff_REF_USER.dat @ cd $(DIR_BENCH)/MacDo_flu_tor_flu_Man && echo -n "MacDonald: Smooth transition with shock Manning: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_USER.dat @ cd $(DIR_BENCH)/MacDoP2D_tor_Man && ../../$(BIN)/$(BENCHPS2DEXE) analytic.dat 28 Outputs/huz_final.dat 6 9 > comp_USER.dat @ cd $(DIR_BENCH)/MacDoP2D_tor_Man && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_USER.dat > diff_REF_USER.dat @ cd $(DIR_BENCH)/MacDoP2D_tor_Man && echo -n "MacDonald: Pseudo 2D torrential Manning: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_USER.dat @ cd $(DIR_BENCH)/MacDoP2D_flu_Man && ../../$(BIN)/$(BENCHPS2DEXE) analytic.dat 28 Outputs/huz_final.dat 6 99999 > comp_USER.dat @ cd $(DIR_BENCH)/MacDoP2D_flu_Man && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_USER.dat > diff_REF_USER.dat @ cd $(DIR_BENCH)/MacDoP2D_flu_Man && echo -n "MacDonald: Pseudo 2D fluvial Manning: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_USER.dat @ cd $(DIR_BENCH)/Dry_Dam_Break && ../../$(BIN)/$(BENCHEXE) analytic.dat 26 Outputs/huz_final.dat 6 > comp_USER.dat @ cd $(DIR_BENCH)/Dry_Dam_Break && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_USER.dat > diff_REF_USER.dat @ cd $(DIR_BENCH)/Dry_Dam_Break && echo -n "Dry dam break: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_USER.dat @ cd $(DIR_BENCH)/Thacker_planar && ../../$(BIN)/$(BENCHEXE) analytic.dat 22 Outputs/huz_final.dat 6 > comp_USER.dat @ cd $(DIR_BENCH)/Thacker_planar && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_USER.dat > diff_REF_USER.dat @ cd $(DIR_BENCH)/Thacker_planar && echo -n "Thacker planar: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_USER.dat benchrefB: @ echo " " @ echo "REFERENCE solutions for each Benchmark test." @ echo "WARNING: the previous reference solutions will be replaced." @ echo "This might take a few minutes." @ echo " " @ sleep 5 @ # Compute benchmarks @ make benchcalc @ echo " " @ echo "*** Comparison between reference and standard results ***" @ # Get ready for comparisons @ cd $(DIR_BENCH) &&\ for SUBDIR in ./* ; do \ cd $$SUBDIR && rm -rf Outputs_REFERENCES && mkdir Outputs_REFERENCES && mv Outputs/* Outputs_REFERENCES/ && mv Outputs_REFERENCES/dummy.txt Outputs/ && cd ..; \ done @ # Compare results @ cd $(DIR_BENCH)/Bump_restemerged && ../../$(BIN)/$(BENCHEXE) analytic.dat 29 Outputs_REFERENCES/huz_final.dat 6 > comp_REFERENCES.dat @ cd $(DIR_BENCH)/Bump_restemerged && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_STANDARD.dat > diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/Bump_restemerged && echo -n "Emerged bump at rest: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/MacDo_Rain_flu_DW && ../../$(BIN)/$(BENCHEXE) analytic.dat 33 Outputs_REFERENCES/huz_final.dat 6 > comp_REFERENCES.dat @ cd $(DIR_BENCH)/MacDo_Rain_flu_DW && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_STANDARD.dat > diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/MacDo_Rain_flu_DW && echo -n "MacDonald: Rain fluvial Darcy-Weisbach: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/MacDo_Rain_tor_DW && ../../$(BIN)/$(BENCHEXE) analytic.dat 32 Outputs_REFERENCES/huz_final.dat 6 > comp_REFERENCES.dat @ cd $(DIR_BENCH)/MacDo_Rain_tor_DW && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_STANDARD.dat > diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/MacDo_Rain_tor_DW && echo -n "MacDonald: Rain torrential Darcy-Weisbach : " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/MacDo_flu_tor_flu_Man && ../../$(BIN)/$(BENCHEXE) analytic.dat 32 Outputs_REFERENCES/huz_final.dat 6 > comp_REFERENCES.dat @ cd $(DIR_BENCH)/MacDo_flu_tor_flu_Man && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_STANDARD.dat > diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/MacDo_flu_tor_flu_Man && echo -n "MacDonald: Smooth transition with shock Manning: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/MacDoP2D_tor_Man && ../../$(BIN)/$(BENCHPS2DEXE) analytic.dat 28 Outputs_REFERENCES/huz_final.dat 6 9 > comp_REFERENCES.dat @ cd $(DIR_BENCH)/MacDoP2D_tor_Man && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_STANDARD.dat > diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/MacDoP2D_tor_Man && echo -n "MacDonald: Pseudo 2D torrential Manning: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/MacDoP2D_flu_Man && ../../$(BIN)/$(BENCHPS2DEXE) analytic.dat 28 Outputs_REFERENCES/huz_final.dat 6 99999 > comp_REFERENCES.dat @ cd $(DIR_BENCH)/MacDoP2D_flu_Man && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_STANDARD.dat > diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/MacDoP2D_flu_Man && echo -n "MacDonald: Pseudo 2D fluvial Manning: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/Dry_Dam_Break && ../../$(BIN)/$(BENCHEXE) analytic.dat 26 Outputs_REFERENCES/huz_final.dat 6 > comp_REFERENCES.dat @ cd $(DIR_BENCH)/Dry_Dam_Break && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_STANDARD.dat > diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/Dry_Dam_Break && echo -n "Dry dam break: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/Thacker_planar && ../../$(BIN)/$(BENCHEXE) analytic.dat 22 Outputs_REFERENCES/huz_final.dat 6 > comp_REFERENCES.dat @ cd $(DIR_BENCH)/Thacker_planar && ../../$(BIN)/$(DIFFCMPEXE) comp_REFERENCES.dat comp_STANDARD.dat > diff_REF_STANDARD.dat @ cd $(DIR_BENCH)/Thacker_planar && echo -n "Thacker planar: " && ../../$(BIN)/$(REPORTDIFFEXE) diff_REF_STANDARD.dat filesfor64bitsbenchmarks: @ # get the 64-bit files ready for comparison @ echo "*** 64-bit benchmarks ***" ; \ cd $(DIR_BENCH) && \ for SUBDIR in ./* ; do \ cp $$SUBDIR/comp_STANDARD_64bits.dat $$SUBDIR/comp_STANDARD.dat ; \ done bench64: filesfor64bitsbenchmarks benchB benchref64: filesfor64bitsbenchmarks benchrefB