diff --git a/.travis.yml b/.travis.yml index 51978133..03996658 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/LICENSE b/LICENSE index ce324571..715105c1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ License - Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. Produced at the Lawrence Livermore National Laboratory diff --git a/Makefile b/Makefile index c6989158..b06a94af 100644 --- a/Makefile +++ b/Makefile @@ -1,33 +1,13 @@ PREFIX ?= /usr DESTDIR ?= -#CXX ?= clang++ -CXX ?= g++ RM ?= rm -f RMDIR ?= rm -rf -TARGET ?= $(LIBDIR)/libflit.so -LIBDIR := lib -SRCDIR := src +MKDIR ?= mkdir -m 0755 -p -CXXFLAGS += -Wuninitialized -g -CXXFLAGS += -fPIC -CXXFLAGS += -std=c++11 -CXXFLAGS += -Wno-shift-count-overflow -CXXFLAGS += -Wall -CXXFLAGS += -Wextra -CXXFLAGS += -Werror -CXXFLAGS += -I. - -LDFLAGS += -shared -LDLIBS += -lm - -DEPFLAGS += -MD -MF $(SRCDIR)/$*.d - -SOURCE := $(wildcard $(SRCDIR)/*.cpp) -HEADERS += $(wildcard $(SRCDIR)/*.h) - -OBJ := $(SOURCE:.cpp=.o) -DEPS := $(SOURCE:.cpp=.d) +SOURCE := $(wildcard src/flit/*.cpp) +HEADERS := src/flit.h +FLIT_HEADERS += $(wildcard src/flit/*.h) # Install variables @@ -43,12 +23,10 @@ INST_BINDIR := $(EFFECTIVE_PREFIX)/bin INST_LIBDIR := $(EFFECTIVE_PREFIX)/lib INST_INCLUDEDIR := $(EFFECTIVE_PREFIX)/include/flit INST_SHAREDIR := $(EFFECTIVE_PREFIX)/share/flit +INST_SRCDIR := $(EFFECTIVE_PREFIX)/share/flit/src INST_LICENSEDIR := $(EFFECTIVE_PREFIX)/share/licenses/flit INST_FLIT_CONFIG := $(EFFECTIVE_PREFIX)/share/flit/scripts/flitconfig.py -CAT := $(if $(filter $(OS),Windows_NT),type,cat) -VERSION := $(shell $(CAT) $(CONFIG_DIR)/version.txt) - -include tests/color_out.mk # Be silent by default @@ -56,76 +34,53 @@ ifndef VERBOSE .SILENT: endif -.PHONY : all -all: $(TARGET) - .PHONY: help help: + @echo @echo "FLiT is an automation and analysis tool for reproducibility of" @echo "floating-point algorithms with respect to compilers, architectures," @echo "and compiler flags." @echo @echo "The following targets are available:" @echo - @echo " all Compiles the target $(TARGET)" - @echo " help Shows this help message and exits" + @echo " help Shows this help message and exits (default)" @echo " install Installs FLiT. You may override the PREFIX variable" @echo " to install to a different directory. The default" @echo " PREFIX value is /usr." @echo ' exe: "make install PREFIX=$$HOME/installs/usr"' - @echo " check Run tests for FLiT framework (requires $(TARGET))" - @echo " clean Clean the intermediate build artifacts from building" - @echo " $(TARGET)" - @echo " distclean Run clean and then also remove $(TARGET)" - @echo " veryclean An alias for distclean" + @echo " uninstall Delete a FLiT installation. You must use the same" + @echo " PREFIX value used during installation." + @echo " check Run tests for FLiT framework" + @echo " clean Clean up after the tests" @echo -$(TARGET): $(OBJ) - @$(call color_out_noline,CYAN, mkdir) - @echo " lib" - mkdir -p lib - @$(call color_out,BLUE,Building $(TARGET)) - $(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS) - -$(SRCDIR)/%.o: $(SRCDIR)/%.cpp Makefile - @$(call color_out,CYAN, $< -> $@) - $(CXX) $(CXXFLAGS) $(DEPFLAGS) -c $< -o $@ - -.PRECIOUS: src/%.d --include $(SOURCE:%.cpp=%.d) - -check: $(TARGET) +.PHONY: check +check: $(MAKE) check --directory tests .PHONY: clean clean: - $(RM) $(OBJ) - $(RM) $(DEPS) $(MAKE) clean --directory tests -.PHONY: veryclean distclean -veryclean: distclean -distclean: clean - $(RM) $(TARGET) - $(RMDIR) $(LIBDIR) - .PHONY: install -install: $(TARGET) - @$(call color_out,BLUE,Installing...) - mkdir -m 0755 -p $(INST_BINDIR) - mkdir -m 0755 -p $(INST_LIBDIR) - mkdir -m 0755 -p $(INST_INCLUDEDIR) - mkdir -m 0755 -p $(INST_SHAREDIR)/scripts/experimental - mkdir -m 0755 -p $(INST_SHAREDIR)/doc - mkdir -m 0755 -p $(INST_SHAREDIR)/data/tests - mkdir -m 0755 -p $(INST_SHAREDIR)/data/db - mkdir -m 0755 -p $(INST_SHAREDIR)/config - mkdir -m 0755 -p $(INST_SHAREDIR)/litmus-tests - mkdir -m 0755 -p $(INST_SHAREDIR)/benchmarks - mkdir -m 0755 -p $(INST_LICENSEDIR) +install: + @$(call color_out,BLUE,Installing: DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)) + $(MKDIR) $(INST_BINDIR) + $(MKDIR) $(INST_INCLUDEDIR) + $(MKDIR) $(INST_SHAREDIR)/scripts/experimental + $(MKDIR) $(INST_SHAREDIR)/doc + $(MKDIR) $(INST_SHAREDIR)/data/tests + $(MKDIR) $(INST_SHAREDIR)/data/db + $(MKDIR) $(INST_SHAREDIR)/config + $(MKDIR) $(INST_SHAREDIR)/litmus-tests + $(MKDIR) $(INST_SHAREDIR)/benchmarks + $(MKDIR) $(INST_SRCDIR) + $(MKDIR) $(INST_LICENSEDIR) + @$(call color_out,CYAN, Creating command-line symbolic link $(INST_BINDIR)/flit) ln -sf ../share/flit/scripts/flit.py $(INST_BINDIR)/flit - install -m 0755 $(TARGET) $(INST_LIBDIR)/$(notdir $(TARGET)) - install -m 0644 $(HEADERS) $(INST_INCLUDEDIR) + install -m 0644 $(HEADERS) $(EFFECTIVE_PREFIX)/include + install -m 0644 $(FLIT_HEADERS) $(INST_INCLUDEDIR) + install -m 0644 $(SOURCE) $(INST_SRCDIR) install -m 0755 $(SCRIPT_DIR)/flit.py $(INST_SHAREDIR)/scripts/ install -m 0755 $(SCRIPT_DIR)/flit_*.py $(INST_SHAREDIR)/scripts/ install -m 0755 $(SCRIPT_DIR)/experimental/flit_*.py $(INST_SHAREDIR)/scripts/experimental/ @@ -159,7 +114,7 @@ install: $(TARGET) @echo " 'version'," >> $(INST_FLIT_CONFIG) @echo " 'script_dir'," >> $(INST_FLIT_CONFIG) @echo " 'doc_dir'," >> $(INST_FLIT_CONFIG) - @echo " 'lib_dir'," >> $(INST_FLIT_CONFIG) + @echo " 'src_dir'," >> $(INST_FLIT_CONFIG) @echo " 'include_dir'," >> $(INST_FLIT_CONFIG) @echo " 'config_dir'," >> $(INST_FLIT_CONFIG) @echo " 'data_dir'," >> $(INST_FLIT_CONFIG) @@ -176,11 +131,11 @@ install: $(TARGET) @echo "# flit documentation" >> $(INST_FLIT_CONFIG) @echo "doc_dir = os.path.join(_prefix, 'share', 'flit', 'doc')" >> $(INST_FLIT_CONFIG) @echo >> $(INST_FLIT_CONFIG) - @echo "# compiled libflit.so" >> $(INST_FLIT_CONFIG) - @echo "lib_dir = os.path.join(_prefix, 'lib')" >> $(INST_FLIT_CONFIG) + @echo "# flit C++ include files, primarily flit/flit.h" >> $(INST_FLIT_CONFIG) + @echo "include_dir = os.path.join(_prefix, 'include')" >> $(INST_FLIT_CONFIG) @echo >> $(INST_FLIT_CONFIG) - @echo "# flit C++ include files, primarily flit.h" >> $(INST_FLIT_CONFIG) - @echo "include_dir = os.path.join(_prefix, 'include', 'flit')" >> $(INST_FLIT_CONFIG) + @echo "# flit C++ source files" >> $(INST_FLIT_CONFIG) + @echo "src_dir = os.path.join(_prefix, 'share', 'flit', 'src')" >> $(INST_FLIT_CONFIG) @echo >> $(INST_FLIT_CONFIG) @echo "# default configuration for flit init" >> $(INST_FLIT_CONFIG) @echo "config_dir = os.path.join(_prefix, 'share', 'flit', 'config')" >> $(INST_FLIT_CONFIG) @@ -199,15 +154,16 @@ install: $(TARGET) .PHONY: uninstall uninstall: - @$(call color_out,BLUE,Uninstalling...) + @$(call color_out_noline,BLUE,Uninstalling... ) $(RMDIR) $(INST_INCLUDEDIR) + $(RMDIR) $(INST_SRCDIR) $(RMDIR) $(INST_SHAREDIR) $(RMDIR) $(INST_LICENSEDIR) $(RM) $(INST_BINDIR)/flit - $(RM) $(INST_LIBDIR)/$(notdir $(TARGET)) - -rmdir --ignore-fail-on-non-empty $(EFFECTIVE_PREFIX)/include - -rmdir --ignore-fail-on-non-empty $(EFFECTIVE_PREFIX)/share/licenses - -rmdir --ignore-fail-on-non-empty $(EFFECTIVE_PREFIX)/share - -rmdir --ignore-fail-on-non-empty $(EFFECTIVE_PREFIX)/bin - -rmdir --ignore-fail-on-non-empty $(EFFECTIVE_PREFIX)/lib - -rmdir --ignore-fail-on-non-empty $(EFFECTIVE_PREFIX) + $(RM) $(EFFECTIVE_PREFIX)/include/flit.h + -rmdir --ignore-fail-on-non-empty $(EFFECTIVE_PREFIX)/include 2>/dev/null + -rmdir --ignore-fail-on-non-empty $(EFFECTIVE_PREFIX)/share/licenses 2>/dev/null + -rmdir --ignore-fail-on-non-empty $(EFFECTIVE_PREFIX)/share 2>/dev/null + -rmdir --ignore-fail-on-non-empty $(EFFECTIVE_PREFIX)/bin 2>/dev/null + -rmdir --ignore-fail-on-non-empty $(EFFECTIVE_PREFIX) 2>/dev/null + @$(call color_out,GREEN,Done) diff --git a/README.md b/README.md index b673adac..a8d0fc4c 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@ [![FLiT Bird](/images/flit-small.png)](https://github.com/PRUNERS/FLiT "FLiT") -Floating-point Litmus Tests (FLiT) is a C++ test infrastructure for detecting -variability in floating-point code caused by variations in compiler code -generation, hardware and execution environments. +FLiT is a C++ test infrastructure for detecting variability in floating-point +code caused by variations in compiler code generation, hardware and execution +environments. Originally, FLiT stood for "Floating-point Litmus Tests", but has grown into a tool with much more flexability than to study simple litmus tests. However, it @@ -33,6 +33,11 @@ difference is typically very small. But there are situations where 3. Your application is so large (such as a weather simulation) that a small change may propagate into very large result variability. +_Note: It may be the variability observed is more a cause of bad programming +practice than over-aggressive compiler optimizations. In this case, compiler +optimizations may act as fuzzers for your code. It is up to you to determine +if this is the case._ + FLiT helps developers determine where reproducibility problems may occur due to compilers. The developer creates reproducibility tests with their code using the FLiT testing framework. Then FLiT takes those reproducibility tests and @@ -45,7 +50,7 @@ More than simply comparing against a "ground truth" test result, the FLiT framework also measures runtime of your tests. Using this information, you can not only determine which compilations of your code are safe for your specific application, but you can also determine the fastest safe compilation. This -ability helps the developer navigate the tradeoff between reproducibility and +ability helps the developer navigate the trade-off between reproducibility and performance. It consists of the following components: diff --git a/benchmarks/polybench/main.cpp b/benchmarks/polybench/main.cpp index 5b4dbcdb..e35daceb 100644 --- a/benchmarks/polybench/main.cpp +++ b/benchmarks/polybench/main.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -81,7 +81,7 @@ * -- LICENSE END -- */ -#include "flit.h" +#include int main(int argCount, char* argList[]) { return flit::runFlitTests(argCount, argList); diff --git a/benchmarks/polybench/tests/adi.cpp b/benchmarks/polybench/tests/adi.cpp index 507d035a..5cf359ea 100644 --- a/benchmarks/polybench/tests/adi.cpp +++ b/benchmarks/polybench/tests/adi.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/atax.cpp b/benchmarks/polybench/tests/atax.cpp index 5614b828..83ac2ca0 100644 --- a/benchmarks/polybench/tests/atax.cpp +++ b/benchmarks/polybench/tests/atax.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/bicg.cpp b/benchmarks/polybench/tests/bicg.cpp index 37b027c1..1f5e9b24 100644 --- a/benchmarks/polybench/tests/bicg.cpp +++ b/benchmarks/polybench/tests/bicg.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/cholesky.cpp b/benchmarks/polybench/tests/cholesky.cpp index 258d850f..98d7a3c0 100644 --- a/benchmarks/polybench/tests/cholesky.cpp +++ b/benchmarks/polybench/tests/cholesky.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/correlation.cpp b/benchmarks/polybench/tests/correlation.cpp index 7a7ccc5a..5c8e2dcb 100644 --- a/benchmarks/polybench/tests/correlation.cpp +++ b/benchmarks/polybench/tests/correlation.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/covariance.cpp b/benchmarks/polybench/tests/covariance.cpp index d0c09788..cc837b84 100644 --- a/benchmarks/polybench/tests/covariance.cpp +++ b/benchmarks/polybench/tests/covariance.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/deriche.cpp b/benchmarks/polybench/tests/deriche.cpp index 681a1148..83881a77 100644 --- a/benchmarks/polybench/tests/deriche.cpp +++ b/benchmarks/polybench/tests/deriche.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/doitgen.cpp b/benchmarks/polybench/tests/doitgen.cpp index 7d208a2d..4c239c45 100644 --- a/benchmarks/polybench/tests/doitgen.cpp +++ b/benchmarks/polybench/tests/doitgen.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/durbin.cpp b/benchmarks/polybench/tests/durbin.cpp index a0eee597..71bf0bd7 100644 --- a/benchmarks/polybench/tests/durbin.cpp +++ b/benchmarks/polybench/tests/durbin.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/fdtd_2d.cpp b/benchmarks/polybench/tests/fdtd_2d.cpp index 744781c7..aaed2e72 100644 --- a/benchmarks/polybench/tests/fdtd_2d.cpp +++ b/benchmarks/polybench/tests/fdtd_2d.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/floyd_warshall.cpp b/benchmarks/polybench/tests/floyd_warshall.cpp index 2f0b8b48..ae5fde4c 100644 --- a/benchmarks/polybench/tests/floyd_warshall.cpp +++ b/benchmarks/polybench/tests/floyd_warshall.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/gemm.cpp b/benchmarks/polybench/tests/gemm.cpp index b9c0cb57..91cd1595 100644 --- a/benchmarks/polybench/tests/gemm.cpp +++ b/benchmarks/polybench/tests/gemm.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/gemver.cpp b/benchmarks/polybench/tests/gemver.cpp index 6852e99a..ae313c5d 100644 --- a/benchmarks/polybench/tests/gemver.cpp +++ b/benchmarks/polybench/tests/gemver.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/gesummv.cpp b/benchmarks/polybench/tests/gesummv.cpp index 58bfd8ec..d7c13aaa 100644 --- a/benchmarks/polybench/tests/gesummv.cpp +++ b/benchmarks/polybench/tests/gesummv.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/gramschmidt.cpp b/benchmarks/polybench/tests/gramschmidt.cpp index bd2ee3f0..06f7442f 100644 --- a/benchmarks/polybench/tests/gramschmidt.cpp +++ b/benchmarks/polybench/tests/gramschmidt.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/heat_3d.cpp b/benchmarks/polybench/tests/heat_3d.cpp index 164e47a6..066658bd 100644 --- a/benchmarks/polybench/tests/heat_3d.cpp +++ b/benchmarks/polybench/tests/heat_3d.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/jacobi_1d.cpp b/benchmarks/polybench/tests/jacobi_1d.cpp index 96a9031c..3d622cda 100644 --- a/benchmarks/polybench/tests/jacobi_1d.cpp +++ b/benchmarks/polybench/tests/jacobi_1d.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/jacobi_2d.cpp b/benchmarks/polybench/tests/jacobi_2d.cpp index e8e52691..227343c2 100644 --- a/benchmarks/polybench/tests/jacobi_2d.cpp +++ b/benchmarks/polybench/tests/jacobi_2d.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/lu.cpp b/benchmarks/polybench/tests/lu.cpp index 2878742b..5dab1cbe 100644 --- a/benchmarks/polybench/tests/lu.cpp +++ b/benchmarks/polybench/tests/lu.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/ludcmp.cpp b/benchmarks/polybench/tests/ludcmp.cpp index 734428b4..63ee774d 100644 --- a/benchmarks/polybench/tests/ludcmp.cpp +++ b/benchmarks/polybench/tests/ludcmp.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/mvt.cpp b/benchmarks/polybench/tests/mvt.cpp index 5790de26..9f7d7f88 100644 --- a/benchmarks/polybench/tests/mvt.cpp +++ b/benchmarks/polybench/tests/mvt.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/nussinov.cpp b/benchmarks/polybench/tests/nussinov.cpp index 2c1b0967..e323d3d9 100644 --- a/benchmarks/polybench/tests/nussinov.cpp +++ b/benchmarks/polybench/tests/nussinov.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/polybench_utils.h b/benchmarks/polybench/tests/polybench_utils.h index 6f922b89..099ec528 100644 --- a/benchmarks/polybench/tests/polybench_utils.h +++ b/benchmarks/polybench/tests/polybench_utils.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/benchmarks/polybench/tests/seidel_2d.cpp b/benchmarks/polybench/tests/seidel_2d.cpp index 4c08ad4a..b877d1c6 100644 --- a/benchmarks/polybench/tests/seidel_2d.cpp +++ b/benchmarks/polybench/tests/seidel_2d.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/symm.cpp b/benchmarks/polybench/tests/symm.cpp index ed66954b..8eeb234c 100644 --- a/benchmarks/polybench/tests/symm.cpp +++ b/benchmarks/polybench/tests/symm.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/syr2k.cpp b/benchmarks/polybench/tests/syr2k.cpp index 05324d36..27b8fa69 100644 --- a/benchmarks/polybench/tests/syr2k.cpp +++ b/benchmarks/polybench/tests/syr2k.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/syrk.cpp b/benchmarks/polybench/tests/syrk.cpp index 324b61df..bcd6b575 100644 --- a/benchmarks/polybench/tests/syrk.cpp +++ b/benchmarks/polybench/tests/syrk.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/test2mm.cpp b/benchmarks/polybench/tests/test2mm.cpp index 88550c2d..4ad8c4da 100644 --- a/benchmarks/polybench/tests/test2mm.cpp +++ b/benchmarks/polybench/tests/test2mm.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/test3mm.cpp b/benchmarks/polybench/tests/test3mm.cpp index 8162219a..5e56b300 100644 --- a/benchmarks/polybench/tests/test3mm.cpp +++ b/benchmarks/polybench/tests/test3mm.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/trisolv.cpp b/benchmarks/polybench/tests/trisolv.cpp index 9770bb7c..689a18f9 100644 --- a/benchmarks/polybench/tests/trisolv.cpp +++ b/benchmarks/polybench/tests/trisolv.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/polybench/tests/trmm.cpp b/benchmarks/polybench/tests/trmm.cpp index 1719686d..f4ba5be2 100644 --- a/benchmarks/polybench/tests/trmm.cpp +++ b/benchmarks/polybench/tests/trmm.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "polybench_utils.h" -#include +#include #include diff --git a/benchmarks/random/main.cpp b/benchmarks/random/main.cpp index 5b4dbcdb..e35daceb 100644 --- a/benchmarks/random/main.cpp +++ b/benchmarks/random/main.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -81,7 +81,7 @@ * -- LICENSE END -- */ -#include "flit.h" +#include int main(int argCount, char* argList[]) { return flit::runFlitTests(argCount, argList); diff --git a/benchmarks/random/tests/Rand.cpp b/benchmarks/random/tests/Rand.cpp index ba35c481..70512c03 100644 --- a/benchmarks/random/tests/Rand.cpp +++ b/benchmarks/random/tests/Rand.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -81,7 +81,7 @@ * -- LICENSE END -- */ -#include +#include #include #include diff --git a/benchmarks/random/tests/Random.cpp b/benchmarks/random/tests/Random.cpp index d4f277db..24d8cdbd 100644 --- a/benchmarks/random/tests/Random.cpp +++ b/benchmarks/random/tests/Random.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -81,7 +81,7 @@ * -- LICENSE END -- */ -#include +#include #include #include diff --git a/data/Makefile.in b/data/Makefile.in index af97d26a..fb724e35 100644 --- a/data/Makefile.in +++ b/data/Makefile.in @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # @@ -101,7 +101,8 @@ COMPILERS := {compilers} {compiler_fixed_link_flags} FLIT_INC_DIR := {flit_include_dir} -FLIT_LIB_DIR := {flit_lib_dir} +FLIT_SRC_DIR := {flit_src_dir} +FLIT_SRC := $(FLIT_SRC_DIR)/ALL-FLIT.cpp FLIT_DATA_DIR := {flit_data_dir} FLIT_SCRIPT_DIR := {flit_script_dir} @@ -159,13 +160,6 @@ DEV_CXXFLAGS += -Wno-shift-count-overflow LDLIBS += -lm LDLIBS += -lstdc++ -LDLIBS += -lflit -ifeq ($(UNAME_S),Darwin) # If we are on a Mac OSX system - LDFLAGS += -Llib -else - LDFLAGS += -L$(FLIT_LIB_DIR) - LDFLAGS += -Wl,-rpath=$(realpath $(FLIT_LIB_DIR)) -endif # Be silent by default ifndef VERBOSE @@ -249,18 +243,6 @@ MKDIR = \ @$(call color_out,BROWN, mkdir $@); \ mkdir -p $@ -# For OS X support, we copy the libflit.so to a subdirectory -ifeq ($(UNAME_S),Darwin) -LIBFLIT := lib/libflit.so -$(LIBFLIT): $(FLIT_LIB_DIR)/libflit.so | lib - @$(call color_out,CYAN, $< -> $@) - cp $< $@ -lib: - +$(MKDIR) $@ -else -LIBFLIT := $(FLIT_LIB_DIR)/libflit.so -endif # end of ifeq ($(UNAME_S),Darwin) - # individual flags ## optls @@ -385,10 +367,6 @@ ALL_DIRS += $(foreach c,$(COMPILERS),\ $(foreach o,$(OPCODES_$(strip $c)),\ $(OBJ_DIR)/$c_$s_$o))) -ifeq ($(UNAME_S),Darwin) -ALL_DIRS += lib -endif - recursion-target: $(ALL_DIRS) $(ALL_DIRS): @@ -477,13 +455,14 @@ $2: $1 Makefile custom.mk | $(patsubst %/,%,$(dir $2)) endef R_OBJ := $(addprefix $(R_OBJ_DIR)/,$(notdir $(SOURCE:%=%.o))) +R_OBJ += $(addprefix $(R_OBJ_DIR)/,$(notdir $(FLIT_SRC:%=%.o))) R_DEP := $(R_OBJ:%.o=%.d) -include $(R_DEP) recursion-target: $(R_TARGET) -$(R_TARGET): $(R_OBJ) $(LIBFLIT) +$(R_TARGET): $(R_OBJ) @$(call color_out,BLUE, Creating $(R_TARGET)) @+mkdir -p $(dir $@) $(R_COMPILER) -o $@ $(R_OPTL) $(R_SWITCHES) $(R_CXXFLAGS) $(CXXFLAGS) \ @@ -492,7 +471,7 @@ $(R_TARGET): $(R_OBJ) $(LIBFLIT) $(R_OBJ_DIR): +$(MKDIR) $@ -$(foreach s,$(SOURCE), \ +$(foreach s,$(SOURCE) $(FLIT_SRC), \ $(eval $(call COMPILE_RULE,\ $s,\ $(R_OBJ_DIR)/$(notdir $s).o,\ diff --git a/data/Makefile_bisect_binary.in b/data/Makefile_bisect_binary.in index ce3693dc..7a24858a 100644 --- a/data/Makefile_bisect_binary.in +++ b/data/Makefile_bisect_binary.in @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # @@ -301,6 +301,7 @@ SPLIT_OBJ += $(addprefix \ $(SPLIT_DIR)/,$(notdir \ $(SPLIT_SRC:%=%_trouble_split_$(NUMBER).o))) BISECT_OBJ := $(BISECT_GT_OBJ) +BISECT_OBJ += $(GT_OBJ_DIR)/ALL-FLIT.cpp.o BISECT_OBJ += $(TROUBLE_OBJ) BISECT_OBJ += $(SPLIT_OBJ) BISECT_DEP := $(BISECT_OBJ:%.o=%.d) @@ -333,7 +334,7 @@ define COMPILE_OR_COPY_RULE $2: $1 Makefile custom.mk | $(patsubst %/,%,$(dir $2)) if [ -f "$(strip $8)/$(notdir $2)" ]; then \ $(call color_out,CYAN, $8/$(notdir $2) -> $2); \ - ln -s $(shell realpath --relative-to $(dir $2) $(strip $8)/$(notdir $2)) $2; \ + ln -s $$(shell realpath --relative-to $(dir $2) $(strip $8)/$(notdir $2)) $2; \ else \ $(call color_out,CYAN, $1 -> $2); \ $3 $4 $5 -c $(CXXFLAGS) $(DEPFLAGS) $(2:%.o=%.d) $7 $1 -o $2 \ @@ -358,7 +359,7 @@ $(foreach s,$(TROUBLE_SRC),\ $(BISECT_OBJ_DIR)))) # compile GT fPIC object files -$(foreach s,$(SPLIT_SRC),\ +$(foreach s,$(SPLIT_SRC) $(FLIT_SRC),\ $(eval $(call COMPILE_OR_COPY_RULE,\ $s,\ $(FPIC_DIR)/gt/$(notdir $s).o,\ @@ -409,4 +410,4 @@ $(foreach s,$(SPLIT_SRC),\ $(SPLIT_DIR)/$(notdir $s)_trouble_split_$(NUMBER).o,\ $(SYMBOLS_DIR)/$(notdir $s)_gt_symbols_$(NUMBER).txt))) -endif +endif # of ifeq ($(R_TYPE),bisect-compile) diff --git a/data/custom.mk b/data/custom.mk index ac98a74c..cbc86205 100644 --- a/data/custom.mk +++ b/data/custom.mk @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/data/db/tables-sqlite.sql b/data/db/tables-sqlite.sql index 5401eb36..c206216b 100644 --- a/data/db/tables-sqlite.sql +++ b/data/db/tables-sqlite.sql @@ -1,6 +1,6 @@ -- -- LICENSE BEGIN -- -- --- Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +-- Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. -- -- Produced at the Lawrence Livermore National Laboratory -- diff --git a/data/main.cpp b/data/main.cpp index dbc94a1a..b3c64dae 100644 --- a/data/main.cpp +++ b/data/main.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -79,7 +79,7 @@ * purposes. * * -- LICENSE END -- */ -#include "flit.h" +#include int main(int argCount, char* argList[]) { return flit::runFlitTests(argCount, argList); diff --git a/data/tests/Empty.cpp b/data/tests/Empty.cpp index fabfa573..a8a00db4 100644 --- a/data/tests/Empty.cpp +++ b/data/tests/Empty.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -79,7 +79,7 @@ * purposes. * * -- LICENSE END -- */ -#include +#include #include diff --git a/documentation/experimental-features.md b/documentation/experimental-features.md index e9729822..6e06631b 100644 --- a/documentation/experimental-features.md +++ b/documentation/experimental-features.md @@ -6,7 +6,7 @@ | [Next](autogenerated-tests.md) -There are experimental featues not yet ready for prime-time. They may end up +There are experimental features not yet ready for prime-time. They may end up in flit as a permanent thing or they may be deemed too much work or not useful enough to become a full feature. Those features may stay as experimental features, or they may disappear entirely. diff --git a/documentation/flit-command-line.md b/documentation/flit-command-line.md index 366d67aa..16cf6d27 100644 --- a/documentation/flit-command-line.md +++ b/documentation/flit-command-line.md @@ -206,7 +206,7 @@ bisect invocation if the given compiler is found within `flit-config.toml`. Call `flit bisect --help` for more documentation. -## flit expeirmental +## flit experimental There may or may not be any experimental features currently available. These features are available by the `flit experimental` command. Please call `flit diff --git a/documentation/flit-helpers.md b/documentation/flit-helpers.md index 10cb1012..a4863086 100644 --- a/documentation/flit-helpers.md +++ b/documentation/flit-helpers.md @@ -178,7 +178,7 @@ would join path elements properly. Note, you can pass in as many arguments to this function as you want. ```c++ -auto full_path = flit::join("/home", "user", "git", "FLiT", "src", "fsutil.h"); +auto full_path = flit::join("/home", "user", "git", "FLiT", "src", "flit", "fsutil.h"); ``` @@ -488,7 +488,7 @@ to illustrate how to use the functions declared in `src/subprocess.h` to run a `main()` function. ```c++ -#include +#include #define main my_main #include "main.cc" diff --git a/documentation/installation.md b/documentation/installation.md index d9a9008e..75303cb7 100644 --- a/documentation/installation.md +++ b/documentation/installation.md @@ -10,8 +10,6 @@ Instruction Contents: * [Prerequisites](#prerequisites) * [Compilers](#compilers) - * [Clang Only](#clang-only) - * [Non-Standard Installs](#non-standard-installs) * [Optional Dependencies](#optional-dependencies) * [FLiT Setup](#flit-setup) * [Database Setup](#database-setup) @@ -36,8 +34,8 @@ Stuff you may need to get parsing ELF files. This is used for `flit bisect`; all other functionality will work without it. * [make](https://www.gnu.org/software/make) -* [gcc](https://gcc.gnu.org) version 4.9 or higher (or - [clang](https://clang.llvm.org), see section [Clang Only](#clang-only)) +* A C++11 compatible compiler + (see section [Compilers](#compilers) for supported versions) * [sqlite3](https://sqlite.org) version 3.0 or higher. You can use the one that comes with python, or install as a standalone. @@ -76,13 +74,10 @@ executable. ### Compilers -The GCC compiler is the only one required for installation of FLiT since it is -used to compile the FLiT shared library. Other than that, you are free to -install another version of GCC, as well as Clang and the Intel compiler. If -you are missing either Clang or the Intel compiler, FLiT will still work as -expected. +FLiT officially supports the use of GCC, Clang, and Intel compilers for C++. +You may try to use other compilers, but they are not yet officially supported. -The supported compiler versions are: +Supported compiler versions: | Compiler Type | Minimum Supported Version | |:-------------:|:-------------------------:| @@ -90,7 +85,7 @@ The supported compiler versions are: | clang | 3.4.0 | | intel | 16.0 | -If your compiler version is below those on this list and you want FLiT to +If your compiler version is less than the supported versions and you want FLiT to support it, please create an [issue](https://github.com/PRUNERS/FLiT/issues) and we may be able to add support for you. Otherwise, you are on your own. @@ -99,72 +94,32 @@ PGI compiler or the IBM compiler, please create an [issue](https://github.com/PRUNERS/FLiT/issues). -### Clang Only +### Compiling FLiT -FLiT is mostly geared around having at least GCC around, however, users may -want to skip using GCC and use Clang instead. If this is your use case, this -can be done. +FLiT no longer needs to be compiled. A design decision was made to have each +test executable compilation to compile in the FLiT source code directly. This +decision was made specifically because of the C++ standard library +incompatibility (see [Standard C++ Library +Implementations](standard-c++-library-implementations.md)). Before, when FLiT +was compiled as `libflit.so`, it restricted the user to only the standard +library used to compile that library. -To compile FLiT using Clang, set the `CXX` environment variable to the -executable for Clang you wish to use. For example: +Now that FLiT is compiled into the executable, the user may play around with +many different standard library implementations. It makes the installation of +FLiT much more flexible as well. -```bash -git clone https://github.com/PRUNERS/FLiT.git -cd FLiT -export CXX=clang -make -sudo make install -``` - -Then when creating your environment, simply provide only a Clang compiler. -This setup is largely untested, so if you have trouble, please submit an -[issue](https://github.com/PRUNERS/FLiT/issues). - - -### Non-Standard Installs - -Warning: the FLiT shared library should be compiled with the same standard library -that will be used by the FLiT tests. By default, FLiT is compiled using GCC, -unless the user specifies a different compiler using the `CXX` variable. This -will cause the flit shared library to be linked against `libstdc++`, which is -GCC's standard C++ library. If you do not compile your tests with the same -standard library, you may get linker errors. - -If you want to use a GCC compiler that is not in the standard installation -location, you can still use it. As an example, suppose I do not want to use -the GCC installed on the system, but instead I want to use the one I compiled -myself and installed into `$HOME/installs/gcc-5.5.0`. The way I would compile -the FLiT shared library would be: - -```bash -CXX="$HOME/installs/gcc-5.5.0/bin/g++" LDFLAGS="-Wl,-rpath=$HOME/installs/gcc-5.5.0/lib64" make -``` - -The `CXX` flag could be specified after `make`, but `LDFLAGS` should be -specified before it so that it prepends the variable rather than completely -overriding it. If you were to have done the following instead: - -```bash -make CXX="$HOME/installs/gcc-5.5.0/bin/g++" LDFLAGS="-Wl,-rpath=$HOME/installs/gcc-5.5.0/lib64" -``` - -It would delete the other necessary `LDFLAGS` set within the `Makefile`. This -would be the approach if you really desired to override the internal settings -of the variable. - -Note that without the `LDFLAGS` variable, the wrong version of `libstdc++.so` -would be used at runtime, as it would likely find the one from the installed -GCC rather than the one I compiled myself. Another solution instead of using -rpath is to set the `LD_LIBRARY_PATH` before running anything with FLiT, but it -is recommended to use rpath instead. +The downside is the recompilation of the FLiT source code over and over again. +To partially alleviate this concern, we used an approach of a [Unity +Build](https://buffered.io/posts/the-magic-of-unity-builds/). Please refer to +[Issue #210](https://github.com/PRUNERS/FLiT/issues/210) to see the discussion +behind this design decision, along with the pros and cons. ### Optional Dependencies -FLiT has [MPI support](mpi-support.md) which you may want to use. To compile -and install FLiT, MPI does not need to be installed. If you later choose the -use MPI, you only need it installed when you go to compile the tests that -require it. +The FLiT source code is compiled dynamically with your FLiT tests. Therefore, +it only matters what optional dependencies are installed at the time of using +your FLiT tests, not at the time of installation. If you choose to use MPI support, you likely know what you need. FLiT requires that both `mpic++` and `mpirun` are found in the system `PATH`. On Ubuntu, @@ -180,26 +135,58 @@ Or you can alternatively use MPICH sudo apt install mpich ``` -## FLiT Setup +FLiT also officially supports Intel's MPI implementation. We would like to +support all implementations of MPI, but on an as-needed basis. If you are +using a different implementation of MPI and you find it does not work with +FLiT, please submit an [issue](https://github.com/PRUNERS/FLiT/issues). -You will need FLiT available and compiled. It can be optionally installed. +## FLiT Setup ```bash git clone https://github.com/PRUNERS/FLiT.git cd FLiT -make ``` -_Note: if you want to see all of the compilation details, set `VERBOSE=1`, -e.g., `make VERBOSE=1`_ +Since FLiT is not pre-compiled, you may be wondering what the top-level +`Makefile` is for. The default target is the `help` target explaining about +the available targets. + +```bash +FLiT is an automation and analysis tool for reproducibility of +floating-point algorithms with respect to compilers, architectures, +and compiler flags. + +The following targets are available: + + help Shows this help message and exits (default) + install Installs FLiT. You may override the PREFIX variable + to install to a different directory. The default + PREFIX value is /usr. + exe: "make install PREFIX=$HOME/installs/usr" + uninstall Delete a FLiT installation. You must use the same + PREFIX value used during installation. + check Run tests for FLiT framework + clean Clean up after the tests +``` + +You do not need to install FLiT in order to use it. It may be either used from +the Git repository (or extracted release tar file), or you may install with +whatever PREFIX you prefer. + +To use FLiT from the repository, simply use the `scripts/flitcli/flit.py` +script directly. You may use an alias for it or a symbolic link. -You can either use the flit command-line tool from the git repository or you -can install it. If you choose to install it, it is simply +If you choose to install ```bash -sudo make install +make install ``` +The `flit` command-line tool will be symbolically linked as `$PREFIX/bin/flit` + +_Note: if you want to see all of the installation details, set `VERBOSE=1`, +a.k.a., `make install VERBOSE=1`_ + If you want to specify an install prefix, you do that by specifying the `PREFIX` variable to make @@ -216,7 +203,9 @@ for more information about `DESTDIR`. Note, installations in `DESTDIR` are typically not guaranteed to work as-is until they are copied to the given `PREFIX`, however FLiT guarantees that it will work in both situations. You may copy the files in `PREFIX` anywhere and -it will work, granted you maintain the same directory heirarchy. +it will work, granted you maintain the same directory hierarchy. If it does +not work in this situation, then it is a bug -- please submit an +[issue](https://github.com/PRUNERS/FLiT/issues). If you do not want to install somewhere and want to use the flit command-line tool from the cloned git repository, simply make a symbolic link to the diff --git a/documentation/mpi-support.md b/documentation/mpi-support.md index 97053e1b..55c9d274 100644 --- a/documentation/mpi-support.md +++ b/documentation/mpi-support.md @@ -13,22 +13,9 @@ details of this, a word of caution: _**Warning**: FLiT requires test results to be exactly deterministic in order to function properly and to give meaningful and trustworthy results. By using MPI, it is highly likely that nondeterminism can be introduced by concurrency. -It is the responsability of the test engineer to ensure the code under test is -deterministic. FLiT gives no guarantee for nondeterministic code._ - - -## Compiling FLiT with MPI Support - -To compile FLiT with MPI support is actually not necessary. The actual -compiled FLiT shared library has no need to contain any MPI code, so there is -no need to recompile FLiT to have MPI support. This also means that an MPI -implementation does not need to be installed in order to compile and install -FLiT. This may change in future versions, but as of now, you can simply enable -MPI support in the tests. - -This has an added benefit of not requiring to recompile FLiT if you change your -implementation of MPI you want to use. FLiT will not need to be recompiled, -just the tests. +It is the responsibility of the test engineer to ensure the code under test is +deterministic. It may work, but FLiT gives no guarantee for nondeterministic +code._ ## Enabling MPI Support @@ -54,68 +41,24 @@ mean a function taking in an `int` and a `char**` and returning and `int`. Please see [Writing Test Cases: Writing MPI Tests](writing-test-cases.md#writing-mpi-tests) for more information. -## Initializing and Finalizing the MPI Environment - -Since the MPI standard recommends to initialize the MPI environment as close to -the beginning of the application as possible, when MPI support is enabled for -your tests, the FLiT framework will automatically call `MPI_Init()` and -`MPI_Finalize()` for you. Please do not call these functions from within your -tests. - - -## MPI Information - -There is a global variable you can have access to from within your tests that -FLiT provides, if you'd like. You can access this functionality directly -through the MPI interface instead. The global variable is `flit::mpi`, and it -is a pointer to a struct that can give you the world size, your world rank, and -a few other things. See `src/MpiEnvironment.h` in the FLiT source code for -more details. One of the benefits of this approach is that you can use this -global pointer even if MPI is not enabled and you can have logic based on the -rank and size of the MPI world. - - -## Test Return Values - -Under FLiT, you can write tests using MPI with multiple processes (as long as -the result is deterministic). To prevent confusion with multiple test return -values, one from each process, FLiT will ignore the test result value from all -processes except for the one with rank 0. Therefore, all calculated results -must be communicated to rank 0 in order to have it be captured by the FLiT -framework. - -If you find this does not fit with your use case, please submit an -[issue](https://github.com/PRUNERS/FLiT/issues/new?template=feature_request.md) -on GitHub. For example, it may be that users may want to configure whether -each result is captured individually and checked at test time, process by -process. However, That approach will not work in all cases, such as the -producer-consumer model where processes may end up getting different data and -tasks. For now, enforcing users to communicate with rank 0 is the most -straightforward way to ensure determinism. - - -## Conditional Compilation - -If you want your tests to conditionally use MPI, there is a macro-defined -variable you can condition off of to disable or enable certain code. That -variable is `FLIT_USE_MPI`. For example - -Note: even when MPI is disabled, the global `flit::mpi` variable is still -available. - -```c++ -T grid[1024][1024]; -int nrows = 1024 / mpi->size; -for (int row = mpi->rank * nrows; row < (mpi->rank + 1) * nrows; row++) { - for (int col = 0; col < 1024; col++) { - // some computation to populate or update grid - // ... - } -} -#ifdef FLIT_USE_MPI -MPI_Send(...); -#endif // FLIT_USE_MPI -``` +Alternatively, you can specify your `mpic++` executable file as your compiler +in the `[[compiler]]` section of `flit-config.toml`. If you do this, you can +safely set `enable_mpi = false`, since that feature is only used for +compilation. + + +## Writing MPI Tests + +The only way to write MPI tests is to have your test call a main-like function +that handles all of the MPI requirements. See [Writing Test +Cases](writing-test-cases.md#writing_mpi_tests) for more information. + +This is the only supported way of doing MPI from FLiT. The MPI standard +requires the user to call `MPI_Init()` as close to the beginning of the +application as possible and to call `MPI_Finalize()` as close to the end of the +application and after any MPI calls. Calling these methods from within the +FLiT test directly combined with calling the flit test executable using +`mpirun` will likely have undesired behavior. [Prev](flit-helpers.md) diff --git a/documentation/standard-c++-library-implementations.md b/documentation/standard-c++-library-implementations.md index aa707b09..4fb38ce5 100644 --- a/documentation/standard-c++-library-implementations.md +++ b/documentation/standard-c++-library-implementations.md @@ -6,7 +6,7 @@ | [Next](writing-test-cases.md) -Ever since C++11, it seems every compiler vender has written their own C++ +Ever since C++11, it seems every compiler vendor has written their own C++ standard library. They have moved away from `glibc`. GCC has implemented their own `libstdc++` library. LLVM has implemented their own `libc++` library. Intel by default uses the GCC implementation from the system path. @@ -76,7 +76,7 @@ where `` is wherever the header files are installed. For the Clang compiler, we can specify to use the `libstdc++` standard library implementation from GCC. They make this pretty easy to do. In fact, it is usually the default behavior on Linux (but not for OS X since Mavericks). This -is to help with compatability since most libraries are compiled using GCC on +is to help with compatibility since most libraries are compiled using GCC on Linux. To specify a specific version of the GCC standard library to use, you specify @@ -123,10 +123,10 @@ fixed_compile_flags = '--gxx-name=/opt/compilers/gcc-9.1.0/bin/g++' ... ``` -The intel compiler will automatically insert the correct include and linker +The Intel compiler will automatically insert the correct include and linker flags. I am unsure if the `--gcc-names` argument is really required. I believe only `--gxx-name` is required to do what you want when compiling C++ -code. I immagine `--gcc-name` is for when you are compiling C code with `icc`. +code. I imagine `--gcc-name` is for when you are compiling C code with `icc`. [Prev](available-compiler-flags.md) | diff --git a/documentation/writing-test-cases.md b/documentation/writing-test-cases.md index 7c428169..5057c69a 100644 --- a/documentation/writing-test-cases.md +++ b/documentation/writing-test-cases.md @@ -136,7 +136,7 @@ of code. As an example, let us take the example of code that takes the dot product, but with different sizes of vectors. ```c++ -#include +#include #include #include @@ -210,7 +210,7 @@ you would be in luck. FLiT provides a means and a pattern to wrap around your // this allows flit to use this in call_main() and call_mpi_main() FLIT_REGISTER_MAIN(myapp_main); -#include "flit.h" +#include template class MyAppTest : public flit::TestBase { @@ -279,7 +279,7 @@ This is how to wrap around a `main()` function using FLiT. Once you do these three steps, you are allowed to then use `flit::call_main()`. ```c++ -#include "flit.h" +#include template class MyAppTest : public flit::TestBase { @@ -386,7 +386,7 @@ test called `MpiAppTest`. The test may look something like the following: // this allows flit to use this in call_main() and call_mpi_main() FLIT_REGISTER_MAIN(mpiapp_main); -#include "flit.h" +#include template class MpiAppTest : public flit::TestBase { @@ -460,7 +460,7 @@ main-like function and will have to call `MPI_Init()` and `MPI_Finalize()` accorddingly. ```c++ -#include "flit.h" +#include template class MpiAppTest : public flit::TestBase { diff --git a/gensrc/environment.py b/gensrc/environment.py index 812a786f..2cfdf24f 100644 --- a/gensrc/environment.py +++ b/gensrc/environment.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/gensrc/expression.py b/gensrc/expression.py index 754f55b4..5ce72731 100644 --- a/gensrc/expression.py +++ b/gensrc/expression.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/gensrc/gensrc.py b/gensrc/gensrc.py index d0d08baf..ff8c7c9e 100755 --- a/gensrc/gensrc.py +++ b/gensrc/gensrc.py @@ -2,7 +2,7 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/gensrc/testcase.py b/gensrc/testcase.py index bc1f74e5..7d05dcdc 100644 --- a/gensrc/testcase.py +++ b/gensrc/testcase.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # @@ -93,7 +93,7 @@ # tiList[idx].vals # - func_body: test body template_string = ''' -#include "flit.h" +#include template class {name} : public flit::TestBase {{ diff --git a/inputGen/groundtruth.cpp b/inputGen/groundtruth.cpp index f09955db..abb82188 100644 --- a/inputGen/groundtruth.cpp +++ b/inputGen/groundtruth.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "groundtruth.h" -#include +#include // Only store these locally because we want multiple compiled copies namespace { diff --git a/inputGen/groundtruth.h b/inputGen/groundtruth.h index e8304877..a993993f 100644 --- a/inputGen/groundtruth.h +++ b/inputGen/groundtruth.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/inputGen/helper.cpp b/inputGen/helper.cpp index 02aa1c72..a7a17eb6 100644 --- a/inputGen/helper.cpp +++ b/inputGen/helper.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "helper.h" -#include +#include #include #include diff --git a/inputGen/helper.h b/inputGen/helper.h index 515723b3..b23796f6 100644 --- a/inputGen/helper.h +++ b/inputGen/helper.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -84,7 +84,7 @@ #ifndef HELPER_H #define HELPER_H -#include +#include #include #include diff --git a/inputGen/main.cpp b/inputGen/main.cpp index 4b5bfbf9..bae7aec4 100644 --- a/inputGen/main.cpp +++ b/inputGen/main.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -84,7 +84,7 @@ #include "helper.h" #include "groundtruth.h" -#include +#include #include #include diff --git a/inputGen/makefile b/inputGen/makefile index 13bc6c56..1e93b946 100644 --- a/inputGen/makefile +++ b/inputGen/makefile @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/inputGen/testbed.cpp b/inputGen/testbed.cpp index a3184cf5..b1b2d3ea 100644 --- a/inputGen/testbed.cpp +++ b/inputGen/testbed.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "testbed.h" -#include +#include #include diff --git a/inputGen/testbed.h b/inputGen/testbed.h index 589efe7f..ac9838a8 100644 --- a/inputGen/testbed.h +++ b/inputGen/testbed.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/litmus-tests/tests/DistributivityOfMultiplication.cpp b/litmus-tests/tests/DistributivityOfMultiplication.cpp index e80714f1..be264ca5 100644 --- a/litmus-tests/tests/DistributivityOfMultiplication.cpp +++ b/litmus-tests/tests/DistributivityOfMultiplication.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -79,7 +79,7 @@ * purposes. * * -- LICENSE END -- */ -#include +#include #include #include diff --git a/litmus-tests/tests/DoHariGSBasic.cpp b/litmus-tests/tests/DoHariGSBasic.cpp index 02e23b35..faa32ca1 100644 --- a/litmus-tests/tests/DoHariGSBasic.cpp +++ b/litmus-tests/tests/DoHariGSBasic.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -82,7 +82,7 @@ #include "Vector.h" -#include +#include #include #include diff --git a/litmus-tests/tests/DoHariGSImproved.cpp b/litmus-tests/tests/DoHariGSImproved.cpp index ffa1d421..ebf90d31 100644 --- a/litmus-tests/tests/DoHariGSImproved.cpp +++ b/litmus-tests/tests/DoHariGSImproved.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -82,7 +82,7 @@ #include "Vector.h" -#include +#include #include #include diff --git a/litmus-tests/tests/DoMatrixMultSanity.cpp b/litmus-tests/tests/DoMatrixMultSanity.cpp index 1cf3f76d..3e7155cf 100644 --- a/litmus-tests/tests/DoMatrixMultSanity.cpp +++ b/litmus-tests/tests/DoMatrixMultSanity.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "Matrix.h" #include "Vector.h" -#include +#include #include #include diff --git a/litmus-tests/tests/DoOrthoPerturbTest.cpp b/litmus-tests/tests/DoOrthoPerturbTest.cpp index 3c4d5d13..61317e83 100644 --- a/litmus-tests/tests/DoOrthoPerturbTest.cpp +++ b/litmus-tests/tests/DoOrthoPerturbTest.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -82,7 +82,7 @@ #include "Vector.h" -#include +#include #include #include diff --git a/litmus-tests/tests/DoSimpleRotate90.cpp b/litmus-tests/tests/DoSimpleRotate90.cpp index 2e79993e..d1b6983c 100644 --- a/litmus-tests/tests/DoSimpleRotate90.cpp +++ b/litmus-tests/tests/DoSimpleRotate90.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -82,7 +82,7 @@ #include "Vector.h" -#include +#include #include diff --git a/litmus-tests/tests/DoSkewSymCPRotationTest.cpp b/litmus-tests/tests/DoSkewSymCPRotationTest.cpp index 5954f05e..6079d075 100644 --- a/litmus-tests/tests/DoSkewSymCPRotationTest.cpp +++ b/litmus-tests/tests/DoSkewSymCPRotationTest.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "Matrix.h" #include "Vector.h" -#include +#include #include diff --git a/litmus-tests/tests/FMACancel.cpp b/litmus-tests/tests/FMACancel.cpp index f7da7552..6e11b492 100644 --- a/litmus-tests/tests/FMACancel.cpp +++ b/litmus-tests/tests/FMACancel.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -79,7 +79,7 @@ * purposes. * * -- LICENSE END -- */ -#include +#include #include diff --git a/litmus-tests/tests/InliningProblem.cpp b/litmus-tests/tests/InliningProblem.cpp index 66aa5258..8e7bb51d 100644 --- a/litmus-tests/tests/InliningProblem.cpp +++ b/litmus-tests/tests/InliningProblem.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -79,7 +79,7 @@ * purposes. * * -- LICENSE END -- */ -#include +#include #include diff --git a/litmus-tests/tests/Kahan.h b/litmus-tests/tests/Kahan.h index 9537c034..dc8767f4 100644 --- a/litmus-tests/tests/Kahan.h +++ b/litmus-tests/tests/Kahan.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/litmus-tests/tests/KahanSum.cpp b/litmus-tests/tests/KahanSum.cpp index 418c5411..14dfa3d6 100644 --- a/litmus-tests/tests/KahanSum.cpp +++ b/litmus-tests/tests/KahanSum.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -82,7 +82,7 @@ #include "Kahan.h" #include "Shewchuk.h" -#include +#include #include #include diff --git a/litmus-tests/tests/Matrix.h b/litmus-tests/tests/Matrix.h index 8cf129a9..ca34cf5e 100644 --- a/litmus-tests/tests/Matrix.h +++ b/litmus-tests/tests/Matrix.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -85,7 +85,7 @@ #include "Vector.h" -#include +#include #include // for std::initializer_list #include // for std::cout diff --git a/litmus-tests/tests/Paranoia.cpp b/litmus-tests/tests/Paranoia.cpp index 7be5d860..5313b3d5 100644 --- a/litmus-tests/tests/Paranoia.cpp +++ b/litmus-tests/tests/Paranoia.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -241,7 +241,7 @@ lines */ -#include +#include #include #include diff --git a/litmus-tests/tests/RandHelper.cpp b/litmus-tests/tests/RandHelper.cpp index f48036e8..e58a4892 100644 --- a/litmus-tests/tests/RandHelper.cpp +++ b/litmus-tests/tests/RandHelper.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/litmus-tests/tests/RandHelper.h b/litmus-tests/tests/RandHelper.h index 61fd7fe0..7ee8f7eb 100644 --- a/litmus-tests/tests/RandHelper.h +++ b/litmus-tests/tests/RandHelper.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/litmus-tests/tests/ReciprocalMath.cpp b/litmus-tests/tests/ReciprocalMath.cpp index 0ebf2733..94a5cb13 100644 --- a/litmus-tests/tests/ReciprocalMath.cpp +++ b/litmus-tests/tests/ReciprocalMath.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -79,7 +79,7 @@ * purposes. * * -- LICENSE END -- */ -#include +#include template class ReciprocalMath : public flit::TestBase { diff --git a/litmus-tests/tests/RotateAndUnrotate.cpp b/litmus-tests/tests/RotateAndUnrotate.cpp index 3c0b191d..bd22542c 100644 --- a/litmus-tests/tests/RotateAndUnrotate.cpp +++ b/litmus-tests/tests/RotateAndUnrotate.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -82,7 +82,7 @@ #include "Vector.h" -#include +#include #include #include diff --git a/litmus-tests/tests/RotateFullCircle.cpp b/litmus-tests/tests/RotateFullCircle.cpp index 65baaa48..45893fc8 100644 --- a/litmus-tests/tests/RotateFullCircle.cpp +++ b/litmus-tests/tests/RotateFullCircle.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -82,7 +82,7 @@ #include "Vector.h" -#include +#include #include diff --git a/litmus-tests/tests/Shewchuk.h b/litmus-tests/tests/Shewchuk.h index e1a8822c..6d8289ca 100644 --- a/litmus-tests/tests/Shewchuk.h +++ b/litmus-tests/tests/Shewchuk.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/litmus-tests/tests/ShewchukSum.cpp b/litmus-tests/tests/ShewchukSum.cpp index 727dbddb..354c40fc 100644 --- a/litmus-tests/tests/ShewchukSum.cpp +++ b/litmus-tests/tests/ShewchukSum.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -81,7 +81,7 @@ * -- LICENSE END -- */ #include "Shewchuk.h" -#include +#include #include #include diff --git a/litmus-tests/tests/SimpleCHull.cpp b/litmus-tests/tests/SimpleCHull.cpp index 73b9d349..f4b309c7 100644 --- a/litmus-tests/tests/SimpleCHull.cpp +++ b/litmus-tests/tests/SimpleCHull.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -82,7 +82,7 @@ #include "simple_convex_hull.h" -#include +#include #include #include diff --git a/litmus-tests/tests/SinInt.cpp b/litmus-tests/tests/SinInt.cpp index ad9506d4..72323589 100644 --- a/litmus-tests/tests/SinInt.cpp +++ b/litmus-tests/tests/SinInt.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -81,7 +81,7 @@ * -- LICENSE END -- */ #include "Shewchuk.h" -#include +#include #include diff --git a/litmus-tests/tests/TrianglePHeron.cpp b/litmus-tests/tests/TrianglePHeron.cpp index 992e2855..f64a0d4d 100644 --- a/litmus-tests/tests/TrianglePHeron.cpp +++ b/litmus-tests/tests/TrianglePHeron.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -79,7 +79,7 @@ * purposes. * * -- LICENSE END -- */ -#include +#include #include diff --git a/litmus-tests/tests/TrianglePSylv.cpp b/litmus-tests/tests/TrianglePSylv.cpp index eadcf7ef..f76f2fd4 100644 --- a/litmus-tests/tests/TrianglePSylv.cpp +++ b/litmus-tests/tests/TrianglePSylv.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -79,7 +79,7 @@ * purposes. * * -- LICENSE END -- */ -#include +#include #include diff --git a/litmus-tests/tests/Vector.h b/litmus-tests/tests/Vector.h index 4a9a28a7..5091b22c 100644 --- a/litmus-tests/tests/Vector.h +++ b/litmus-tests/tests/Vector.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -86,7 +86,7 @@ #include "Matrix.h" #include "RandHelper.h" -#include +#include #include // for std::generate #include // for std::sqrt diff --git a/litmus-tests/tests/langois.cpp b/litmus-tests/tests/langois.cpp index 4b1dd1a2..c35c5d4e 100644 --- a/litmus-tests/tests/langois.cpp +++ b/litmus-tests/tests/langois.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -85,7 +85,7 @@ #include "RandHelper.h" -#include +#include #include diff --git a/litmus-tests/tests/simple_convex_hull.cpp b/litmus-tests/tests/simple_convex_hull.cpp index e9cd0ac1..5de299c7 100644 --- a/litmus-tests/tests/simple_convex_hull.cpp +++ b/litmus-tests/tests/simple_convex_hull.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/litmus-tests/tests/simple_convex_hull.h b/litmus-tests/tests/simple_convex_hull.h index 322d8a94..d97ff379 100644 --- a/litmus-tests/tests/simple_convex_hull.h +++ b/litmus-tests/tests/simple_convex_hull.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/litmus-tests/tests/tinys.cpp b/litmus-tests/tests/tinys.cpp index b41e40cd..4f598142 100644 --- a/litmus-tests/tests/tinys.cpp +++ b/litmus-tests/tests/tinys.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "Vector.h" #include "RandHelper.h" -#include +#include #include #include diff --git a/plotting/compare_matrix.py b/plotting/compare_matrix.py index c575b421..f8bcc6d4 100755 --- a/plotting/compare_matrix.py +++ b/plotting/compare_matrix.py @@ -2,7 +2,7 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/plotting/pivot_table.py b/plotting/pivot_table.py index 322110c7..a8595b8e 100755 --- a/plotting/pivot_table.py +++ b/plotting/pivot_table.py @@ -2,7 +2,7 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/plotting/plot_speedup_histogram.py b/plotting/plot_speedup_histogram.py index 9eecd9ba..dca39f90 100755 --- a/plotting/plot_speedup_histogram.py +++ b/plotting/plot_speedup_histogram.py @@ -2,7 +2,7 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/plotting/plot_timing.py b/plotting/plot_timing.py index cb395da8..4663d6ec 100755 --- a/plotting/plot_timing.py +++ b/plotting/plot_timing.py @@ -2,7 +2,7 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/plotting/stats_generator.py b/plotting/stats_generator.py index 3d697467..720d2366 100755 --- a/plotting/stats_generator.py +++ b/plotting/stats_generator.py @@ -2,7 +2,7 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/scripts/flitcli/config/flit-default.toml.in b/scripts/flitcli/config/flit-default.toml.in index 88765878..ced2d912 100644 --- a/scripts/flitcli/config/flit-default.toml.in +++ b/scripts/flitcli/config/flit-default.toml.in @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/scripts/flitcli/experimental/flit_ninja.py b/scripts/flitcli/experimental/flit_ninja.py index 0b83d13f..22b5cdbf 100755 --- a/scripts/flitcli/experimental/flit_ninja.py +++ b/scripts/flitcli/experimental/flit_ninja.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # @@ -87,6 +87,7 @@ import re import subprocess as subp import sys +from itertools import chain from socket import gethostname try: @@ -277,6 +278,7 @@ def __init__(self, out, prog=sys.argv[0], arguments=sys.argv[1:]): self.configure_args = arguments self.hostname = gethostname() self.sources = [] + self.flit_sources = [os.path.join(conf.src_dir, 'ALL-FLIT.cpp')] self.cxxflags = [ '-fno-pie', '-std=c++11', @@ -286,9 +288,6 @@ def __init__(self, out, prog=sys.argv[0], arguments=sys.argv[1:]): self.ldflags = [ '-lm', '-lstdc++', - '-L' + conf.lib_dir, - '-Wl,-rpath=' + os.path.abspath(conf.lib_dir), - '-lflit', ] self.compilers = {} self.gt_compilation = None @@ -339,7 +338,6 @@ def load_makefile(self, makefile): ... _ = makefile_out.write('CXXFLAGS = -std=c++11 -Werror\\n') ... _ = makefile_out.write('LDFLAGS += -L/usr/local/lib64 -L/opt/gcc\\n') ... _ = makefile_out.write('LDLIBS = -lm\\n') - ... _ = makefile_out.write('LDLIBS += -lflit\\n') ... _ = makefile_out.write('RUN_WRAPPER := /usr/bin/echo -ne \\n') ... makefile_out.flush() ... w.load_makefile(makefile_out.name) @@ -349,7 +347,7 @@ def load_makefile(self, makefile): >>> w.cxxflags == cxxflags_orig + ['-std=c++11', '-Werror'] True >>> w.ldflags == ldflags_orig + [ - ... '-L/usr/local/lib64', '-L/opt/gcc', '-lm', '-lflit'] + ... '-L/usr/local/lib64', '-L/opt/gcc', '-lm'] True >>> w.run_wrapper '/usr/bin/echo -ne' @@ -567,10 +565,10 @@ def _write_compilation(self, compilation): n.build(compilation['target'], link_rule_name, inputs=[os.path.join(obj_dir, os.path.basename(x) + '.o') - for x in self.sources]) + for x in chain(self.sources, self.flit_sources)]) n.newline() - for source in self.sources: + for source in chain(self.sources, self.flit_sources): n.build(os.path.join(obj_dir, os.path.basename(source) + '.o'), compile_rule_name, source) n.newline() diff --git a/scripts/flitcli/flit.py b/scripts/flitcli/flit.py index 6d7ad265..9f272850 100755 --- a/scripts/flitcli/flit.py +++ b/scripts/flitcli/flit.py @@ -2,7 +2,7 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/scripts/flitcli/flit_bisect.py b/scripts/flitcli/flit_bisect.py index f880f4dc..374fdfca 100644 --- a/scripts/flitcli/flit_bisect.py +++ b/scripts/flitcli/flit_bisect.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/scripts/flitcli/flit_experimental.py b/scripts/flitcli/flit_experimental.py index b243b923..f4c37474 100644 --- a/scripts/flitcli/flit_experimental.py +++ b/scripts/flitcli/flit_experimental.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/scripts/flitcli/flit_import.py b/scripts/flitcli/flit_import.py index 510b3acc..f2871b1a 100644 --- a/scripts/flitcli/flit_import.py +++ b/scripts/flitcli/flit_import.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/scripts/flitcli/flit_init.py b/scripts/flitcli/flit_init.py index 0e5071f1..8f5c951a 100644 --- a/scripts/flitcli/flit_init.py +++ b/scripts/flitcli/flit_init.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/scripts/flitcli/flit_make.py b/scripts/flitcli/flit_make.py index 83e56a17..b3b65f41 100644 --- a/scripts/flitcli/flit_make.py +++ b/scripts/flitcli/flit_make.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/scripts/flitcli/flit_update.py b/scripts/flitcli/flit_update.py index 8f14cd47..5519b1a4 100644 --- a/scripts/flitcli/flit_update.py +++ b/scripts/flitcli/flit_update.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # @@ -329,10 +329,10 @@ def create_makefile(args, makefile='Makefile'): 'gt_cxxflags': '$(' + gt_compiler['type'].upper() + '_CXXFLAGS)', 'gt_ldflags': '$(' + gt_compiler['type'].upper() + '_LDFLAGS)', 'flit_include_dir': conf.include_dir, - 'flit_lib_dir': conf.lib_dir, 'flit_data_dir': conf.data_dir, 'flit_script_dir': conf.script_dir, 'flit_version': conf.version, + 'flit_src_dir': conf.src_dir, 'test_run_args': test_run_args, 'enable_mpi': 'yes' if projconf['run']['enable_mpi'] else 'no', 'mpi_cxxflags': ' '.join(mpi_cxxflags), diff --git a/scripts/flitcli/flitconfig.py b/scripts/flitcli/flitconfig.py index add10553..a7b10f5b 100644 --- a/scripts/flitcli/flitconfig.py +++ b/scripts/flitcli/flitconfig.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # @@ -93,7 +93,7 @@ 'version', 'script_dir', 'doc_dir', - 'lib_dir', + 'src_dir', 'include_dir', 'config_dir', 'data_dir', @@ -107,9 +107,9 @@ doc_dir = os.path.realpath(os.path.join(script_dir, '..', '..', 'documentation')) # compiled libflit.so -lib_dir = os.path.realpath(os.path.join(script_dir, '..', '..', 'lib')) +src_dir = os.path.realpath(os.path.join(script_dir, '..', '..', 'src', 'flit')) -# flit C++ include files, primarily flit.h +# flit C++ include files, primarily flit/flit.h include_dir = os.path.realpath(os.path.join(script_dir, '..', '..', 'src')) # default configuration for flit init diff --git a/scripts/flitcli/flitelf.py b/scripts/flitcli/flitelf.py index 3d534ff5..5d04eaac 100644 --- a/scripts/flitcli/flitelf.py +++ b/scripts/flitcli/flitelf.py @@ -3,7 +3,7 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/scripts/flitcli/flitutil.py b/scripts/flitcli/flitutil.py index 18ea25ef..35a076c7 100644 --- a/scripts/flitcli/flitutil.py +++ b/scripts/flitcli/flitutil.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/scripts/flitcli/unfinished/flit_analyze.py b/scripts/flitcli/unfinished/flit_analyze.py index 84f358eb..d6bd4e2e 100644 --- a/scripts/flitcli/unfinished/flit_analyze.py +++ b/scripts/flitcli/unfinished/flit_analyze.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/scripts/flitcli/unfinished/flit_check.py b/scripts/flitcli/unfinished/flit_check.py index d3dbc1c2..5daa80ff 100644 --- a/scripts/flitcli/unfinished/flit_check.py +++ b/scripts/flitcli/unfinished/flit_check.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/scripts/flitcli/unfinished/flit_run.py b/scripts/flitcli/unfinished/flit_run.py index 2ab00506..a6bb18f1 100644 --- a/scripts/flitcli/unfinished/flit_run.py +++ b/scripts/flitcli/unfinished/flit_run.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/scripts/watch-progress.sh b/scripts/watch-progress.sh index bdaad8c0..d9b80b25 100755 --- a/scripts/watch-progress.sh +++ b/scripts/watch-progress.sh @@ -1,7 +1,7 @@ #!/bin/bash # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/src/flit.h b/src/flit.h index 08b888b1..f4dc1961 100644 --- a/src/flit.h +++ b/src/flit.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -81,522 +81,21 @@ * -- LICENSE END -- */ -// This is the main implementation, handling cmd line params and -// running the tests! - -#ifndef FLIT_H -#define FLIT_H 0 - -#include "FlitCsv.h" -#include "TestBase.h" -#include "flitHelpers.h" -#include "fsutil.h" -#include "subprocess.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -// Define macros to use in the output -// These can be overridden at compile time to insert compile-time information - -#ifndef FLIT_HOST -#define FLIT_HOST "HOST" -#endif // FLIT_HOST - -#ifndef FLIT_COMPILER -#define FLIT_COMPILER "COMPILER" -#endif // FLIT_COMPILER - -#ifndef FLIT_OPTL -#define FLIT_OPTL "OPTL" -#endif // FLIT_OPTL - -#ifndef FLIT_SWITCHES -#define FLIT_SWITCHES "SWITCHES" -#endif // FLIT_SWITCHES - -#ifndef FLIT_NULL -#define FLIT_NULL "NULL" -#endif // FLIT_NULL - -#ifndef FLIT_FILENAME -#define FLIT_FILENAME "FILENAME" -#endif // FLIT_FILENAME - -namespace flit { - -/** Command-line options */ -struct FlitOptions { - bool help = false; // show usage and exit - bool info = false; // show compilation info and exit - bool listTests = false; // list available tests and exit - bool verbose = false; // show debug verbose messages - std::vector tests; // which tests to run - std::string precision = "all"; // which precision to use - std::string output = ""; // output file for results. default stdout - bool timing = true; // should we run timing? - int timingLoops = -1; // < 1 means to auto-determine the timing loops - int timingRepeats = 3; // return best of this many timings - - bool compareMode = false; // compare results after running the test - std::string compareGtFile; // ground truth results to use in compareMode - std::vector compareFiles; // files for compareMode - std::string compareSuffix; // suffix to add when writing back compareFiles - - /** Give a string representation of this struct for printing purposes */ - std::string toString() const; -private: - /** Convert a bool to a string */ - static inline std::string boolToString(bool boolean) { - return (boolean ? "true" : "false"); - } -}; - -inline std::ostream& operator<<(std::ostream& out, const FlitOptions &opt) { - return out << opt.toString(); -} - -template -struct pair_hash { - // This is from python's implementation of hashing a tuple - size_t operator()(const std::pair &thepair) const { - std::hash hasherA; - std::hash hasherB; - size_t value = 0x345678; - value = (1000003 * value) ^ hasherA(thepair.first); - value = (1000003 * value) ^ hasherB(thepair.second); - return value; - } -}; - -/// Parse arguments -bool isFastTrack(int argCount, char const* const argList[]); -int callFastTrack(int argCount, char* argList[]); -FlitOptions parseArguments(int argCount, char const* const argList[]); - -/// Returns the usage information as a string -std::string usage(std::string progName); - -/// The compilation information as a string -static std::string info = - "Compilation information:\n" - " Host: \"" FLIT_HOST "\"\n" - " Compiler: \"" FLIT_COMPILER "\"\n" - " Optimization level: \"" FLIT_OPTL "\"\n" - " Compiler flags: \"" FLIT_SWITCHES "\"\n" - " Filename: \"" FLIT_FILENAME "\"\n"; - -/// Parse the results file into a vector of results -std::vector parseResults(std::istream &in); - -/// Parse the result file to get metadata from the first row -std::unordered_map parseMetadata(std::istream &in); - -/** Removes the "_idx" from the name - * - * The name passed in is not modified, but the shortened one is returned. - * Optionally, you can pass in an integer pointer to have it populated with the - * value of the from the end of the idx string. - * - * If the name does not end in "_idx", then the name is returned as-is, - * and idx (if not nullptr) is set to -1. - * - * @param name Name to remove "_idx" from the end - * @param idx Pointer to an integer to store (optional) - * - * @return shortened name with "_idx" removed from the end - */ -std::string removeIdxFromName(const std::string &name, int *idx = nullptr); - -/// Returns the tests that need to be run for comparisons -std::vector calculateMissingComparisons(const FlitOptions &opt); - -class TestResultMap { -public: - using key_type = std::pair; - - void loadfile(const std::string &filename) { - std::ifstream resultfile; - flit::ifopen(resultfile, filename); - auto parsed = parseResults(resultfile); - this->extend(parsed, filename); - } - - std::vector operator[]( - const key_type &key) const - { - std::vector all_vals; - auto range = m_testmap.equal_range(key); - for (auto iter = range.first; iter != range.second; iter++) { - all_vals.push_back(iter->second); - } - return all_vals; - } - - std::vector fileresults(const std::string &filename) { - std::vector all_vals; - auto range = m_filemap.equal_range(filename); - for (auto iter = range.first; iter != range.second; iter++) { - all_vals.push_back(&(iter->second)); - } - return all_vals; - } - -private: - void append(const TestResult &result, const std::string &filename) { - auto it = m_filemap.emplace(filename, result); - m_testmap.emplace(key_type{result.name(), result.precision()}, - &(it->second)); - } - - void extend(const std::vector &results, - const std::string &filename) - { - for (auto& result : results) { - this->append(result, filename); - } - } - -private: - std::unordered_multimap< - std::pair, - TestResult*, - pair_hash - > m_testmap; // (testname, precision) -> TestResult* - - // filename -> TestResult - std::unordered_multimap m_filemap; -}; - -inline void outputResults ( - const std::vector& results, - std::ostream& out, - std::string hostname = FLIT_HOST, - std::string compiler = FLIT_COMPILER, - std::string optimization_level = FLIT_OPTL, - std::string switches = FLIT_SWITCHES, - std::string executableFilename = FLIT_FILENAME) -{ - // Output the column headers - CsvWriter writer(out); - writer - << "name" - << "host" - << "compiler" - << "optl" - << "switches" - << "precision" - << "score_hex" - << "score" - << "resultfile" - << "comparison_hex" - << "comparison" - << "file" - << "nanosec"; - writer.new_row(); - for (const auto& result: results) { - writer - << result.name() // test case name - << hostname // hostname - << compiler // compiler - << optimization_level // optimization level - << switches // compiler flags - << result.precision() // precision - ; - - if (result.result().type() == Variant::Type::LongDouble) { - writer - << as_int(result.result().longDouble()) // score_hex - << result.result().longDouble() // score - ; - } else { - writer - << FLIT_NULL // score_hex - << FLIT_NULL // score - ; - } - - if (result.resultfile().empty()) { - writer << FLIT_NULL; // resultfile - } else { - writer << result.resultfile(); // resultfile - } - - if (result.is_comparison_null()) { - writer - << FLIT_NULL // comparison_hex - << FLIT_NULL // comparison - ; - } else { - writer - << as_int(result.comparison()) // comparison_hex - << result.comparison() // comparison - ; - } - - writer - << executableFilename // executable filename - << result.nanosecs() // nanoseconds - ; - writer.new_row(); - } -} - - -template -void runTestWithDefaultInput(TestFactory* factory, - std::vector& totResults, - const std::string &filebase = "", - bool shouldTime = true, - int timingLoops = -1, - int timingRepeats = 3, - int idx = -1) { - auto test = factory->get(); - auto test_input = test->getDefaultInput(); - auto results = test->run(test_input, filebase, shouldTime, timingLoops, - timingRepeats, idx); - totResults.insert(totResults.end(), results.begin(), results.end()); - info_stream.flushout(); -} - -template -long double runComparison_impl(TestFactory* factory, const TestResult >, - const TestResult &res) { - auto test = factory->get(); - if (res.result().type() != gt.result().type()) { - throw std::invalid_argument("Result and baseline comparison types do not" - " match"); - } - if (!gt.resultfile().empty()) { - if (gt.result().type() != Variant::Type::None) { - throw std::invalid_argument("baseline comparison type is not None when" - " the resultfile is defined"); - } - Variant gtval = Variant::fromString(flit::readfile(gt.resultfile())); - Variant resval = Variant::fromString(flit::readfile(res.resultfile())); - return test->variant_compare(gtval, resval); - } - return test->variant_compare(gt.result(), res.result()); -} - -inline long double runComparison(TestFactory* factory, const TestResult >, - const TestResult &res) { - if (res.precision() == "f") { - return runComparison_impl(factory, gt, res); - } else if (res.precision() == "d") { - return runComparison_impl(factory, gt, res); - } else if (res.precision() == "e") { - return runComparison_impl(factory, gt, res); - } else { throw std::runtime_error("Unrecognized precision encountered"); } -} - -/** Returns the keys of a std::map as a std::vector */ -template -std::vector getKeys(std::map map) { - std::vector keys; - for (auto pair : map) { - keys.emplace_back(pair.first); - } - return keys; -} - -class ParseException : public std::exception { -public: - ParseException(const std::string& message) : _message(message) {} - virtual const char* what() const noexcept { return _message.c_str(); } -private: - const std::string _message; -}; - -inline int runFlitTests(int argc, char* argv[]) { - // Fast track means calling a user's main() function - if (isFastTrack(argc, argv)) { return callFastTrack(argc, argv); } - - // Argument parsing - FlitOptions options; - try { - options = parseArguments(argc, argv); - } catch (ParseException &ex) { - std::cerr << "Error: " << ex.what() << "\n" - << " Use the --help option for more information\n"; - return 1; - } - - if (options.help) { - std::cout << usage(argv[0]); - return 0; - } - - if (options.info) { - std::cout << info; - return 0; - } - - if (options.listTests) { - for (auto& test : getKeys(getTests())) { - std::cout << test << std::endl; - } - return 0; - } - - if (options.verbose) { - info_stream.show(); - } - - std::unique_ptr stream_deleter; - std::ostream *outstream = &std::cout; - std::string test_result_filebase(FLIT_FILENAME); - if (!options.output.empty()) { - stream_deleter.reset(new std::ofstream()); - outstream = stream_deleter.get(); - try { - flit::ofopen(static_cast(*outstream), options.output); - } catch (std::ios::failure &ex) { - std::cerr << "Error: failed to open " << options.output << std::endl; - return 1; - } - test_result_filebase = options.output; - } - - std::vector results; - - // if comparison mode, then find out which tests we need to run - if (options.compareMode) { - options.tests = calculateMissingComparisons(options); - if (!options.compareGtFile.empty()) { - std::ifstream fin; - try { - flit::ifopen(fin, options.compareGtFile); - } catch (std::ios::failure &ex) { - std::cerr << "Error: file does not exist: " << options.compareGtFile - << std::endl; - return 1; - } - results = parseResults(fin); - } - } - - std::cout.precision(1000); //set cout to print many decimal places - info_stream.precision(1000); - - auto testMap = getTests(); - for (auto& testName : options.tests) { - int idx; - auto factory = testMap[removeIdxFromName(testName, &idx)]; - if (options.precision == "all" || options.precision == "float") { - runTestWithDefaultInput(factory, results, test_result_filebase, - options.timing, options.timingLoops, - options.timingRepeats, idx); - } - if (options.precision == "all" || options.precision == "double") { - runTestWithDefaultInput(factory, results, test_result_filebase, - options.timing, options.timingLoops, - options.timingRepeats, idx); - } - if (options.precision == "all" || options.precision == "long double") { - runTestWithDefaultInput( - factory, results, test_result_filebase, options.timing, - options.timingLoops, options.timingRepeats, idx); - } - } - - // Sort the results first by name then by precision - auto testComparator = [](const TestResult &a, const TestResult &b) { - if (a.name() != b.name()) { - return a.name() < b.name(); - } else { - return a.precision() < b.precision(); - } - }; - std::sort(results.begin(), results.end(), testComparator); - - // Let's now run the ground-truth comparisons - if (options.compareMode) { - TestResultMap comparisonResults; - - for (auto fname : options.compareFiles) { - try { - comparisonResults.loadfile(fname); - } catch (std::ios::failure &ex) { - std::cerr << "Error: failed to open file " << fname << std::endl; - return 1; - } - } - - // compare mode is only done in the ground truth compilation - // so "results" are the ground truth results. - for (auto& gtres : results) { - auto factory = testMap[removeIdxFromName(gtres.name())]; - auto toCompare = comparisonResults[{gtres.name(), gtres.precision()}]; - for (TestResult* compResult : toCompare) { - auto compVal = runComparison(factory, gtres, *compResult); - compResult->set_comparison(compVal); - } - } - - // save back to the compare files with compare value set - for (auto fname : options.compareFiles) { - // read in the metadata to use in creating the file again - std::unordered_map metadata; - { - std::ifstream fin; - try { - flit::ifopen(fin, fname); - } catch (std::ios_base::failure &ex) { - std::cerr << "Error: file does not exist: " << fname << std::endl; - return 1; - } - metadata = parseMetadata(fin); - } - - // get all results from this file - auto fileresultPtrs = comparisonResults.fileresults(fname); - std::vector fileresults; - for (auto resultPtr : fileresultPtrs) { - fileresults.push_back(*resultPtr); - } - - // sort the file results - std::sort(fileresults.begin(), fileresults.end(), testComparator); - - // output back to a file - { - std::ofstream fout; - try { - flit::ofopen(fout, fname + options.compareSuffix); - } catch (std::ios::failure &ex) { - std::cerr << "Error: could not write to " << fname << std::endl; - return 1; - } - outputResults( - fileresults, - fout, - metadata["host"], - metadata["compiler"], - metadata["optl"], - metadata["switches"], - metadata["file"] - ); - } - } - } - - // Create the main results output - outputResults(results, *outstream); - - return 0; -} - -} // end of namespace flit - -#endif // FLIT_H +// This wrapper file simply includes all of the header files for ease of use +// and backward-compatability + +#ifndef TOP_FLIT_H +#define TOP_FLIT_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // TOP_FLIT_H diff --git a/src/flit/ALL-FLIT.cpp b/src/flit/ALL-FLIT.cpp new file mode 100644 index 00000000..23ba9943 --- /dev/null +++ b/src/flit/ALL-FLIT.cpp @@ -0,0 +1,96 @@ +/* -- LICENSE BEGIN -- + * + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. + * + * Produced at the Lawrence Livermore National Laboratory + * + * Written by + * Michael Bentley (mikebentley15@gmail.com), + * Geof Sawaya (fredricflinstone@gmail.com), + * and Ian Briggs (ian.briggs@utah.edu) + * under the direction of + * Ganesh Gopalakrishnan + * and Dong H. Ahn. + * + * LLNL-CODE-743137 + * + * All rights reserved. + * + * This file is part of FLiT. For details, see + * https://pruners.github.io/flit + * Please also read + * https://github.com/PRUNERS/FLiT/blob/master/LICENSE + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the disclaimer below. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the disclaimer + * (as noted below) in the documentation and/or other materials + * provided with the distribution. + * + * - Neither the name of the LLNS/LLNL nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL + * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * Additional BSD Notice + * + * 1. This notice is required to be provided under our contract + * with the U.S. Department of Energy (DOE). This work was + * produced at Lawrence Livermore National Laboratory under + * Contract No. DE-AC52-07NA27344 with the DOE. + * + * 2. Neither the United States Government nor Lawrence Livermore + * National Security, LLC nor any of their employees, makes any + * warranty, express or implied, or assumes any liability or + * responsibility for the accuracy, completeness, or usefulness of + * any information, apparatus, product, or process disclosed, or + * represents that its use would not infringe privately-owned + * rights. + * + * 3. Also, reference herein to any specific commercial products, + * process, or services by trade name, trademark, manufacturer or + * otherwise does not necessarily constitute or imply its + * endorsement, recommendation, or favoring by the United States + * Government or Lawrence Livermore National Security, LLC. The + * views and opinions of authors expressed herein do not + * necessarily state or reflect those of the United States + * Government or Lawrence Livermore National Security, LLC, and + * shall not be used for advertising or product endorsement + * purposes. + * + * -- LICENSE END -- + */ + +// This file includes all of the source files within FLiT to be compiled in one go +// +// For now, this is an experiment to see how it affects compile-time + +#include "flit.cpp" +#include "FlitCsv.cpp" +#include "flitHelpers.cpp" +#include "fsutil.cpp" +#include "InfoStream.cpp" +#include "subprocess.cpp" +#include "TestBase.cpp" +#include "timeFunction.cpp" +#include "Variant.cpp" diff --git a/src/FlitCsv.cpp b/src/flit/FlitCsv.cpp similarity index 98% rename from src/FlitCsv.cpp rename to src/flit/FlitCsv.cpp index f6da743e..4c94fd33 100644 --- a/src/FlitCsv.cpp +++ b/src/flit/FlitCsv.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -81,7 +81,7 @@ * -- LICENSE END -- */ -#include "FlitCsv.h" +#include #include #include diff --git a/src/FlitCsv.h b/src/flit/FlitCsv.h similarity index 98% rename from src/FlitCsv.h rename to src/flit/FlitCsv.h index dcb1ade4..fca63811 100644 --- a/src/FlitCsv.h +++ b/src/flit/FlitCsv.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -84,7 +84,7 @@ #ifndef FLIT_CSV_H #define FLIT_CSV_H -#include "flitHelpers.h" +#include #include #include diff --git a/src/InfoStream.cpp b/src/flit/InfoStream.cpp similarity index 98% rename from src/InfoStream.cpp rename to src/flit/InfoStream.cpp index c42bc9b5..c7889b92 100644 --- a/src/InfoStream.cpp +++ b/src/flit/InfoStream.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -81,7 +81,7 @@ * -- LICENSE END -- */ -#include "InfoStream.h" +#include #include diff --git a/src/InfoStream.h b/src/flit/InfoStream.h similarity index 98% rename from src/InfoStream.h rename to src/flit/InfoStream.h index beca5e2e..4a553fb7 100644 --- a/src/InfoStream.h +++ b/src/flit/InfoStream.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/src/TestBase.cpp b/src/flit/TestBase.cpp similarity index 97% rename from src/TestBase.cpp rename to src/flit/TestBase.cpp index 975a2c03..750a99af 100644 --- a/src/TestBase.cpp +++ b/src/flit/TestBase.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ //this is the base instantiation for tests -#include "TestBase.h" +#include #include diff --git a/src/TestBase.h b/src/flit/TestBase.h similarity index 98% rename from src/TestBase.h rename to src/flit/TestBase.h index 9e67bc81..c0f67d0f 100644 --- a/src/TestBase.h +++ b/src/flit/TestBase.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -88,10 +88,10 @@ #ifndef TEST_BASE_HPP #define TEST_BASE_HPP -#include "Variant.h" -#include "flitHelpers.h" -#include "timeFunction.h" -#include "fsutil.h" +#include +#include +#include +#include #include #include diff --git a/src/Variant.cpp b/src/flit/Variant.cpp similarity index 99% rename from src/Variant.cpp rename to src/flit/Variant.cpp index ed2742b6..46e73531 100644 --- a/src/Variant.cpp +++ b/src/flit/Variant.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -81,7 +81,7 @@ * -- LICENSE END -- */ -#include "Variant.h" +#include #include // for std::unique_ptr() #include diff --git a/src/Variant.h b/src/flit/Variant.h similarity index 99% rename from src/Variant.h rename to src/flit/Variant.h index 2b6e6d15..2e1b49e5 100644 --- a/src/Variant.h +++ b/src/flit/Variant.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/src/flit.cpp b/src/flit/flit.cpp similarity index 99% rename from src/flit.cpp rename to src/flit/flit.cpp index 41cdd53f..030bf521 100644 --- a/src/flit.cpp +++ b/src/flit/flit.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -84,6 +84,11 @@ // This is the main implementation, handling cmd line params and // running the tests! +#include + +#include +#include + #include #include #include @@ -94,11 +99,6 @@ #include -#include "flit.h" - -#include "flitHelpers.h" -#include "TestBase.h" - namespace { /** Returns true if the element is in the container */ diff --git a/src/flit/flit.h b/src/flit/flit.h new file mode 100644 index 00000000..4ed64081 --- /dev/null +++ b/src/flit/flit.h @@ -0,0 +1,602 @@ +/* -- LICENSE BEGIN -- + * + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. + * + * Produced at the Lawrence Livermore National Laboratory + * + * Written by + * Michael Bentley (mikebentley15@gmail.com), + * Geof Sawaya (fredricflinstone@gmail.com), + * and Ian Briggs (ian.briggs@utah.edu) + * under the direction of + * Ganesh Gopalakrishnan + * and Dong H. Ahn. + * + * LLNL-CODE-743137 + * + * All rights reserved. + * + * This file is part of FLiT. For details, see + * https://pruners.github.io/flit + * Please also read + * https://github.com/PRUNERS/FLiT/blob/master/LICENSE + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the disclaimer below. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the disclaimer + * (as noted below) in the documentation and/or other materials + * provided with the distribution. + * + * - Neither the name of the LLNS/LLNL nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL + * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * Additional BSD Notice + * + * 1. This notice is required to be provided under our contract + * with the U.S. Department of Energy (DOE). This work was + * produced at Lawrence Livermore National Laboratory under + * Contract No. DE-AC52-07NA27344 with the DOE. + * + * 2. Neither the United States Government nor Lawrence Livermore + * National Security, LLC nor any of their employees, makes any + * warranty, express or implied, or assumes any liability or + * responsibility for the accuracy, completeness, or usefulness of + * any information, apparatus, product, or process disclosed, or + * represents that its use would not infringe privately-owned + * rights. + * + * 3. Also, reference herein to any specific commercial products, + * process, or services by trade name, trademark, manufacturer or + * otherwise does not necessarily constitute or imply its + * endorsement, recommendation, or favoring by the United States + * Government or Lawrence Livermore National Security, LLC. The + * views and opinions of authors expressed herein do not + * necessarily state or reflect those of the United States + * Government or Lawrence Livermore National Security, LLC, and + * shall not be used for advertising or product endorsement + * purposes. + * + * -- LICENSE END -- + */ + +// This is the main implementation, handling cmd line params and +// running the tests! + +#ifndef FLIT_H +#define FLIT_H 0 + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +// Define macros to use in the output +// These can be overridden at compile time to insert compile-time information + +#ifndef FLIT_HOST +#define FLIT_HOST "HOST" +#endif // FLIT_HOST + +#ifndef FLIT_COMPILER +#define FLIT_COMPILER "COMPILER" +#endif // FLIT_COMPILER + +#ifndef FLIT_OPTL +#define FLIT_OPTL "OPTL" +#endif // FLIT_OPTL + +#ifndef FLIT_SWITCHES +#define FLIT_SWITCHES "SWITCHES" +#endif // FLIT_SWITCHES + +#ifndef FLIT_NULL +#define FLIT_NULL "NULL" +#endif // FLIT_NULL + +#ifndef FLIT_FILENAME +#define FLIT_FILENAME "FILENAME" +#endif // FLIT_FILENAME + +namespace flit { + +/** Command-line options */ +struct FlitOptions { + bool help = false; // show usage and exit + bool info = false; // show compilation info and exit + bool listTests = false; // list available tests and exit + bool verbose = false; // show debug verbose messages + std::vector tests; // which tests to run + std::string precision = "all"; // which precision to use + std::string output = ""; // output file for results. default stdout + bool timing = true; // should we run timing? + int timingLoops = -1; // < 1 means to auto-determine the timing loops + int timingRepeats = 3; // return best of this many timings + + bool compareMode = false; // compare results after running the test + std::string compareGtFile; // ground truth results to use in compareMode + std::vector compareFiles; // files for compareMode + std::string compareSuffix; // suffix to add when writing back compareFiles + + /** Give a string representation of this struct for printing purposes */ + std::string toString() const; +private: + /** Convert a bool to a string */ + static inline std::string boolToString(bool boolean) { + return (boolean ? "true" : "false"); + } +}; + +inline std::ostream& operator<<(std::ostream& out, const FlitOptions &opt) { + return out << opt.toString(); +} + +template +struct pair_hash { + // This is from python's implementation of hashing a tuple + size_t operator()(const std::pair &thepair) const { + std::hash hasherA; + std::hash hasherB; + size_t value = 0x345678; + value = (1000003 * value) ^ hasherA(thepair.first); + value = (1000003 * value) ^ hasherB(thepair.second); + return value; + } +}; + +/// Parse arguments +bool isFastTrack(int argCount, char const* const argList[]); +int callFastTrack(int argCount, char* argList[]); +FlitOptions parseArguments(int argCount, char const* const argList[]); + +/// Returns the usage information as a string +std::string usage(std::string progName); + +/// The compilation information as a string +static std::string info = + "Compilation information:\n" + " Host: \"" FLIT_HOST "\"\n" + " Compiler: \"" FLIT_COMPILER "\"\n" + " Optimization level: \"" FLIT_OPTL "\"\n" + " Compiler flags: \"" FLIT_SWITCHES "\"\n" + " Filename: \"" FLIT_FILENAME "\"\n"; + +/// Parse the results file into a vector of results +std::vector parseResults(std::istream &in); + +/// Parse the result file to get metadata from the first row +std::unordered_map parseMetadata(std::istream &in); + +/** Removes the "_idx" from the name + * + * The name passed in is not modified, but the shortened one is returned. + * Optionally, you can pass in an integer pointer to have it populated with the + * value of the from the end of the idx string. + * + * If the name does not end in "_idx", then the name is returned as-is, + * and idx (if not nullptr) is set to -1. + * + * @param name Name to remove "_idx" from the end + * @param idx Pointer to an integer to store (optional) + * + * @return shortened name with "_idx" removed from the end + */ +std::string removeIdxFromName(const std::string &name, int *idx = nullptr); + +/// Returns the tests that need to be run for comparisons +std::vector calculateMissingComparisons(const FlitOptions &opt); + +class TestResultMap { +public: + using key_type = std::pair; + + void loadfile(const std::string &filename) { + std::ifstream resultfile; + flit::ifopen(resultfile, filename); + auto parsed = parseResults(resultfile); + this->extend(parsed, filename); + } + + std::vector operator[]( + const key_type &key) const + { + std::vector all_vals; + auto range = m_testmap.equal_range(key); + for (auto iter = range.first; iter != range.second; iter++) { + all_vals.push_back(iter->second); + } + return all_vals; + } + + std::vector fileresults(const std::string &filename) { + std::vector all_vals; + auto range = m_filemap.equal_range(filename); + for (auto iter = range.first; iter != range.second; iter++) { + all_vals.push_back(&(iter->second)); + } + return all_vals; + } + +private: + void append(const TestResult &result, const std::string &filename) { + auto it = m_filemap.emplace(filename, result); + m_testmap.emplace(key_type{result.name(), result.precision()}, + &(it->second)); + } + + void extend(const std::vector &results, + const std::string &filename) + { + for (auto& result : results) { + this->append(result, filename); + } + } + +private: + std::unordered_multimap< + std::pair, + TestResult*, + pair_hash + > m_testmap; // (testname, precision) -> TestResult* + + // filename -> TestResult + std::unordered_multimap m_filemap; +}; + +inline void outputResults ( + const std::vector& results, + std::ostream& out, + std::string hostname = FLIT_HOST, + std::string compiler = FLIT_COMPILER, + std::string optimization_level = FLIT_OPTL, + std::string switches = FLIT_SWITCHES, + std::string executableFilename = FLIT_FILENAME) +{ + // Output the column headers + CsvWriter writer(out); + writer + << "name" + << "host" + << "compiler" + << "optl" + << "switches" + << "precision" + << "score_hex" + << "score" + << "resultfile" + << "comparison_hex" + << "comparison" + << "file" + << "nanosec"; + writer.new_row(); + for (const auto& result: results) { + writer + << result.name() // test case name + << hostname // hostname + << compiler // compiler + << optimization_level // optimization level + << switches // compiler flags + << result.precision() // precision + ; + + if (result.result().type() == Variant::Type::LongDouble) { + writer + << as_int(result.result().longDouble()) // score_hex + << result.result().longDouble() // score + ; + } else { + writer + << FLIT_NULL // score_hex + << FLIT_NULL // score + ; + } + + if (result.resultfile().empty()) { + writer << FLIT_NULL; // resultfile + } else { + writer << result.resultfile(); // resultfile + } + + if (result.is_comparison_null()) { + writer + << FLIT_NULL // comparison_hex + << FLIT_NULL // comparison + ; + } else { + writer + << as_int(result.comparison()) // comparison_hex + << result.comparison() // comparison + ; + } + + writer + << executableFilename // executable filename + << result.nanosecs() // nanoseconds + ; + writer.new_row(); + } +} + + +template +void runTestWithDefaultInput(TestFactory* factory, + std::vector& totResults, + const std::string &filebase = "", + bool shouldTime = true, + int timingLoops = -1, + int timingRepeats = 3, + int idx = -1) { + auto test = factory->get(); + auto test_input = test->getDefaultInput(); + auto results = test->run(test_input, filebase, shouldTime, timingLoops, + timingRepeats, idx); + totResults.insert(totResults.end(), results.begin(), results.end()); + info_stream.flushout(); +} + +template +long double runComparison_impl(TestFactory* factory, const TestResult >, + const TestResult &res) { + auto test = factory->get(); + if (res.result().type() != gt.result().type()) { + throw std::invalid_argument("Result and baseline comparison types do not" + " match"); + } + if (!gt.resultfile().empty()) { + if (gt.result().type() != Variant::Type::None) { + throw std::invalid_argument("baseline comparison type is not None when" + " the resultfile is defined"); + } + Variant gtval = Variant::fromString(flit::readfile(gt.resultfile())); + Variant resval = Variant::fromString(flit::readfile(res.resultfile())); + return test->variant_compare(gtval, resval); + } + return test->variant_compare(gt.result(), res.result()); +} + +inline long double runComparison(TestFactory* factory, const TestResult >, + const TestResult &res) { + if (res.precision() == "f") { + return runComparison_impl(factory, gt, res); + } else if (res.precision() == "d") { + return runComparison_impl(factory, gt, res); + } else if (res.precision() == "e") { + return runComparison_impl(factory, gt, res); + } else { throw std::runtime_error("Unrecognized precision encountered"); } +} + +/** Returns the keys of a std::map as a std::vector */ +template +std::vector getKeys(std::map map) { + std::vector keys; + for (auto pair : map) { + keys.emplace_back(pair.first); + } + return keys; +} + +class ParseException : public std::exception { +public: + ParseException(const std::string& message) : _message(message) {} + virtual const char* what() const noexcept { return _message.c_str(); } +private: + const std::string _message; +}; + +inline int runFlitTests(int argc, char* argv[]) { + // Fast track means calling a user's main() function + if (isFastTrack(argc, argv)) { return callFastTrack(argc, argv); } + + // Argument parsing + FlitOptions options; + try { + options = parseArguments(argc, argv); + } catch (ParseException &ex) { + std::cerr << "Error: " << ex.what() << "\n" + << " Use the --help option for more information\n"; + return 1; + } + + if (options.help) { + std::cout << usage(argv[0]); + return 0; + } + + if (options.info) { + std::cout << info; + return 0; + } + + if (options.listTests) { + for (auto& test : getKeys(getTests())) { + std::cout << test << std::endl; + } + return 0; + } + + if (options.verbose) { + info_stream.show(); + } + + std::unique_ptr stream_deleter; + std::ostream *outstream = &std::cout; + std::string test_result_filebase(FLIT_FILENAME); + if (!options.output.empty()) { + stream_deleter.reset(new std::ofstream()); + outstream = stream_deleter.get(); + try { + flit::ofopen(static_cast(*outstream), options.output); + } catch (std::ios::failure &ex) { + std::cerr << "Error: failed to open " << options.output << std::endl; + return 1; + } + test_result_filebase = options.output; + } + + std::vector results; + + // if comparison mode, then find out which tests we need to run + if (options.compareMode) { + options.tests = calculateMissingComparisons(options); + if (!options.compareGtFile.empty()) { + std::ifstream fin; + try { + flit::ifopen(fin, options.compareGtFile); + } catch (std::ios::failure &ex) { + std::cerr << "Error: file does not exist: " << options.compareGtFile + << std::endl; + return 1; + } + results = parseResults(fin); + } + } + + std::cout.precision(1000); //set cout to print many decimal places + info_stream.precision(1000); + + auto testMap = getTests(); + for (auto& testName : options.tests) { + int idx; + auto factory = testMap[removeIdxFromName(testName, &idx)]; + if (options.precision == "all" || options.precision == "float") { + runTestWithDefaultInput(factory, results, test_result_filebase, + options.timing, options.timingLoops, + options.timingRepeats, idx); + } + if (options.precision == "all" || options.precision == "double") { + runTestWithDefaultInput(factory, results, test_result_filebase, + options.timing, options.timingLoops, + options.timingRepeats, idx); + } + if (options.precision == "all" || options.precision == "long double") { + runTestWithDefaultInput( + factory, results, test_result_filebase, options.timing, + options.timingLoops, options.timingRepeats, idx); + } + } + + // Sort the results first by name then by precision + auto testComparator = [](const TestResult &a, const TestResult &b) { + if (a.name() != b.name()) { + return a.name() < b.name(); + } else { + return a.precision() < b.precision(); + } + }; + std::sort(results.begin(), results.end(), testComparator); + + // Let's now run the ground-truth comparisons + if (options.compareMode) { + TestResultMap comparisonResults; + + for (auto fname : options.compareFiles) { + try { + comparisonResults.loadfile(fname); + } catch (std::ios::failure &ex) { + std::cerr << "Error: failed to open file " << fname << std::endl; + return 1; + } + } + + // compare mode is only done in the ground truth compilation + // so "results" are the ground truth results. + for (auto& gtres : results) { + auto factory = testMap[removeIdxFromName(gtres.name())]; + auto toCompare = comparisonResults[{gtres.name(), gtres.precision()}]; + for (TestResult* compResult : toCompare) { + auto compVal = runComparison(factory, gtres, *compResult); + compResult->set_comparison(compVal); + } + } + + // save back to the compare files with compare value set + for (auto fname : options.compareFiles) { + // read in the metadata to use in creating the file again + std::unordered_map metadata; + { + std::ifstream fin; + try { + flit::ifopen(fin, fname); + } catch (std::ios_base::failure &ex) { + std::cerr << "Error: file does not exist: " << fname << std::endl; + return 1; + } + metadata = parseMetadata(fin); + } + + // get all results from this file + auto fileresultPtrs = comparisonResults.fileresults(fname); + std::vector fileresults; + for (auto resultPtr : fileresultPtrs) { + fileresults.push_back(*resultPtr); + } + + // sort the file results + std::sort(fileresults.begin(), fileresults.end(), testComparator); + + // output back to a file + { + std::ofstream fout; + try { + flit::ofopen(fout, fname + options.compareSuffix); + } catch (std::ios::failure &ex) { + std::cerr << "Error: could not write to " << fname << std::endl; + return 1; + } + outputResults( + fileresults, + fout, + metadata["host"], + metadata["compiler"], + metadata["optl"], + metadata["switches"], + metadata["file"] + ); + } + } + } + + // Create the main results output + outputResults(results, *outstream); + + return 0; +} + +} // end of namespace flit + +#endif // FLIT_H diff --git a/src/flitHelpers.cpp b/src/flit/flitHelpers.cpp similarity index 98% rename from src/flitHelpers.cpp rename to src/flit/flitHelpers.cpp index 6d1ce91c..4fa8dd91 100644 --- a/src/flitHelpers.cpp +++ b/src/flit/flitHelpers.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -85,7 +85,7 @@ // they utilize the watch data for sensitive points // of computation. -#include "flitHelpers.h" +#include #include #include diff --git a/src/flitHelpers.h b/src/flit/flitHelpers.h similarity index 98% rename from src/flitHelpers.h rename to src/flit/flitHelpers.h index 262bfc9a..aebe26f7 100644 --- a/src/flitHelpers.h +++ b/src/flit/flitHelpers.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -88,7 +88,7 @@ #ifndef FLIT_HELPERS_HPP #define FLIT_HELPERS_HPP -#include "InfoStream.h" +#include #include #include diff --git a/src/fsutil.cpp b/src/flit/fsutil.cpp similarity index 99% rename from src/fsutil.cpp rename to src/flit/fsutil.cpp index 247a12bc..26588429 100644 --- a/src/fsutil.cpp +++ b/src/flit/fsutil.cpp @@ -81,8 +81,8 @@ * -- LICENSE END -- */ -#include "fsutil.h" -#include "flitHelpers.h" // for flit::split() +#include +#include // for flit::split() #if !defined(__GNUC__) || defined(__clang__) || \ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)) diff --git a/src/fsutil.h b/src/flit/fsutil.h similarity index 99% rename from src/fsutil.h rename to src/flit/fsutil.h index 1d3ee7b5..54bdf725 100644 --- a/src/fsutil.h +++ b/src/flit/fsutil.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -90,7 +90,7 @@ #ifndef FSUTIL_H #define FSUTIL_H -#include "tinydir.h" // for tinydir_file and tinydir_dir +#include // for tinydir_file and tinydir_dir #include // for std::string #include // for std::vector diff --git a/src/flit/subprocess.cpp b/src/flit/subprocess.cpp new file mode 100644 index 00000000..e7945563 --- /dev/null +++ b/src/flit/subprocess.cpp @@ -0,0 +1,208 @@ +/* -- LICENSE BEGIN -- + * + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. + * + * Produced at the Lawrence Livermore National Laboratory + * + * Written by + * Michael Bentley (mikebentley15@gmail.com), + * Geof Sawaya (fredricflinstone@gmail.com), + * and Ian Briggs (ian.briggs@utah.edu) + * under the direction of + * Ganesh Gopalakrishnan + * and Dong H. Ahn. + * + * LLNL-CODE-743137 + * + * All rights reserved. + * + * This file is part of FLiT. For details, see + * https://pruners.github.io/flit + * Please also read + * https://github.com/PRUNERS/FLiT/blob/master/LICENSE + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the disclaimer below. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the disclaimer + * (as noted below) in the documentation and/or other materials + * provided with the distribution. + * + * - Neither the name of the LLNS/LLNL nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL + * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * Additional BSD Notice + * + * 1. This notice is required to be provided under our contract + * with the U.S. Department of Energy (DOE). This work was + * produced at Lawrence Livermore National Laboratory under + * Contract No. DE-AC52-07NA27344 with the DOE. + * + * 2. Neither the United States Government nor Lawrence Livermore + * National Security, LLC nor any of their employees, makes any + * warranty, express or implied, or assumes any liability or + * responsibility for the accuracy, completeness, or usefulness of + * any information, apparatus, product, or process disclosed, or + * represents that its use would not infringe privately-owned + * rights. + * + * 3. Also, reference herein to any specific commercial products, + * process, or services by trade name, trademark, manufacturer or + * otherwise does not necessarily constitute or imply its + * endorsement, recommendation, or favoring by the United States + * Government or Lawrence Livermore National Security, LLC. The + * views and opinions of authors expressed herein do not + * necessarily state or reflect those of the United States + * Government or Lawrence Livermore National Security, LLC, and + * shall not be used for advertising or product endorsement + * purposes. + * + * -- LICENSE END -- */ + +#include +#include +#include + +#include +#include +#include + +#include + +namespace { + +std::map& main_name_map() { + static std::map mymap; + return mymap; +} + +std::map& main_func_map() { + static std::map mymap; + return mymap; +} + +flit::ProcResult call_main_impl( + flit::MainFunc *func, std::string run_wrap, std::string progname, + std::string remaining_args) +{ + // calls myself + auto funcname = flit::find_main_name(func); + if (progname == "") { + progname = flit::g_program_path; + } + std::ostringstream command_builder; + command_builder << run_wrap << " " + << '"' << flit::g_program_path << '"' + << " --progname \"" << progname << "\"" + << " --call-main " << funcname + << " " << remaining_args; + return flit::call_with_output(command_builder.str()); +} + +} // end of unnamed namespace + +namespace flit { + +ProcResult call_with_output(const std::string &command) { + flit::TempFile tempfile; + + // run the command + std::string cmd = command + " 2>" + tempfile.name; + FILE* output = popen(cmd.c_str(), "r"); + + // grab stdout + std::ostringstream outbuilder; + const int bufsize = 256; + char buf[bufsize]; + if (output) { + while (!feof(output)) { + if (fgets(buf, bufsize, output) != nullptr) { + outbuilder << buf; + } + } + } + + // wait and grab the return code + int ret = pclose(output); + auto err = flit::readfile(tempfile.name); + + if (WIFEXITED(ret)) { + ret = WEXITSTATUS(ret); + } + + return ProcResult { ret, outbuilder.str(), err }; +} + +std::ostream& operator<<(std::ostream& out, const ProcResult &res) { + out << "ProcResult(" + << "ret=" << res.ret << ", " + << "out=\"" << res.out << "\", " + << "err=\"" << res.err << "\")"; + return out; +} + +void register_main_func(const std::string &main_name, MainFunc* main_func) { + if (main_func == nullptr) { + throw std::invalid_argument("Main func is null"); + } + auto tmp_func = main_name_map().find(main_name); + if (tmp_func != main_name_map().end() && tmp_func->second != main_func) { + throw std::logic_error("Main name already registered " + "to a different function: " + main_name); + } + auto tmp_name = main_func_map().find(main_func); + if (tmp_name != main_func_map().end() && tmp_name->second != main_name) { + throw std::logic_error("Main func already registered " + "with a different name: " + main_name + + " != " + tmp_name->second); + } + main_name_map()[main_name] = main_func; + main_func_map()[main_func] = main_name; +} + +MainFunc* find_main_func(const std::string &main_name) { + return main_name_map().at(main_name); +} + +std::string find_main_name(MainFunc *main_func) { + if (main_func == nullptr) { + throw std::invalid_argument("Main func is null"); + } + return main_func_map().at(main_func); +} + +ProcResult call_main(MainFunc *func, std::string progname, + std::string remaining_args) +{ + std::string run_wrapper = ""; + return call_main_impl(func, run_wrapper, progname, remaining_args); +} + +ProcResult call_mpi_main(MainFunc *func, std::string mpirun_command, + std::string progname, std::string remaining_args) +{ + return call_main_impl(func, mpirun_command, progname, remaining_args); +} + +} // end of namespace flit diff --git a/src/subprocess.h b/src/flit/subprocess.h similarity index 98% rename from src/subprocess.h rename to src/flit/subprocess.h index 9e5df2d8..a757e168 100644 --- a/src/subprocess.h +++ b/src/flit/subprocess.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -130,7 +130,7 @@ std::string find_main_name(MainFunc *main_func); * #include "main.cc" * #undef main * - * #include "flit.h" + * #include * * #include * diff --git a/src/timeFunction.cpp b/src/flit/timeFunction.cpp similarity index 98% rename from src/timeFunction.cpp rename to src/flit/timeFunction.cpp index a2b80dbf..753b8e32 100644 --- a/src/timeFunction.cpp +++ b/src/flit/timeFunction.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -81,7 +81,7 @@ * -- LICENSE END -- */ -#include "timeFunction.h" +#include #include #include diff --git a/src/timeFunction.h b/src/flit/timeFunction.h similarity index 98% rename from src/timeFunction.h rename to src/flit/timeFunction.h index e4d7e5bb..06749496 100644 --- a/src/timeFunction.h +++ b/src/flit/timeFunction.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/src/tinydir.h b/src/flit/tinydir.h similarity index 100% rename from src/tinydir.h rename to src/flit/tinydir.h diff --git a/src/subprocess.cpp b/src/subprocess.cpp deleted file mode 100644 index b4431b83..00000000 --- a/src/subprocess.cpp +++ /dev/null @@ -1,119 +0,0 @@ -#include "subprocess.h" -#include "fsutil.h" -#include "flitHelpers.h" - -#include -#include -#include - -#include - -namespace { - -std::map main_name_map; -std::map main_func_map; - -flit::ProcResult call_main_impl( - flit::MainFunc *func, std::string run_wrap, std::string progname, - std::string remaining_args) -{ - // calls myself - auto funcname = flit::find_main_name(func); - if (progname == "") { - progname = flit::g_program_path; - } - std::ostringstream command_builder; - command_builder << run_wrap << " " - << '"' << flit::g_program_path << '"' - << " --progname \"" << progname << "\"" - << " --call-main " << funcname - << " " << remaining_args; - return flit::call_with_output(command_builder.str()); -} - -} // end of unnamed namespace - -namespace flit { - -ProcResult call_with_output(const std::string &command) { - flit::TempFile tempfile; - - // run the command - std::string cmd = command + " 2>" + tempfile.name; - FILE* output = popen(cmd.c_str(), "r"); - - // grab stdout - std::ostringstream outbuilder; - const int bufsize = 256; - char buf[bufsize]; - if (output) { - while (!feof(output)) { - if (fgets(buf, bufsize, output) != nullptr) { - outbuilder << buf; - } - } - } - - // wait and grab the return code - int ret = pclose(output); - auto err = flit::readfile(tempfile.name); - - if (WIFEXITED(ret)) { - ret = WEXITSTATUS(ret); - } - - return ProcResult { ret, outbuilder.str(), err }; -} - -std::ostream& operator<<(std::ostream& out, const ProcResult &res) { - out << "ProcResult(" - << "ret=" << res.ret << ", " - << "out=\"" << res.out << "\", " - << "err=\"" << res.err << "\")"; - return out; -} - -void register_main_func(const std::string &main_name, MainFunc* main_func) { - if (main_func == nullptr) { - throw std::invalid_argument("Main func is null"); - } - auto tmp_func = main_name_map.find(main_name); - if (tmp_func != main_name_map.end() && tmp_func->second != main_func) { - throw std::logic_error("Main name already registered " - "to a different function: " + main_name); - } - auto tmp_name = main_func_map.find(main_func); - if (tmp_name != main_func_map.end() && tmp_name->second != main_name) { - throw std::logic_error("Main func already registered " - "with a different name: " + main_name - + " != " + tmp_name->second); - } - main_name_map[main_name] = main_func; - main_func_map[main_func] = main_name; -} - -MainFunc* find_main_func(const std::string &main_name) { - return main_name_map.at(main_name); -} - -std::string find_main_name(MainFunc *main_func) { - if (main_func == nullptr) { - throw std::invalid_argument("Main func is null"); - } - return main_func_map.at(main_func); -} - -ProcResult call_main(MainFunc *func, std::string progname, - std::string remaining_args) -{ - std::string run_wrapper = ""; - return call_main_impl(func, run_wrapper, progname, remaining_args); -} - -ProcResult call_mpi_main(MainFunc *func, std::string mpirun_command, - std::string progname, std::string remaining_args) -{ - return call_main_impl(func, mpirun_command, progname, remaining_args); -} - -} // end of namespace flit diff --git a/tests/flit_cli/flit_bisect/data/tests/A.cpp b/tests/flit_cli/flit_bisect/data/tests/A.cpp index 2d1c4164..fd8091c4 100644 --- a/tests/flit_cli/flit_bisect/data/tests/A.cpp +++ b/tests/flit_cli/flit_bisect/data/tests/A.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "A.h" -#include +#include #include diff --git a/tests/flit_cli/flit_bisect/data/tests/A.h b/tests/flit_cli/flit_bisect/data/tests/A.h index a4fb888c..d0c144a0 100644 --- a/tests/flit_cli/flit_bisect/data/tests/A.h +++ b/tests/flit_cli/flit_bisect/data/tests/A.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/tests/flit_cli/flit_bisect/data/tests/BisectTest.cpp b/tests/flit_cli/flit_bisect/data/tests/BisectTest.cpp index 2d535a02..a6a7cbf0 100644 --- a/tests/flit_cli/flit_bisect/data/tests/BisectTest.cpp +++ b/tests/flit_cli/flit_bisect/data/tests/BisectTest.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -87,7 +87,7 @@ #include "file4.h" #include "A.h" -#include +#include #include diff --git a/tests/flit_cli/flit_bisect/data/tests/file1.cpp b/tests/flit_cli/flit_bisect/data/tests/file1.cpp index 5e37a6a8..573b2987 100644 --- a/tests/flit_cli/flit_bisect/data/tests/file1.cpp +++ b/tests/flit_cli/flit_bisect/data/tests/file1.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "file1.h" -#include +#include #include diff --git a/tests/flit_cli/flit_bisect/data/tests/file1.h b/tests/flit_cli/flit_bisect/data/tests/file1.h index e426f2ca..a9caf0a5 100644 --- a/tests/flit_cli/flit_bisect/data/tests/file1.h +++ b/tests/flit_cli/flit_bisect/data/tests/file1.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/tests/flit_cli/flit_bisect/data/tests/file2.cpp b/tests/flit_cli/flit_bisect/data/tests/file2.cpp index 45d84bcf..837b660b 100644 --- a/tests/flit_cli/flit_bisect/data/tests/file2.cpp +++ b/tests/flit_cli/flit_bisect/data/tests/file2.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "file2.h" -#include +#include #include diff --git a/tests/flit_cli/flit_bisect/data/tests/file2.h b/tests/flit_cli/flit_bisect/data/tests/file2.h index 087b0ba0..39dcb63c 100644 --- a/tests/flit_cli/flit_bisect/data/tests/file2.h +++ b/tests/flit_cli/flit_bisect/data/tests/file2.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/tests/flit_cli/flit_bisect/data/tests/file3.cpp b/tests/flit_cli/flit_bisect/data/tests/file3.cpp index 22fcfea5..5f697928 100644 --- a/tests/flit_cli/flit_bisect/data/tests/file3.cpp +++ b/tests/flit_cli/flit_bisect/data/tests/file3.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "file1.h" -#include +#include #include diff --git a/tests/flit_cli/flit_bisect/data/tests/file3.h b/tests/flit_cli/flit_bisect/data/tests/file3.h index 70334e98..77609591 100644 --- a/tests/flit_cli/flit_bisect/data/tests/file3.h +++ b/tests/flit_cli/flit_bisect/data/tests/file3.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/tests/flit_cli/flit_bisect/data/tests/file4.cxx b/tests/flit_cli/flit_bisect/data/tests/file4.cxx index 1cc9c607..70236a63 100644 --- a/tests/flit_cli/flit_bisect/data/tests/file4.cxx +++ b/tests/flit_cli/flit_bisect/data/tests/file4.cxx @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,7 +83,7 @@ #include "file4.h" -#include +#include #include diff --git a/tests/flit_cli/flit_bisect/data/tests/file4.h b/tests/flit_cli/flit_bisect/data/tests/file4.h index fc9baf15..3d21e91b 100644 --- a/tests/flit_cli/flit_bisect/data/tests/file4.h +++ b/tests/flit_cli/flit_bisect/data/tests/file4.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/tests/flit_cli/flit_bisect/tst_bisect.py b/tests/flit_cli/flit_bisect/tst_bisect.py index 200b9ecd..37e357a3 100644 --- a/tests/flit_cli/flit_bisect/tst_bisect.py +++ b/tests/flit_cli/flit_bisect/tst_bisect.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_cli/flit_bisect/tst_bisect_autosqlite_clang.py b/tests/flit_cli/flit_bisect/tst_bisect_autosqlite_clang.py index 7fd0b49a..5a24787b 100644 --- a/tests/flit_cli/flit_bisect/tst_bisect_autosqlite_clang.py +++ b/tests/flit_cli/flit_bisect/tst_bisect_autosqlite_clang.py @@ -173,7 +173,7 @@ >>> fakeclang_lines = [line for line in makeout1 ... if line.startswith('./fake_clang34.py')] >>> len(fakeclang_lines) -8 +9 >>> any('--gcc-toolchain' in line for line in fakeclang_lines) False @@ -181,7 +181,7 @@ >>> gcc_lines = [line for line in makeout2 ... if line.startswith('g++ ')] >>> len(gcc_lines) -8 +9 >>> any('--gcc-toolchain' in line for line in gcc_lines) False diff --git a/tests/flit_cli/flit_bisect/tst_bisect_biggest.py b/tests/flit_cli/flit_bisect/tst_bisect_biggest.py index 147c608d..e8fb9d86 100644 --- a/tests/flit_cli/flit_bisect/tst_bisect_biggest.py +++ b/tests/flit_cli/flit_bisect/tst_bisect_biggest.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_cli/flit_bisect/tst_bisect_compilerspecificflags.py b/tests/flit_cli/flit_bisect/tst_bisect_compilerspecificflags.py index c031c80f..e115459a 100644 --- a/tests/flit_cli/flit_bisect/tst_bisect_compilerspecificflags.py +++ b/tests/flit_cli/flit_bisect/tst_bisect_compilerspecificflags.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_cli/flit_import/tst_dbfile.py b/tests/flit_cli/flit_import/tst_dbfile.py index c63b9d38..c4d6137f 100644 --- a/tests/flit_cli/flit_import/tst_dbfile.py +++ b/tests/flit_cli/flit_import/tst_dbfile.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_cli/flit_update/tst_badconfig.py b/tests/flit_cli/flit_update/tst_badconfig.py index 514eac8c..0f7783f8 100644 --- a/tests/flit_cli/flit_update/tst_badconfig.py +++ b/tests/flit_cli/flit_update/tst_badconfig.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_cli/flit_update/tst_common_funcs.py b/tests/flit_cli/flit_update/tst_common_funcs.py index c4d7c801..b8978b04 100644 --- a/tests/flit_cli/flit_update/tst_common_funcs.py +++ b/tests/flit_cli/flit_update/tst_common_funcs.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_cli/flit_update/tst_compilerspecificflags.py b/tests/flit_cli/flit_update/tst_compilerspecificflags.py index e1fa10d4..c61ccba2 100644 --- a/tests/flit_cli/flit_update/tst_compilerspecificflags.py +++ b/tests/flit_cli/flit_update/tst_compilerspecificflags.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_cli/flit_update/tst_nocompilers.py b/tests/flit_cli/flit_update/tst_nocompilers.py index 838623f3..3922389b 100644 --- a/tests/flit_cli/flit_update/tst_nocompilers.py +++ b/tests/flit_cli/flit_update/tst_nocompilers.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_cli/flit_update/tst_nooptl.py b/tests/flit_cli/flit_update/tst_nooptl.py index 2570d89e..e0673a10 100644 --- a/tests/flit_cli/flit_update/tst_nooptl.py +++ b/tests/flit_cli/flit_update/tst_nooptl.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_cli/flit_update/tst_noswitches.py b/tests/flit_cli/flit_update/tst_noswitches.py index b07091c2..d5f54787 100644 --- a/tests/flit_cli/flit_update/tst_noswitches.py +++ b/tests/flit_cli/flit_update/tst_noswitches.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_cli/flit_update/tst_onlyprovidedcompilers.py b/tests/flit_cli/flit_update/tst_onlyprovidedcompilers.py index 4d8b573e..1497d57a 100644 --- a/tests/flit_cli/flit_update/tst_onlyprovidedcompilers.py +++ b/tests/flit_cli/flit_update/tst_onlyprovidedcompilers.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_cli/flit_update/tst_onlyprovidedoptlswitches.py b/tests/flit_cli/flit_update/tst_onlyprovidedoptlswitches.py index 8299b1f9..6a0aac57 100644 --- a/tests/flit_cli/flit_update/tst_onlyprovidedoptlswitches.py +++ b/tests/flit_cli/flit_update/tst_onlyprovidedoptlswitches.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_cli/flit_version/tst_version.py b/tests/flit_cli/flit_version/tst_version.py index 8a0d23ad..7a2ca5b1 100644 --- a/tests/flit_cli/flit_version/tst_version.py +++ b/tests/flit_cli/flit_version/tst_version.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # @@ -124,7 +124,7 @@ ... _ = subp.check_output(['make', 'install', ... 'DESTDIR=' + destdir, ... 'PREFIX=' + prefix, -... '-C', os.path.dirname(th.config.lib_dir)]) +... '-C', os.path.dirname(th.config.doc_dir)]) ... actual = subp.check_output([ ... os.path.join(effective_prefix, 'bin', 'flit'), '-v']) ... _ = shutil.copytree(effective_prefix, prefix, symlinks=True) diff --git a/tests/flit_install/tst_install_runthrough.py b/tests/flit_install/tst_install_runthrough.py index cc6c4507..8c26f070 100644 --- a/tests/flit_install/tst_install_runthrough.py +++ b/tests/flit_install/tst_install_runthrough.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # @@ -98,11 +98,12 @@ ... prefix = os.path.join(temp_dir, 'usr') ... effective_prefix = os.path.join(destdir, prefix[1:]) ... _ = subp.check_call(['make', -... '-C', os.path.join(th.config.lib_dir, '..'), +... '-C', os.path.join(th.config.doc_dir, '..'), ... 'install', ... 'DESTDIR=' + destdir, ... 'PREFIX=' + prefix], ... stdout=subp.DEVNULL, stderr=subp.DEVNULL) +... install_list = glob.glob(effective_prefix + '/**', recursive=True) ... flit = os.path.join(effective_prefix, 'bin', 'flit') ... sandbox_dir = os.path.join(effective_prefix, 'sandbox') ... _ = subp.check_call([flit, 'init', '-C', sandbox_dir], @@ -128,10 +129,10 @@ >>> flitconfig.doc_dir == os.path.join(prefix, 'share', 'flit', 'doc') True ->>> flitconfig.lib_dir == os.path.join(prefix, 'lib') +>>> flitconfig.src_dir == os.path.join(prefix, 'share', 'flit', 'src') True ->>> flitconfig.include_dir == os.path.join(prefix, 'include', 'flit') +>>> flitconfig.include_dir == os.path.join(prefix, 'include') True >>> flitconfig.config_dir == os.path.join(prefix, 'share', 'flit', 'config') @@ -143,6 +144,172 @@ >>> flitconfig.litmus_test_dir == os.path.join(prefix, 'share', 'flit', ... 'litmus-tests') True + +Check that the expected list of installed files are all there +>>> all(x.startswith(effective_prefix) for x in install_list) +True + +>>> from pprint import pprint +>>> pprint(sorted(x[len(effective_prefix)+1:] for x in install_list)) +['', + 'bin', + 'bin/flit', + 'include', + 'include/flit', + 'include/flit.h', + 'include/flit/FlitCsv.h', + 'include/flit/InfoStream.h', + 'include/flit/TestBase.h', + 'include/flit/Variant.h', + 'include/flit/flit.h', + 'include/flit/flitHelpers.h', + 'include/flit/fsutil.h', + 'include/flit/subprocess.h', + 'include/flit/timeFunction.h', + 'include/flit/tinydir.h', + 'share', + 'share/flit', + 'share/flit/benchmarks', + 'share/flit/benchmarks/README.md', + 'share/flit/benchmarks/polybench', + 'share/flit/benchmarks/polybench/README.md', + 'share/flit/benchmarks/polybench/custom.mk', + 'share/flit/benchmarks/polybench/flit-config.toml', + 'share/flit/benchmarks/polybench/main.cpp', + 'share/flit/benchmarks/polybench/tests', + 'share/flit/benchmarks/polybench/tests/adi.cpp', + 'share/flit/benchmarks/polybench/tests/atax.cpp', + 'share/flit/benchmarks/polybench/tests/bicg.cpp', + 'share/flit/benchmarks/polybench/tests/cholesky.cpp', + 'share/flit/benchmarks/polybench/tests/correlation.cpp', + 'share/flit/benchmarks/polybench/tests/covariance.cpp', + 'share/flit/benchmarks/polybench/tests/deriche.cpp', + 'share/flit/benchmarks/polybench/tests/doitgen.cpp', + 'share/flit/benchmarks/polybench/tests/durbin.cpp', + 'share/flit/benchmarks/polybench/tests/fdtd_2d.cpp', + 'share/flit/benchmarks/polybench/tests/floyd_warshall.cpp', + 'share/flit/benchmarks/polybench/tests/gemm.cpp', + 'share/flit/benchmarks/polybench/tests/gemver.cpp', + 'share/flit/benchmarks/polybench/tests/gesummv.cpp', + 'share/flit/benchmarks/polybench/tests/gramschmidt.cpp', + 'share/flit/benchmarks/polybench/tests/heat_3d.cpp', + 'share/flit/benchmarks/polybench/tests/jacobi_1d.cpp', + 'share/flit/benchmarks/polybench/tests/jacobi_2d.cpp', + 'share/flit/benchmarks/polybench/tests/lu.cpp', + 'share/flit/benchmarks/polybench/tests/ludcmp.cpp', + 'share/flit/benchmarks/polybench/tests/mvt.cpp', + 'share/flit/benchmarks/polybench/tests/nussinov.cpp', + 'share/flit/benchmarks/polybench/tests/polybench_utils.h', + 'share/flit/benchmarks/polybench/tests/seidel_2d.cpp', + 'share/flit/benchmarks/polybench/tests/symm.cpp', + 'share/flit/benchmarks/polybench/tests/syr2k.cpp', + 'share/flit/benchmarks/polybench/tests/syrk.cpp', + 'share/flit/benchmarks/polybench/tests/test2mm.cpp', + 'share/flit/benchmarks/polybench/tests/test3mm.cpp', + 'share/flit/benchmarks/polybench/tests/trisolv.cpp', + 'share/flit/benchmarks/polybench/tests/trmm.cpp', + 'share/flit/benchmarks/random', + 'share/flit/benchmarks/random/README.md', + 'share/flit/benchmarks/random/custom.mk', + 'share/flit/benchmarks/random/flit-config.toml', + 'share/flit/benchmarks/random/main.cpp', + 'share/flit/benchmarks/random/tests', + 'share/flit/benchmarks/random/tests/Rand.cpp', + 'share/flit/benchmarks/random/tests/Random.cpp', + 'share/flit/config', + 'share/flit/config/flit-default.toml.in', + 'share/flit/config/version.txt', + 'share/flit/data', + 'share/flit/data/Makefile.in', + 'share/flit/data/Makefile_bisect_binary.in', + 'share/flit/data/custom.mk', + 'share/flit/data/db', + 'share/flit/data/db/tables-sqlite.sql', + 'share/flit/data/main.cpp', + 'share/flit/data/tests', + 'share/flit/data/tests/Empty.cpp', + 'share/flit/doc', + 'share/flit/doc/README.md', + 'share/flit/doc/analyze-results.md', + 'share/flit/doc/autogenerated-tests.md', + 'share/flit/doc/available-compiler-flags.md', + 'share/flit/doc/benchmarks.md', + 'share/flit/doc/compiling-your-tests.md', + 'share/flit/doc/cuda-support.md', + 'share/flit/doc/database-structure.md', + 'share/flit/doc/experimental-features.md', + 'share/flit/doc/flit-command-line.md', + 'share/flit/doc/flit-configuration-file.md', + 'share/flit/doc/flit-helpers.md', + 'share/flit/doc/installation.md', + 'share/flit/doc/litmus-tests.md', + 'share/flit/doc/mpi-support.md', + 'share/flit/doc/release-notes.md', + 'share/flit/doc/run-wrapper-and-hpc-support.md', + 'share/flit/doc/standard-c++-library-implementations.md', + 'share/flit/doc/test-executable.md', + 'share/flit/doc/test-input-generator.md', + 'share/flit/doc/writing-test-cases.md', + 'share/flit/litmus-tests', + 'share/flit/litmus-tests/DistributivityOfMultiplication.cpp', + 'share/flit/litmus-tests/DoHariGSBasic.cpp', + 'share/flit/litmus-tests/DoHariGSImproved.cpp', + 'share/flit/litmus-tests/DoMatrixMultSanity.cpp', + 'share/flit/litmus-tests/DoOrthoPerturbTest.cpp', + 'share/flit/litmus-tests/DoSimpleRotate90.cpp', + 'share/flit/litmus-tests/DoSkewSymCPRotationTest.cpp', + 'share/flit/litmus-tests/FMACancel.cpp', + 'share/flit/litmus-tests/InliningProblem.cpp', + 'share/flit/litmus-tests/Kahan.h', + 'share/flit/litmus-tests/KahanSum.cpp', + 'share/flit/litmus-tests/Matrix.h', + 'share/flit/litmus-tests/Paranoia.cpp', + 'share/flit/litmus-tests/RandHelper.cpp', + 'share/flit/litmus-tests/RandHelper.h', + 'share/flit/litmus-tests/ReciprocalMath.cpp', + 'share/flit/litmus-tests/RotateAndUnrotate.cpp', + 'share/flit/litmus-tests/RotateFullCircle.cpp', + 'share/flit/litmus-tests/Shewchuk.h', + 'share/flit/litmus-tests/ShewchukSum.cpp', + 'share/flit/litmus-tests/SimpleCHull.cpp', + 'share/flit/litmus-tests/SinInt.cpp', + 'share/flit/litmus-tests/TrianglePHeron.cpp', + 'share/flit/litmus-tests/TrianglePSylv.cpp', + 'share/flit/litmus-tests/Vector.h', + 'share/flit/litmus-tests/langois.cpp', + 'share/flit/litmus-tests/simple_convex_hull.cpp', + 'share/flit/litmus-tests/simple_convex_hull.h', + 'share/flit/litmus-tests/tinys.cpp', + 'share/flit/scripts', + 'share/flit/scripts/README.md', + 'share/flit/scripts/experimental', + 'share/flit/scripts/experimental/flit_ninja.py', + 'share/flit/scripts/experimental/ninja_syntax.py', + 'share/flit/scripts/flit.py', + 'share/flit/scripts/flit_bisect.py', + 'share/flit/scripts/flit_experimental.py', + 'share/flit/scripts/flit_import.py', + 'share/flit/scripts/flit_init.py', + 'share/flit/scripts/flit_make.py', + 'share/flit/scripts/flit_update.py', + 'share/flit/scripts/flitconfig.py', + 'share/flit/scripts/flitelf.py', + 'share/flit/scripts/flitutil.py', + 'share/flit/src', + 'share/flit/src/ALL-FLIT.cpp', + 'share/flit/src/FlitCsv.cpp', + 'share/flit/src/InfoStream.cpp', + 'share/flit/src/TestBase.cpp', + 'share/flit/src/Variant.cpp', + 'share/flit/src/flit.cpp', + 'share/flit/src/flitHelpers.cpp', + 'share/flit/src/fsutil.cpp', + 'share/flit/src/subprocess.cpp', + 'share/flit/src/timeFunction.cpp', + 'share/licenses', + 'share/licenses/flit', + 'share/licenses/flit/LICENSE'] + ''' # Test setup before the docstring is run. diff --git a/tests/flit_install/tst_uninstall_runthrough.py b/tests/flit_install/tst_uninstall_runthrough.py index 2a4d0050..4a2f263a 100644 --- a/tests/flit_install/tst_uninstall_runthrough.py +++ b/tests/flit_install/tst_uninstall_runthrough.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # @@ -94,7 +94,7 @@ ... prefix = os.path.join(temp_dir, 'usr') ... effective_prefix = os.path.join(destdir, prefix[1:]) ... _ = subp.check_call(['make', -... '-C', os.path.join(th.config.lib_dir, '..'), +... '-C', os.path.join(th.config.doc_dir, '..'), ... 'install', ... 'DESTDIR=' + destdir, ... 'PREFIX=' + prefix], @@ -104,16 +104,16 @@ ... for y in os.listdir( ... os.path.join(effective_prefix, x))] ... _ = subp.check_call(['make', -... '-C', os.path.join(th.config.lib_dir, '..'), +... '-C', os.path.join(th.config.doc_dir, '..'), ... 'uninstall', ... 'DESTDIR=' + destdir, ... 'PREFIX=' + prefix], ... stdout=subp.DEVNULL, stderr=subp.DEVNULL) ... tempdir_exists = os.path.exists(effective_prefix) >>> sorted(dirs1) -['bin', 'include', 'lib', 'share'] +['bin', 'include', 'share'] >>> sorted(dirs2) -['bin/flit', 'include/flit', 'lib/libflit.so', 'share/flit', 'share/licenses'] +['bin/flit', 'include/flit', 'include/flit.h', 'share/flit', 'share/licenses'] >>> tempdir_exists False @@ -121,12 +121,12 @@ PREFIX path >>> import glob >>> with th.tempdir() as temp_dir: -... _ = subp.check_call(['make', '-C', os.path.join(th.config.lib_dir, '..'), +... _ = subp.check_call(['make', '-C', os.path.join(th.config.doc_dir, '..'), ... 'install', 'PREFIX=' + temp_dir], ... stdout=subp.DEVNULL, stderr=subp.DEVNULL) -... with open(os.path.join(temp_dir, 'lib', 'otherlib.so'), 'w'): +... with open(os.path.join(temp_dir, 'include', 'otherheader.h'), 'w'): ... pass -... _ = subp.check_call(['make', '-C', os.path.join(th.config.lib_dir, '..'), +... _ = subp.check_call(['make', '-C', os.path.join(th.config.doc_dir, '..'), ... 'uninstall', 'PREFIX=' + temp_dir], ... stdout=subp.DEVNULL, stderr=subp.DEVNULL) ... prevdir = os.path.realpath(os.curdir) @@ -136,7 +136,7 @@ ... for name in folders + filenames] ... os.chdir(prevdir) >>> sorted(all_files) -['./lib', './lib/otherlib.so'] +['./include', './include/otherheader.h'] ''' # Test setup before the docstring is run. diff --git a/tests/flit_makefile/tst_build_with_compiler_specific_flags.py b/tests/flit_makefile/tst_build_with_compiler_specific_flags.py index eec9fc84..52191ac7 100644 --- a/tests/flit_makefile/tst_build_with_compiler_specific_flags.py +++ b/tests/flit_makefile/tst_build_with_compiler_specific_flags.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # @@ -126,7 +126,7 @@ Creating .../Makefile >>> sum([1 for x in make_out if '-Wfixed-flag' in x]) -4 +5 >>> sum([1 for x in make_out if '-Wfix-link -Whello' in x]) 2 diff --git a/tests/flit_makefile/tst_clang34.py b/tests/flit_makefile/tst_clang34.py index 8f1a8634..0d18c18a 100644 --- a/tests/flit_makefile/tst_clang34.py +++ b/tests/flit_makefile/tst_clang34.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_makefile/tst_empty_project.py b/tests/flit_makefile/tst_empty_project.py index 5dacd91e..a2ede73d 100644 --- a/tests/flit_makefile/tst_empty_project.py +++ b/tests/flit_makefile/tst_empty_project.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # @@ -133,16 +133,10 @@ True >>> 'obj/dev/main.cpp.o obj/dev/Empty.cpp.o' in actual True ->>> '-L{libdir}'.format(libdir=th.config.lib_dir) in actual -True ->>> '-Wl,-rpath={libdir}'.format(libdir=th.config.lib_dir) in actual -True >>> '-lm' in actual True >>> '-lstdc++' in actual True ->>> '-lflit' in actual -True The same test, but with the 'gt' target @@ -166,16 +160,10 @@ True >>> 'obj/gt/main.cpp.o obj/gt/Empty.cpp.o' in actual True ->>> '-L{libdir}'.format(libdir=th.config.lib_dir) in actual -True ->>> '-Wl,-rpath={libdir}'.format(libdir=th.config.lib_dir) in actual -True >>> '-lm' in actual True >>> '-lstdc++' in actual True ->>> '-lflit' in actual -True Let's actually now compile and run the empty test under different circumstances diff --git a/tests/flit_makefile/tst_gcc4.py b/tests/flit_makefile/tst_gcc4.py index fb783ffa..77ec3689 100644 --- a/tests/flit_makefile/tst_gcc4.py +++ b/tests/flit_makefile/tst_gcc4.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_makefile/tst_incremental_build.py b/tests/flit_makefile/tst_incremental_build.py index 9d9b7e5c..346695d5 100644 --- a/tests/flit_makefile/tst_incremental_build.py +++ b/tests/flit_makefile/tst_incremental_build.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # @@ -136,7 +136,7 @@ Make sure all of the correct files were created with our build commands >>> touched_files(before_build) -['devrun', 'obj/dev/Empty.cpp.o', 'obj/dev/main.cpp.o'] +['devrun', 'obj/dev/ALL-FLIT.cpp.o', 'obj/dev/Empty.cpp.o', 'obj/dev/main.cpp.o'] >>> touched_files(after_build) [] @@ -174,7 +174,7 @@ Make sure all of the correct files were created with our build commands >>> touched_files(before_build) -['gtrun', 'obj/gt/Empty.cpp.o', 'obj/gt/main.cpp.o'] +['gtrun', 'obj/gt/ALL-FLIT.cpp.o', 'obj/gt/Empty.cpp.o', 'obj/gt/main.cpp.o'] >>> touched_files(after_build) [] diff --git a/tests/flit_mpi/data/MpiFloat.cpp b/tests/flit_mpi/data/MpiFloat.cpp index 08b37da6..31476bbd 100644 --- a/tests/flit_mpi/data/MpiFloat.cpp +++ b/tests/flit_mpi/data/MpiFloat.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -81,7 +81,7 @@ * -- LICENSE END -- */ -#include +#include #include diff --git a/tests/flit_mpi/data/MpiHello.cpp b/tests/flit_mpi/data/MpiHello.cpp index 5c13e8c2..8d11d14e 100644 --- a/tests/flit_mpi/data/MpiHello.cpp +++ b/tests/flit_mpi/data/MpiHello.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -81,7 +81,7 @@ * -- LICENSE END -- */ -#include +#include #include diff --git a/tests/flit_mpi/tst_run_mpi.py b/tests/flit_mpi/tst_run_mpi.py index cfa5d659..ab2190cc 100644 --- a/tests/flit_mpi/tst_run_mpi.py +++ b/tests/flit_mpi/tst_run_mpi.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/flit_mpi/tst_run_mpi_templated.py b/tests/flit_mpi/tst_run_mpi_templated.py index 5da6d01e..0ca8727d 100644 --- a/tests/flit_mpi/tst_run_mpi_templated.py +++ b/tests/flit_mpi/tst_run_mpi_templated.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # @@ -107,6 +107,7 @@ ... _ = shutil.copy(os.path.join('data', 'MpiFloat.cpp'), ... os.path.join(temp_dir, 'tests')) ... _ = shutil.copy(os.path.join('data', 'flit-config.toml'), temp_dir) +... os.remove(os.path.join(temp_dir, 'tests', 'Empty.cpp')) ... retval = th.flit.main(['update', '-C', temp_dir]) ... if retval != 0: ... raise TestError('Main #2 returned with {}, failed to update' diff --git a/tests/flit_src/Makefile b/tests/flit_src/Makefile index a41490c4..1f977432 100644 --- a/tests/flit_src/Makefile +++ b/tests/flit_src/Makefile @@ -1,20 +1,21 @@ CC := g++ FLITDIR := ../.. -FLITLIBDIR := $(FLITDIR)/lib -FLITLIB := $(FLITLIBDIR)/libflit.so +FLIT_SRC := $(FLITDIR)/src/flit/ALL-FLIT.cpp CFLAGS := -O0 -g CFLAGS += -std=c++11 CFLAGS += -fprofile-arcs CFLAGS += -ftest-coverage CFLAGS += -fPIC -LDFLAGS := -L$(FLITLIBDIR) -lflit -LDFLAGS += -Wl,-rpath=$(FLITLIBDIR) +LDFLAGS := -lflit -L. -Wl,-rpath=$(CURDIR) SRC := $(wildcard *.cpp) DEPS := $(SRC:%.cpp=%.d) +DEPS += $(notdir $(FLIT_SRC:%.cpp=%.d)) TARGETS := $(SRC:%.cpp=%) GCOV_FILES := $(SRC:%.cpp=%.gcda) GCOV_FILES += $(SRC:%.cpp=%.gcno) +GCOV_FILES += $(notdir $(FLIT_SRC:%.cpp=%.gcda)) +GCOV_FILES += $(notdir $(FLIT_SRC:%.cpp=%.gcno)) RUN_TARGETS := $(TARGETS:%=run_%) HARNESS := ../test_harness.h CFLAGS += $(addprefix -I,$(dir $(HARNESS))) @@ -44,6 +45,7 @@ clean: rm -f $(DEPS) rm -f $(TARGETS) rm -f $(GCOV_FILES) + rm -f libflit.so run_% : % @$(call color_out_noline,BROWN, running) @@ -57,7 +59,8 @@ run_% : % .PRECIOUS: %.d -include $(DEPS) -$(TARGETS): $(FLITLIB) +$(TARGETS): libflit.so -$(FLITLIB): - @$(MAKE) -C $(FLITDIR) +libflit.so: $(FLIT_SRC) Makefile + @$(call color_out,CYAN, $< -> $@) + $(CC) -shared $(CFLAGS) $(DEPFLAGS) $< -o $@ diff --git a/tests/flit_src/tst_FlitCsv.cpp b/tests/flit_src/tst_FlitCsv.cpp index 1770d715..979abd3b 100644 --- a/tests/flit_src/tst_FlitCsv.cpp +++ b/tests/flit_src/tst_FlitCsv.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,8 +83,8 @@ #include "test_harness.h" -#include "FlitCsv.h" -#include "FlitCsv.cpp" +#include +#include namespace { diff --git a/tests/flit_src/tst_TestBase.cpp b/tests/flit_src/tst_TestBase.cpp index c5f1c57b..94c11bc2 100644 --- a/tests/flit_src/tst_TestBase.cpp +++ b/tests/flit_src/tst_TestBase.cpp @@ -82,12 +82,12 @@ */ #include "test_harness.h" -#include "fsutil.h" +#include #define time_function wrap_time_function #define time_function_autoloop wrap_time_function_autoloop -#include "TestBase.h" -#include "TestBase.cpp" +#include +#include #undef time_function #undef time_function_autoloop diff --git a/tests/flit_src/tst_Variant.cpp b/tests/flit_src/tst_Variant.cpp index 7dc4b88d..5386021e 100644 --- a/tests/flit_src/tst_Variant.cpp +++ b/tests/flit_src/tst_Variant.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,8 +83,8 @@ #include "test_harness.h" -#include "Variant.h" -#include "Variant.cpp" +#include +#include #include #include diff --git a/tests/flit_src/tst_flitHelpers_h.cpp b/tests/flit_src/tst_flitHelpers_h.cpp index 0f819e7b..881b9971 100644 --- a/tests/flit_src/tst_flitHelpers_h.cpp +++ b/tests/flit_src/tst_flitHelpers_h.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -83,9 +83,8 @@ #include "test_harness.h" -#include "flitHelpers.h" - -#include "TestBase.h" // for operator<<(flit::TestResult ...) +#include +#include // for operator<<(flit::TestResult ...) #include #include diff --git a/tests/flit_src/tst_flit_cpp.cpp b/tests/flit_src/tst_flit_cpp.cpp index f97ff299..f171cebe 100644 --- a/tests/flit_src/tst_flit_cpp.cpp +++ b/tests/flit_src/tst_flit_cpp.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * @@ -81,13 +81,13 @@ * -- LICENSE END -- */ -#include "fsutil.h" +#include #include "test_harness.h" -#include "flit.h" -#include "flit.cpp" +#include +#include -#include "TestBase.h" // for operator<<(flit::TestResult ...) +#include // for operator<<(flit::TestResult ...) #include #include diff --git a/tests/flit_src/tst_fsutil.cpp b/tests/flit_src/tst_fsutil.cpp index 25c6b2c6..6973e9f7 100644 --- a/tests/flit_src/tst_fsutil.cpp +++ b/tests/flit_src/tst_fsutil.cpp @@ -82,9 +82,10 @@ */ #include "test_harness.h" -#include "fsutil.h" -#include "subprocess.h" -#include "fsutil.cpp" + +#include +#include +#include #include #include diff --git a/tests/flit_src/tst_subprocess.cpp b/tests/flit_src/tst_subprocess.cpp index e6c38c52..c5bec898 100644 --- a/tests/flit_src/tst_subprocess.cpp +++ b/tests/flit_src/tst_subprocess.cpp @@ -86,11 +86,11 @@ #include "test_harness.h" #undef main -#include "subprocess.h" -#include "subprocess.cpp" -#include "flitHelpers.h" -#include "flit.h" -#include "fsutil.h" +#include +#include +#include +#include +#include int main(int argCount, char* argList[]) { // Fast track means calling a user's main() function diff --git a/tests/harness/tst_test_harness.cpp b/tests/harness/tst_test_harness.cpp index 26e8176f..2f2e70c2 100644 --- a/tests/harness/tst_test_harness.cpp +++ b/tests/harness/tst_test_harness.cpp @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/tests/shared/fake_clang34.py b/tests/shared/fake_clang34.py index d8389129..cc55decd 100755 --- a/tests/shared/fake_clang34.py +++ b/tests/shared/fake_clang34.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/shared/fake_gcc4.py b/tests/shared/fake_gcc4.py index 0628a867..0a96794a 100755 --- a/tests/shared/fake_gcc4.py +++ b/tests/shared/fake_gcc4.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/shared/fake_gcc9.py b/tests/shared/fake_gcc9.py index d1dff346..b9e62a56 100755 --- a/tests/shared/fake_gcc9.py +++ b/tests/shared/fake_gcc9.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/shared/fake_intel19.py b/tests/shared/fake_intel19.py index ece4d67b..ee037054 100755 --- a/tests/shared/fake_intel19.py +++ b/tests/shared/fake_intel19.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory # diff --git a/tests/test_harness.h b/tests/test_harness.h index 411138da..70d49e3c 100644 --- a/tests/test_harness.h +++ b/tests/test_harness.h @@ -1,6 +1,6 @@ /* -- LICENSE BEGIN -- * - * Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. + * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. * * Produced at the Lawrence Livermore National Laboratory * diff --git a/tests/test_harness.py b/tests/test_harness.py index 76df1a6e..b0e508c7 100644 --- a/tests/test_harness.py +++ b/tests/test_harness.py @@ -1,6 +1,6 @@ # -- LICENSE BEGIN -- # -# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC. +# Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. # # Produced at the Lawrence Livermore National Laboratory #