├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── automated-tests.yml ├── .gitignore ├── .gitmodules ├── CREDITS ├── LICENSE ├── Makefile ├── README.md ├── benchmarks ├── README.md ├── polybench │ ├── README.md │ ├── custom.mk │ ├── flit-config.toml │ ├── main.cpp │ └── tests │ │ ├── adi.cpp │ │ ├── atax.cpp │ │ ├── bicg.cpp │ │ ├── cholesky.cpp │ │ ├── correlation.cpp │ │ ├── covariance.cpp │ │ ├── deriche.cpp │ │ ├── doitgen.cpp │ │ ├── durbin.cpp │ │ ├── fdtd_2d.cpp │ │ ├── floyd_warshall.cpp │ │ ├── gemm.cpp │ │ ├── gemver.cpp │ │ ├── gesummv.cpp │ │ ├── gramschmidt.cpp │ │ ├── heat_3d.cpp │ │ ├── jacobi_1d.cpp │ │ ├── jacobi_2d.cpp │ │ ├── lu.cpp │ │ ├── ludcmp.cpp │ │ ├── mvt.cpp │ │ ├── nussinov.cpp │ │ ├── polybench_utils.h │ │ ├── seidel_2d.cpp │ │ ├── symm.cpp │ │ ├── syr2k.cpp │ │ ├── syrk.cpp │ │ ├── test2mm.cpp │ │ ├── test3mm.cpp │ │ ├── trisolv.cpp │ │ └── trmm.cpp └── random │ ├── README.md │ ├── custom.mk │ ├── flit-config.toml │ ├── main.cpp │ └── tests │ ├── Rand.cpp │ └── Random.cpp ├── data ├── Makefile.in ├── Makefile_bisect_binary.in ├── custom.mk ├── db │ └── tables-sqlite.sql ├── main.cpp └── tests │ └── Empty.cpp ├── documentation ├── README.md ├── analyze-results.md ├── autogenerated-tests.md ├── available-compiler-flags.md ├── benchmarks.md ├── compiling-your-tests.md ├── cuda-support.md ├── database-structure.md ├── experimental-features.md ├── flit-command-line.md ├── flit-configuration-file.md ├── flit-helpers.md ├── installation.md ├── litmus-tests.md ├── mpi-support.md ├── release-notes.md ├── run-wrapper-and-hpc-support.md ├── standard-c++-library-implementations.md ├── test-executable.md ├── test-input-generator.md └── writing-test-cases.md ├── gensrc ├── environment.py ├── expression.py ├── gensrc.py └── testcase.py ├── images ├── bisect-search.pdf ├── bisect-search.svg ├── flit-small.png ├── flit.png └── flit.svg ├── inputGen ├── .ycm_extra_conf.py ├── InfoStream.cpp ├── TestBase.cpp ├── flitHelpers.cpp ├── groundtruth.cpp ├── groundtruth.h ├── helper.cpp ├── helper.h ├── main.cpp ├── makefile ├── testbed.cpp └── testbed.h ├── litmus-tests └── tests │ ├── DistributivityOfMultiplication.cpp │ ├── DoHariGSBasic.cpp │ ├── DoHariGSImproved.cpp │ ├── DoMatrixMultSanity.cpp │ ├── DoOrthoPerturbTest.cpp │ ├── DoSimpleRotate90.cpp │ ├── DoSkewSymCPRotationTest.cpp │ ├── FMACancel.cpp │ ├── InliningProblem.cpp │ ├── Kahan.h │ ├── KahanSum.cpp │ ├── Matrix.h │ ├── Paranoia.cpp │ ├── RandHelper.cpp │ ├── RandHelper.h │ ├── ReciprocalMath.cpp │ ├── RotateAndUnrotate.cpp │ ├── RotateFullCircle.cpp │ ├── Shewchuk.h │ ├── ShewchukSum.cpp │ ├── SimpleCHull.cpp │ ├── SinInt.cpp │ ├── TrianglePHeron.cpp │ ├── TrianglePSylv.cpp │ ├── Vector.h │ ├── langois.cpp │ ├── simple_convex_hull.cpp │ ├── simple_convex_hull.h │ └── tinys.cpp ├── plans ├── bisect-plan.md ├── clang-versions.md └── intel-linker.md ├── plotting ├── compare_matrix.py ├── pivot_table.py ├── plot_speedup_histogram.py ├── plot_timing.py └── stats_generator.py ├── pylint.rc ├── scripts ├── bash-completion │ └── flit ├── flitcli │ ├── README.md │ ├── config │ │ ├── flit-default.toml.in │ │ └── version.txt │ ├── experimental │ │ ├── flit_ninja.py │ │ └── ninja_syntax.py │ ├── flit.py │ ├── flit_bisect.py │ ├── flit_disguise.py │ ├── flit_experimental.py │ ├── flit_import.py │ ├── flit_init.py │ ├── flit_make.py │ ├── flit_update.py │ ├── flitconfig.py │ ├── flitelf.py │ ├── flitutil.py │ └── unfinished │ │ ├── flit_analyze.py │ │ ├── flit_check.py │ │ └── flit_run.py └── watch-progress.sh ├── src ├── .ycm_extra_conf.py ├── flit.h └── flit │ ├── ALL-FLIT.cpp │ ├── FlitCsv.cpp │ ├── FlitCsv.h │ ├── InfoStream.cpp │ ├── InfoStream.h │ ├── TestBase.cpp │ ├── TestBase.h │ ├── Variant.cpp │ ├── Variant.h │ ├── flit.cpp │ ├── flit.h │ ├── flitHelpers.cpp │ ├── flitHelpers.h │ ├── fsutil.cpp │ ├── fsutil.h │ ├── subprocess.cpp │ ├── subprocess.h │ ├── timeFunction.cpp │ ├── timeFunction.h │ └── tinydir.h └── tests ├── .gitignore ├── Makefile ├── README.md ├── color_out.mk ├── flit_cli ├── Makefile ├── bash_completion │ ├── Makefile │ ├── tst_completion_flit.py │ └── util │ │ ├── __init__.py │ │ ├── arginspect.py │ │ └── completion.py ├── flit_bisect │ ├── Makefile │ ├── common.py │ ├── data │ │ ├── auto-bisect-run-flit-config.toml │ │ ├── auto-bisect-run.csv │ │ ├── fake_clang34.py │ │ ├── fake_gcc4.py │ │ ├── fake_gcc9.py │ │ ├── fake_intel19.py │ │ ├── flit-config-compilerspecificflags.toml │ │ └── tests │ │ │ ├── A.cpp │ │ │ ├── A.h │ │ │ ├── BisectTest.cpp │ │ │ ├── file1.cpp │ │ │ ├── file1.h │ │ │ ├── file2.cpp │ │ │ ├── file2.h │ │ │ ├── file3.cpp │ │ │ ├── file3.h │ │ │ ├── file4.cxx │ │ │ └── file4.h │ ├── tst_bisect.py │ ├── tst_bisect_autosqlite_clang.py │ ├── tst_bisect_biggest.py │ ├── tst_bisect_compilerspecificflags.py │ ├── tst_bisect_duplicateGTtest.py │ └── tst_bisect_linkstep.py ├── flit_disguise │ ├── Makefile │ └── tst_flit_disguise.py ├── flit_import │ ├── Makefile │ ├── data │ │ └── data1.csv │ └── tst_dbfile.py ├── flit_init │ ├── Makefile │ └── tst_litmustests.py ├── flit_update │ ├── Makefile │ ├── README.md │ ├── data │ │ ├── compilerspecificflags.toml │ │ ├── fake_clang34.py │ │ ├── fake_gcc9.py │ │ ├── fake_intel19.py │ │ ├── nocompilers.toml │ │ ├── nooptl.toml │ │ ├── noswitches.toml │ │ ├── onlyprovidedcompilers.toml │ │ └── onlyprovidedoptlswitches.toml │ ├── tst_badconfig.py │ ├── tst_common_funcs.py │ ├── tst_compilerspecificflags.py │ ├── tst_nocompilers.py │ ├── tst_nooptl.py │ ├── tst_noswitches.py │ ├── tst_onlyprovidedcompilers.py │ └── tst_onlyprovidedoptlswitches.py └── flit_version │ ├── Makefile │ └── tst_version.py ├── flit_install ├── Makefile ├── tst_install_runthrough.py └── tst_uninstall_runthrough.py ├── flit_makefile ├── Makefile ├── fake_clang34.py ├── fake_gcc4.py ├── tst_build_with_compiler_specific_flags.py ├── tst_clang34.py ├── tst_empty_project.py ├── tst_gcc4.py └── tst_incremental_build.py ├── flit_mpi ├── Makefile ├── data │ ├── MpiFloat.cpp │ ├── MpiHello.cpp │ └── flit-config.toml ├── tst_run_mpi.py └── tst_run_mpi_templated.py ├── flit_src ├── Makefile ├── tst_FlitCsv.cpp ├── tst_TestBase.cpp ├── tst_Variant.cpp ├── tst_flitHelpers_h.cpp ├── tst_flit_cpp.cpp ├── tst_fsutil.cpp └── tst_subprocess.cpp ├── harness ├── Makefile └── tst_test_harness.cpp ├── shared ├── fake_clang34.py ├── fake_gcc4.py ├── fake_gcc9.py └── fake_intel19.py ├── test_harness.h └── test_harness.py /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🐛 Bug report 3 | about: Create a report to help us improve 🤔 4 | 5 | --- 6 | 7 | ## Bug Report 8 | 9 | 10 | ### Description 11 | 12 | _A clear and concise description of what the bug is._ 13 | _Include screenshots if applicable._ 14 | 15 | 16 | ### Suggested Fix 17 | 18 | _Do you have a suggestion for how to resolve the issue?_ 19 | 20 | 21 | ### Alternative approaches: 22 | 23 | _A clear and concise description of any alternative solutions or features you've considered._ 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🚀 Feature Request 3 | about: I have a suggestion (and may want to implement it 🙂)! 4 | 5 | --- 6 | 7 | ## Feature Request 8 | 9 | 10 | ### Description: 11 | 12 | _A clear and concise description of what your problem is. Ex. I have an issue when [...]_ 13 | 14 | 15 | ### Suggested change: 16 | 17 | _A clear and concise description of what you want to happen. Add any considered drawbacks. You can also specify potential design or architecture directions with planned implementation details._ 18 | 19 | 20 | ### Alternative approaches: 21 | 22 | _A clear and concise description of any alternative solutions or features you've considered._ 23 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Fixes # 2 | 3 | ### Description: 4 | 5 | _Describe what you changed and why._ 6 | 7 | - 8 | - 9 | - 10 | 11 | 12 | ### Documentation: 13 | 14 | _What documentation did you change?_ 15 | 16 | _If the change does not require updates to documentation, justify why._ 17 | 18 | 19 | ### Tests: 20 | 21 | _What automated tests did you change?_ 22 | 23 | _If the change does not require updates to tests, justify why._ 24 | -------------------------------------------------------------------------------- /.github/workflows/automated-tests.yml: -------------------------------------------------------------------------------- 1 | name: Automated Tests 2 | 3 | on: 4 | push: # all pushes, but only to the specified branches 5 | branches: [ devel, master, main ] 6 | pull_request: # all pull requests 7 | workflow_dispatch: # allows manual triggering on web interface 8 | 9 | jobs: 10 | automated-tests: 11 | runs-on: ubuntu-latest 12 | 13 | # matrix docs: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix 14 | strategy: 15 | matrix: 16 | include: 17 | - name: openmpi 18 | packages: libopenmpi-dev openmpi-bin 19 | - name: mpich 20 | packages: libmpich-dev mpich 21 | - name: none 22 | packages: 23 | 24 | steps: 25 | - name: install dependencies 26 | run: > 27 | sudo apt-get update && 28 | sudo apt-get install python3 python3-pip ${{ matrix.packages }} && 29 | pip3 install --user setuptools toml 30 | - uses: actions/checkout@v2 31 | - name: build tests 32 | run: make -C tests -j ${{ steps.cpu-cores.outputs.count }} 33 | - name: run tests 34 | run: make check 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # Custom 3 | # 4 | 5 | #host configuration file 6 | scripts/hostfile.py 7 | 8 | # Vim 9 | .*.swp 10 | .*.swo 11 | 12 | # Emacs 13 | *~ 14 | 15 | 16 | # 17 | # Python 18 | # 19 | 20 | # Byte-compiled / optimized / DLL files 21 | __pycache__/ 22 | *.py[cod] 23 | *$py.class 24 | 25 | 26 | # 27 | # C++ 28 | # 29 | 30 | # Prerequisites 31 | *.d 32 | 33 | # Compiled Object files 34 | *.slo 35 | *.lo 36 | *.o 37 | *.obj 38 | 39 | # Precompiled Headers 40 | *.gch 41 | *.pch 42 | 43 | # Compiled Dynamic libraries 44 | *.so 45 | *.dylib 46 | *.dll 47 | 48 | # Fortran module files 49 | *.mod 50 | *.smod 51 | 52 | # Compiled Static libraries 53 | *.lai 54 | *.la 55 | *.a 56 | *.lib 57 | 58 | # Executables 59 | *.exe 60 | *.out 61 | *.app 62 | 63 | 64 | # 65 | # LaTeX 66 | # 67 | 68 | # Core latex/pdflatex auxiliary files: 69 | *.aux 70 | *.lof 71 | *.log 72 | *.lot 73 | *.fls 74 | *.out 75 | *.toc 76 | *.fmt 77 | *.fot 78 | *.cb 79 | *.cb2 80 | 81 | # LaTeX Intermediate documents: 82 | *.dvi 83 | *-converted-to.* 84 | 85 | # Bibliography auxiliary files (bibtex/biblatex/biber): 86 | *.bbl 87 | *.bcf 88 | *.blg 89 | *-blx.aux 90 | *-blx.bib 91 | *.brf 92 | *.run.xml 93 | 94 | ## Build tool auxiliary files: 95 | *.fdb_latexmk 96 | *.synctex 97 | *.synctex(busy) 98 | *.synctex.gz 99 | *.synctex.gz(busy) 100 | *.pdfsync 101 | 102 | 103 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/FLiT/27b6061b9d2302fa8c3252fe770287bb4d07905b/.gitmodules -------------------------------------------------------------------------------- /CREDITS: -------------------------------------------------------------------------------- 1 | This file is a partial list of people who have contributed to FLiT. 2 | If you have contributed a patch or made some other contribution to 3 | FLiT, please submit a patch or a pull request to this file to add 4 | yourself, and it will be done! 5 | 6 | The list is sorted by surname and formatted to allow easy grepping and 7 | beautification by scripts. The fields are: name (N), email (E), web-address 8 | (W), PGP key ID and fingerprint (P), description (D), and snail-mail address 9 | (S). 10 | 11 | N: Michael Bentley 12 | E: mikebentley15@gmail.com 13 | D: Co-founder 14 | D: Ph.D. Student at University of Utah 15 | 16 | N: Ian Briggs 17 | E: ianbriggsutah@gmail.com 18 | D: Creator of some litmus tests 19 | D: Research staff at the University of Utah 20 | 21 | N: Goef Sawaya 22 | E: fredricflinstone@gmail.com 23 | D: Co-founder 24 | D: Research Staff at the University of Utah 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | License 2 | 3 | Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | 5 | Produced at the Lawrence Livermore National Laboratory 6 | 7 | Written by 8 | Michael Bentley (mikebentley15@gmail.com), 9 | Geof Sawaya (fredricflinstone@gmail.com), 10 | and Ian Briggs (ian.briggs@utah.edu) 11 | under the direction of 12 | Ganesh Gopalakrishnan 13 | and Dong H. Ahn. 14 | 15 | LLNL-CODE-743137 16 | 17 | All rights reserved. 18 | 19 | This file is part of FLiT. For details, see 20 | https://pruners.github.io/flit 21 | Please also read 22 | https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | 24 | Redistribution and use in source and binary forms, with or 25 | without modification, are permitted provided that the following 26 | conditions are met: 27 | 28 | - Redistributions of source code must retain the above copyright 29 | notice, this list of conditions and the disclaimer below. 30 | 31 | - Redistributions in binary form must reproduce the above 32 | copyright notice, this list of conditions and the disclaimer 33 | (as noted below) in the documentation and/or other materials 34 | provided with the distribution. 35 | 36 | - Neither the name of the LLNS/LLNL nor the names of its 37 | contributors may be used to endorse or promote products derived 38 | from this software without specific prior written permission. 39 | 40 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | THE POSSIBILITY OF SUCH DAMAGE. 54 | 55 | Additional BSD Notice 56 | 57 | 1. This notice is required to be provided under our contract 58 | with the U.S. Department of Energy (DOE). This work was 59 | produced at Lawrence Livermore National Laboratory under 60 | Contract No. DE-AC52-07NA27344 with the DOE. 61 | 62 | 2. Neither the United States Government nor Lawrence Livermore 63 | National Security, LLC nor any of their employees, makes any 64 | warranty, express or implied, or assumes any liability or 65 | responsibility for the accuracy, completeness, or usefulness of 66 | any information, apparatus, product, or process disclosed, or 67 | represents that its use would not infringe privately-owned 68 | rights. 69 | 70 | 3. Also, reference herein to any specific commercial products, 71 | process, or services by trade name, trademark, manufacturer or 72 | otherwise does not necessarily constitute or imply its 73 | endorsement, recommendation, or favoring by the United States 74 | Government or Lawrence Livermore National Security, LLC. The 75 | views and opinions of authors expressed herein do not 76 | necessarily state or reflect those of the United States 77 | Government or Lawrence Livermore National Security, LLC, and 78 | shall not be used for advertising or product endorsement 79 | purposes. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | | branch | status | 2 | |---------|---------| 3 | | master | ![Build Status](https://github.com/PRUNERS/FLiT/actions/workflows/automated-tests.yml/badge.svg?branch=master) | 4 | | devel | ![Build Status](https://github.com/PRUNERS/FLiT/actions/workflows/automated-tests.yml/badge.svg) | 5 | 6 | ![PyPI - License](https://img.shields.io/pypi/l/Django.svg) 7 | ![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg) 8 | 9 | # FLiT 10 | 11 | [![FLiT Bird](/images/flit-small.png)](https://github.com/PRUNERS/FLiT "FLiT") 12 | 13 | FLiT is a C++ test infrastructure for detecting variability in floating-point 14 | code caused by variations in compiler code generation, hardware and execution 15 | environments. 16 | 17 | Originally, FLiT stood for "Floating-point Litmus Tests", but has grown into a 18 | tool with much more flexability than to study simple litmus tests. However, it 19 | has always been the focus of FLiT to study the variability caused by compilers. 20 | That brings us to the other reason for the name, "flit" is defined by the 21 | Merriam Webster dictionary as "to pass quickly or abruptly from one place or 22 | condition to another". This fits in well with testing for various sources of 23 | variability. 24 | 25 | Compilers are primarily focused on optimizing the speed of your code. However, 26 | when it comes to floating-point, compilers go a little further than some might 27 | want, to the point that you may not get the same result from your 28 | floating-point algorithms. For many applications, this may not matter as the 29 | difference is typically very small. But there are situations where 30 | 31 | 1. The difference is not so small 32 | 2. Your application cares even about small differences, or 33 | 3. Your application is so large (such as a weather simulation) that a small 34 | change may propagate into very large result variability. 35 | 36 | _Note: It may be the variability observed is more a cause of bad programming 37 | practice than over-aggressive compiler optimizations. In this case, compiler 38 | optimizations may act as fuzzers for your code. It is up to you to determine 39 | if this is the case._ 40 | 41 | FLiT helps developers determine where reproducibility problems may occur due to 42 | compilers. The developer creates reproducibility tests with their code using 43 | the FLiT testing framework. Then FLiT takes those reproducibility tests and 44 | compiles them under a set of configured compilers and a large range of compiler 45 | flags. The results from the tests under different compilations are then compared 46 | against the results from a "ground truth" compilation (e.g. a completely 47 | unoptimized compilation). 48 | 49 | More than simply comparing against a "ground truth" test result, the FLiT 50 | framework also measures runtime of your tests. Using this information, you can 51 | not only determine which compilations of your code are safe for your specific 52 | application, but you can also determine the fastest safe compilation. This 53 | ability helps the developer navigate the trade-off between reproducibility and 54 | performance. 55 | 56 | It consists of the following components: 57 | 58 | * a C++ reproducibility test infrastructure 59 | * a dynamic make system to generate diverse compilations 60 | * an SQLite database containing results 61 | * tools to help analyze test results 62 | * a bisection tool that can isolate the file(s) and function(s) where 63 | variability was introduced by the compiler. 64 | 65 | Contents: 66 | 67 | * [Release Notes](documentation/release-notes.md) 68 | * [Installation](documentation/installation.md) 69 | * [Litmus Tests](documentation/litmus-tests.md) 70 | * [FLiT Command-Line](documentation/flit-command-line.md) 71 | * [FLiT Configuration File](documentation/flit-configuration-file.md) 72 | * [Available Compiler Flags](documentation/available-compiler-flags.md) 73 | * [Standard C++ Library Implementations](documentation/standard-c++-library-implementations.md) 74 | * [Writing Test Cases](documentation/writing-test-cases.md) 75 | * [FLiT Helpers](documentation/flit-helpers.md) 76 | * [MPI Support](documentation/mpi-support.md) 77 | * [CUDA Support](documentation/cuda-support.md) 78 | * [Run Wrapper and HPC Support](documentation/run-wrapper-and-hpc-support.md) 79 | * [Compiling Your Tests](documentation/compiling-your-tests.md) 80 | * [Test Executable](documentation/test-executable.md) 81 | * [Benchmarks](documentation/benchmarks.md) 82 | * [Database Structure](documentation/database-structure.md) 83 | * [Analyze Results](documentation/analyze-results.md) 84 | * [Experimental Features](documentation/experimental-features.md) 85 | * Extra Tools 86 | * [Autogenerated Tests](documentation/autogenerated-tests.md) 87 | * [Test Input Generator](documentation/test-input-generator.md) 88 | 89 | -------------------------------------------------------------------------------- /benchmarks/README.md: -------------------------------------------------------------------------------- 1 | # Benchmarks 2 | 3 | [Top-Level Documentation](../README.md) 4 | 5 | These benchmarks give insights into the usefulness of FLiT. Each benchmark has 6 | its own goals, either to demonstrate how FLiT can be useful, or to give 7 | insights into specific tools and functionalities. 8 | 9 | These benchmarks are also part of the installation, and can be copied from 10 | there to exercise FLiT's capabilities. They are installed in 11 | 12 | `$(PREFIX)/share/flit/benchmarks` 13 | 14 | [Top-Level Documentation](../README.md) 15 | -------------------------------------------------------------------------------- /benchmarks/polybench/README.md: -------------------------------------------------------------------------------- 1 | This is a test suite that was translated from the Polybench benchmark suite. 2 | The original can be found [here](http://web.cse.ohio-state.edu/~pouchet.2/software/polybench/). 3 | 4 | Each source file has a main class extending the FLiT test class while also 5 | parameterizing the size of input arrays for the given polyhedral kernel. 6 | The number of parameters varies from benchmark to benchmark. 7 | 8 | For convenience these classes can be specialized and entered into the FLiT tests 9 | by using the REGISTER_*N* macros where *N* is the number of parameterized arguments 10 | not including the float type used by FLiT. This macro takes the name of the base 11 | class as the first argument and numbers for all other arguments. 12 | 13 | To run the suite as is, with flit in your path: 14 | ``` 15 | flit update 16 | flit make 17 | ``` 18 | 19 | Manifest: 20 | -custom.mk: A FLiT generated makefile used to add additional flags to 21 | the compilations. 22 | -flit-config.toml: A FLiT generated configuration for integration into 23 | FLiT with a default setup for ibriggs on the machine 24 | fractus. 25 | -README.md: This file. 26 | -tests/*.cpp: Kernels from the Polybench suite. 27 | -tests/polybench_utils.hpp: Convenience functions and macros. -------------------------------------------------------------------------------- /benchmarks/polybench/custom.mk: -------------------------------------------------------------------------------- 1 | SOURCE += 2 | CXXFLAGS += 3 | LDFLAGS += 4 | LDLIBS += 5 | -------------------------------------------------------------------------------- /benchmarks/polybench/flit-config.toml: -------------------------------------------------------------------------------- 1 | # Use the default values 2 | -------------------------------------------------------------------------------- /benchmarks/polybench/main.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #include 85 | 86 | int main(int argCount, char* argList[]) { 87 | return flit::runFlitTests(argCount, argList); 88 | } 89 | -------------------------------------------------------------------------------- /benchmarks/random/README.md: -------------------------------------------------------------------------------- 1 | # Random Benchmark 2 | 3 | This benchmark is to test that the C++ `` header is portable accross 4 | compilers. My guess is that they will be since I suspect they are implemented 5 | in the GLibC, but I'm not sure. Hence the tests. This can give us confidence 6 | that this is indeed safe to depend on in FLiT tests. 7 | 8 | We also test the `rand()` and `srand()` functions that are part of the standard 9 | `` header file. However, we do not test the non-portable `random()`, 10 | `srandom()`, `initstate()`, and `setstate()` functions that are part of the 11 | POSIX standard, but are not part of the C++ standard. 12 | -------------------------------------------------------------------------------- /benchmarks/random/custom.mk: -------------------------------------------------------------------------------- 1 | SOURCE += 2 | CXXFLAGS += 3 | LDFLAGS += 4 | LDLIBS += 5 | -------------------------------------------------------------------------------- /benchmarks/random/flit-config.toml: -------------------------------------------------------------------------------- 1 | [run] 2 | timing = false 3 | 4 | # Use default values for all other options 5 | -------------------------------------------------------------------------------- /benchmarks/random/main.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #include 85 | 86 | int main(int argCount, char* argList[]) { 87 | return flit::runFlitTests(argCount, argList); 88 | } 89 | -------------------------------------------------------------------------------- /benchmarks/random/tests/Rand.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #include 85 | 86 | #include 87 | #include 88 | 89 | #include 90 | 91 | template 92 | class Rand : public flit::TestBase { 93 | public: 94 | Rand(std::string id) : flit::TestBase(std::move(id)) {} 95 | virtual size_t getInputsPerRun() override { return 1; } 96 | virtual std::vector getDefaultInput() override { return { 0, 42, 24, 12, 103 }; } 97 | protected: 98 | virtual flit::Variant run_impl(const std::vector &ti) override { 99 | FLIT_UNUSED(ti); 100 | return {}; 101 | } 102 | protected: 103 | using flit::TestBase::id; 104 | }; 105 | 106 | // Only implement the test for double precision 107 | template <> 108 | flit::Variant Rand::run_impl(const std::vector &ti) { 109 | size_t seed = ti[0]; 110 | srand(seed); 111 | return rand(); 112 | } 113 | 114 | REGISTER_TYPE(Rand); 115 | -------------------------------------------------------------------------------- /data/main.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- */ 82 | #include 83 | 84 | int main(int argCount, char* argList[]) { 85 | return flit::runFlitTests(argCount, argList); 86 | } 87 | -------------------------------------------------------------------------------- /documentation/README.md: -------------------------------------------------------------------------------- 1 | # Documentation Table Of Contents 2 | 3 | [Return to top-level README file](../README.md) 4 | 5 | * [Release Notes](release-notes.md) 6 | * [Installation](installation.md) 7 | * [Litmus Tests](litmus-tests.md) 8 | * [FLiT Command-Line](flit-command-line.md) 9 | * [FLiT Configuration File](flit-configuration-file.md) 10 | * [Available Compiler Flags](available-compiler-flags.md) 11 | * [Standard C++ Library Implementations](standard-c++-library-implementations.md) 12 | * [Writing Test Cases](writing-test-cases.md) 13 | * [FLiT Helpers](flit-helpers.md) 14 | * [MPI Support](mpi-support.md) 15 | * [CUDA Support](cuda-support.md) 16 | * [Run Wrapper and HPC Support](run-wrapper-and-hpc-support.md) 17 | * [Compiling Your Tests](compiling-your-tests.md) 18 | * [Test Executable](test-executable.md) 19 | * [Benchmarks](benchmarks.md) 20 | * [Database Structure](database-structure.md) 21 | * [Analyze Results](analyze-results.md) 22 | * [Experimental Features](experimental-features.md) 23 | * Extra Tools 24 | * [Autogenerated Tests](autogenerated-tests.md) 25 | * [Test Input Generator](test-input-generator.md) 26 | 27 | -------------------------------------------------------------------------------- /documentation/analyze-results.md: -------------------------------------------------------------------------------- 1 | # Analyze Results 2 | 3 | [Prev](database-structure.md) 4 | | 5 | [Table of Contents](README.md) 6 | | 7 | [Next](experimental-features.md) 8 | 9 | The analysis functionality is broken at the moment. You can expect to be here 10 | some instructions on how to generate useful charts from the gathered data. 11 | 12 | [Prev](database-structure.md) 13 | | 14 | [Table of Contents](README.md) 15 | | 16 | [Next](experimental-features.md) 17 | -------------------------------------------------------------------------------- /documentation/autogenerated-tests.md: -------------------------------------------------------------------------------- 1 | # Autogenerated Tests 2 | 3 | [Prev](experimental-features.md) 4 | | 5 | [Table of Contents](README.md) 6 | | 7 | [Next](test-input-generator.md) 8 | 9 | There is some code to randomly generate test cases. For now, these 10 | autogenerated test cases are limited to a small number of arithmetic 11 | expressions, almost all of which demonstrate variability on at least one flag. 12 | 13 | This tool requires an additional python package dependency, `numpy`. 14 | 15 | ```bash 16 | pip install numpy 17 | ``` 18 | 19 | To run this generator, you will probably want an already initialized flit test 20 | directory (let's say it is located at `project/flit-tests`). 21 | 22 | ```bash 23 | FLiT/gensrc/gensrc.py --outdir project/flit-tests/tests 1 24 | ``` 25 | 26 | [Prev](experimental-features.md) 27 | | 28 | [Table of Contents](README.md) 29 | | 30 | [Next](test-input-generator.md) 31 | 32 | -------------------------------------------------------------------------------- /documentation/benchmarks.md: -------------------------------------------------------------------------------- 1 | # Test Executable 2 | 3 | [Prev](test-executable.md) 4 | | 5 | [Table of Contents](README.md) 6 | | 7 | [Next](database-structure.md) 8 | 9 | These benchmarks give insights into the usefulness of FLiT. Each benchmark has 10 | its own goals, either to demonstrate how FLiT can be useful, or to give 11 | insights into specific tools and functionalities. 12 | 13 | The benchmarks are found in the top-level directory `benchmarks`. 14 | 15 | These benchmarks are also part of the installation, and can be copied from 16 | there to exercise FLiT's capabilities. They are installed in 17 | 18 | `$(DESTDIR)$(PREFIX)/share/flit/benchmarks` 19 | 20 | Here is a brief summary of each benchmark: 21 | 22 | * **Random Benchmark**: A benchmark to test the standard library functionality 23 | with random number generation. 24 | 25 | Please look at the code and comments within each benchmark directory for more 26 | information. 27 | 28 | [Prev](test-executable.md) 29 | | 30 | [Table of Contents](README.md) 31 | | 32 | [Next](database-structure.md) 33 | 34 | -------------------------------------------------------------------------------- /documentation/cuda-support.md: -------------------------------------------------------------------------------- 1 | # CUDA Support 2 | 3 | [Prev](mpi-support.md) 4 | | 5 | [Table of Contents](README.md) 6 | | 7 | [Next](run-wrapper-and-hpc-support.md) 8 | 9 | FLiT historically had limited CUDA support, so much so that it was eventually 10 | stripped out for not being of enough utility and being left in disrepair. It 11 | may be good to have full CUDA support with reproducibility tests written with 12 | CUDA kernels, but that is a long way off at this point. 13 | 14 | Instead, a much more attainable goal is to build infrastructure to wrap a 15 | compiler wuth the `nvcc` compiler to allow for tests and code bases that 16 | utilize CUDA kernels. This has not yet been implemented, but is on the backlog 17 | of tasks (see [issue #164](https://github.com/PRUNERS/FLiT/issues/164)). 18 | 19 | Unfortunately at this point, FLiT does not have CUDA support. 20 | 21 | 22 | [Prev](mpi-support.md) 23 | | 24 | [Table of Contents](README.md) 25 | | 26 | [Next](run-wrapper-and-hpc-support.md) 27 | -------------------------------------------------------------------------------- /documentation/database-structure.md: -------------------------------------------------------------------------------- 1 | # Database Structure 2 | 3 | [Prev](benchmarks.md) 4 | | 5 | [Table of Contents](README.md) 6 | | 7 | [Next](analyze-results.md) 8 | 9 | There are currently only two tables in the created SQLite3 database (although 10 | there may be more added later). The schema for this database can be found in 11 | `data/db/tables-sqlite.sql`, or in the install located at 12 | `/share/flit/data/db/tables-sqlite.sql`. 13 | Alternatively, you can see 14 | the schema of the SQLite3 database by querying for it: 15 | 16 | ```sqlite3 17 | $ sqlite3 results.sqlite 18 | SQLite version 3.13.0 2016-05-18 10:57:30 19 | Enter ".help" for usage hints. 20 | sqlite> .tables 21 | runs tests 22 | sqlite> .schema 23 | CREATE TABLE runs ( 24 | -- The run id used in tests table 25 | id integer primary key autoincrement not null, 26 | 27 | -- timestamp is supported in python if you do the following: 28 | -- conn = sqlite3.connect("flit.sqlite", 29 | -- detect_types=sqlite3.PARSE_DECLTYPES) 30 | -- The secret sauce is in the "detect_types" that allows python to intercept 31 | -- it and convert it to a sqlite3 basic type and back. 32 | rdate timestamp, 33 | 34 | -- The label for the run describing what it is about 35 | label text 36 | ); 37 | CREATE TABLE tests ( 38 | id integer primary key autoincrement not null, 39 | run integer, -- run index from runs table 40 | name varchar, -- name of the test case 41 | host varchar, -- name of computer that ran the test 42 | compiler varchar, -- compiler name 43 | optl varchar, -- optimization level (e.g. "-O2") 44 | switches varchar, -- compiler flag(s) (e.g. "-ffast-math") 45 | precision varchar, -- precision (f = float, d = double, e = extended) 46 | comparison_hex varchar, -- metric of comparison - hex value 47 | comparison real, -- metric of comparison of result vs ground truth 48 | file varchar, -- filename of test executable 49 | nanosec integer check(nanosec >= 0), -- timing for the function 50 | 51 | foreign key(run) references runs(id) 52 | ); 53 | sqlite> .quit 54 | .quit 55 | ``` 56 | 57 | This output is as of this writing. You can execute those same commands to see 58 | the exact schema used in your version of FLiT. 59 | 60 | The `runs` table only stores information about each executed full run, the id, 61 | datetime and user-specified label for the run (called `label`). 62 | 63 | The `tests` table contains the actual test results. Each row has a run number 64 | that matches the `id` field of the `runs` table, so you can do things like: 65 | 66 | ```sqlite3 67 | select * from tests where run = 3; 68 | ``` 69 | 70 | Information about each compilation is stored there as well as the comparison 71 | value. The comparison value is what is returned from the `compare()` method in 72 | your test class that compares a test result against the ground truth result. 73 | Only this value is stored in the database for storage space reasons. It also 74 | contains timing information in the `nanosec` column which can be used to find 75 | the fastest runtime execution. 76 | 77 | [Prev](test-executable.md) 78 | | 79 | [Table of Contents](README.md) 80 | | 81 | [Next](analyze-results.md) 82 | -------------------------------------------------------------------------------- /documentation/experimental-features.md: -------------------------------------------------------------------------------- 1 | # Experimental Features 2 | 3 | [Prev](analyze-results.md) 4 | | 5 | [Table of Contents](README.md) 6 | | 7 | [Next](autogenerated-tests.md) 8 | 9 | There are experimental features not yet ready for prime-time. They may end up 10 | in flit as a permanent thing or they may be deemed too much work or not useful 11 | enough to become a full feature. Those features may stay as experimental 12 | features, or they may disappear entirely. 13 | 14 | Currently supported experimental features: 15 | 16 | * [Ninja Generator](#ninja-generator) 17 | 18 | ## Ninja Generator 19 | 20 | [Ninja](https://ninja-build.org) is a build tool similar to GNU Make that 21 | focuses on simplicity, readability, speed, and parallelism. This experimental 22 | feature instead generates a `build.ninja` file to be compiled with `ninja` 23 | instead of the generated `Makefile`. 24 | 25 | You can invoke the Ninja generator using 26 | 27 | ```bash 28 | flit experimental ninja 29 | ``` 30 | 31 | Call it with the `--help` option to see more documentation about the usage and 32 | flags available. 33 | 34 | ### Benefits 35 | 36 | The generated `build.ninja` will be much larger than the generated `Makefile`. 37 | This is because each compilation is explicitly specified. For example, for a 38 | project with 120 source files and 305 specified compilations, the generated 39 | `Makefile` is only 20 Kilobytes. For that same project, the generated 40 | `build.ninja` file is 5.6 Megabytes at over 100,000 lines of generated code. 41 | 42 | That extra used disk space may not seem like much of a benefit, but honestly, 43 | disk space is cheap, and 5.6 megabytes is nothing in comparison to the size of 44 | the compiled object files you are going to generate. 45 | 46 | The true benefit is in the speed. If you want to do a clean of your build 47 | system, you may see a significant speedup with the Ninja system, despite the 48 | bigger file size. If you just want to view the help documentation using the 49 | `help` target, you will notice a significant improvement with the Ninja system. 50 | The actual build time for large projects is primarily dominated by the time it 51 | takes to compile, so for doing a full compilation, you may not notice much of a 52 | difference. 53 | 54 | I'm not sure the benefits of this approach are significant enough to warrant 55 | the effort to make it a regular feature in FLiT. But it was a worthwhile 56 | experiment. Use this feature if you find use for it. 57 | 58 | ### Inputs to the Ninja Generator 59 | 60 | This generator reads in configuration information from `flit-config.toml` and 61 | reads variables defined in `custom.mk`. It then goes on to generate 62 | `build.ninja` from that information. 63 | 64 | The `custom.mk` file does not need to exist. If it does, this tool will only 65 | read variables if they are present. The variables read from `custom.mk` are 66 | 67 | * `SOURCE`: list of source files 68 | * `CXXFLAGS`: C++ compile flags to use in all compilations 69 | * `LDFLAGS`: link flags to use in all compilations (e.g., "-L/usr/local/lib64") 70 | * `LDLIBS`: link libraries to use in all compilations (e.g., "-lm") 71 | * `RUN_WRAPPER`: command to wrap around the test executable when run 72 | 73 | This `custom.mk` file is in GNU Makefile format. Any additional variables and 74 | rules defined inside are completely ignored. Feel free to use anything from 75 | GNU Make including `if` statements and things like `$(wildcard ../src/*.cpp)`. 76 | 77 | 78 | 79 | [Prev](analyze-results.md) 80 | | 81 | [Table of Contents](README.md) 82 | | 83 | [Next](autogenerated-tests.md) 84 | -------------------------------------------------------------------------------- /documentation/litmus-tests.md: -------------------------------------------------------------------------------- 1 | # Litmus Tests 2 | 3 | [Prev](installation.md) 4 | | 5 | [Table of Contents](README.md) 6 | | 7 | [Next](flit-command-line.md) 8 | 9 | FLiT comes with a large number of _litmus tests_ each that demonstrate some 10 | simple aspect of compiler variability (or lack thereof) due to different 11 | compilations. 12 | 13 | These litmus tests can be found in `litmus-tests/tests` in the git repository, 14 | or in `/share/flit/litmus-tests` in the install. They can be 15 | copied to your test directory using the `flit init` command-line tool (see 16 | [flit init](flit-command-line.md#flit-init)). 17 | 18 | The community is encouraged to contribute back interesting test cases that can 19 | be added to these litmus tests. Simply create a **Pull Request** on GitHub. 20 | 21 | [Prev](installation.md) 22 | | 23 | [Table of Contents](README.md) 24 | | 25 | [Next](flit-command-line.md) 26 | -------------------------------------------------------------------------------- /documentation/mpi-support.md: -------------------------------------------------------------------------------- 1 | # MPI Support 2 | 3 | [Prev](flit-helpers.md) 4 | | 5 | [Table of Contents](README.md) 6 | | 7 | [Next](cuda-support.md) 8 | 9 | 10 | FLiT has built-in support for tests that utilize MPI. Before going into the 11 | details of this, a word of caution: 12 | 13 | _**Warning**: FLiT requires test results to be exactly deterministic in order to 14 | function properly and to give meaningful and trustworthy results. By using 15 | MPI, it is highly likely that nondeterminism can be introduced by concurrency. 16 | It is the responsibility of the test engineer to ensure the code under test is 17 | deterministic. It may work, but FLiT gives no guarantee for nondeterministic 18 | code._ 19 | 20 | 21 | ## Enabling MPI Support 22 | 23 | To enable MPI support, you simply need to add (or edit) two lines in your 24 | `flit-config.toml` file (see [FLiT Configuration 25 | File](flit-configuration-file.md)). For example: 26 | 27 | ```toml 28 | [run] 29 | enable_mpi = true 30 | ``` 31 | 32 | With the enabling of MPI, the generated Makefile will automatically pull 33 | compiler and linker flags from `mpic++`. The `mpic++` executable will be 34 | pulled from the system `PATH` variable, so simply make sure your `PATH` is 35 | pointing to the desired executable. 36 | 37 | The arguments to `mpirun` are specified in your test itself. To run MPI tests, 38 | you will need to use the `flit::call_mpi_main()` function after registering a 39 | main-like function with `FLIT_REGISTER_MAIN()`. By "main-like" function, we 40 | mean a function taking in an `int` and a `char**` and returning and `int`. 41 | Please see [Writing Test Cases: Writing MPI 42 | Tests](writing-test-cases.md#writing-mpi-tests) for more information. 43 | 44 | Alternatively, you can specify your `mpic++` executable file as your compiler 45 | in the `[[compiler]]` section of `flit-config.toml`. If you do this, you can 46 | safely set `enable_mpi = false`, since that feature is only used for 47 | compilation. 48 | 49 | 50 | ## Writing MPI Tests 51 | 52 | The only way to write MPI tests is to have your test call a main-like function 53 | that handles all of the MPI requirements. See [Writing Test 54 | Cases](writing-test-cases.md#writing_mpi_tests) for more information. 55 | 56 | This is the only supported way of doing MPI from FLiT. The MPI standard 57 | requires the user to call `MPI_Init()` as close to the beginning of the 58 | application as possible and to call `MPI_Finalize()` as close to the end of the 59 | application and after any MPI calls. Calling these methods from within the 60 | FLiT test directly combined with calling the flit test executable using 61 | `mpirun` will likely have undesired behavior. 62 | 63 | 64 | [Prev](flit-helpers.md) 65 | | 66 | [Table of Contents](README.md) 67 | | 68 | [Next](cuda-support.md) 69 | -------------------------------------------------------------------------------- /documentation/run-wrapper-and-hpc-support.md: -------------------------------------------------------------------------------- 1 | # Run Wrapper and HPC Support 2 | 3 | [Prev](cuda-support.md) 4 | | 5 | [Table of Contents](README.md) 6 | | 7 | [Next](compiling-your-tests.md) 8 | 9 | 10 | Within the `custom.mk` file, there is a variable called `RUN_WRAPPER`. This 11 | `RUN_WRAPPER` is a program that is to wrap around all test executable runs. 12 | For example, if you set 13 | 14 | ```make 15 | RUN_WRAPPER = @echo 16 | ``` 17 | 18 | then the tests will not be executed, but instead will only be printed to show 19 | what would be executed. Alternatively, you can create your own custom wrapper 20 | script such as `wrapper.sh`: 21 | 22 | ```bash 23 | #!/bin/bash 24 | 25 | echo "$@" >> test-execution.log 26 | time "$@" 27 | ``` 28 | 29 | It used to be this approach was used to integrate with Slurm. Instead, we 30 | prefer you perform an `sbatch` or `salloc` before-hand, and within that 31 | allocation, you run the FLiT tests. If you want parallelism in the FLiT tests 32 | themselves, then call `flit_mpi_main()`. If your program has different 33 | parallelism than MPI, this function can still be used with `srun` instead of 34 | `mpirun`. 35 | 36 | You can use this wrapper to do other things like monitor memory usage or use an 37 | automated checker for memory leaks. Overall it can be a useful feature to tie 38 | in your own custom functionality on top of the test executables. 39 | 40 | 41 | [Prev](cuda-support.md) 42 | | 43 | [Table of Contents](README.md) 44 | | 45 | [Next](compiling-your-tests.md) 46 | -------------------------------------------------------------------------------- /documentation/test-input-generator.md: -------------------------------------------------------------------------------- 1 | # Test Input Generator 2 | 3 | [Prev](autogenerated-tests.md) 4 | | 5 | [Table of Contents](README.md) 6 | 7 | The input generator is currently broken. Ideally, I would like to add input 8 | generation to the Makefile of user-written code bases. 9 | 10 | [Prev](autogenerated-tests.md) 11 | | 12 | [Table of Contents](README.md) 13 | -------------------------------------------------------------------------------- /gensrc/environment.py: -------------------------------------------------------------------------------- 1 | # -- LICENSE BEGIN -- 2 | # 3 | # Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | # 5 | # Produced at the Lawrence Livermore National Laboratory 6 | # 7 | # Written by 8 | # Michael Bentley (mikebentley15@gmail.com), 9 | # Geof Sawaya (fredricflinstone@gmail.com), 10 | # and Ian Briggs (ian.briggs@utah.edu) 11 | # under the direction of 12 | # Ganesh Gopalakrishnan 13 | # and Dong H. Ahn. 14 | # 15 | # LLNL-CODE-743137 16 | # 17 | # All rights reserved. 18 | # 19 | # This file is part of FLiT. For details, see 20 | # https://pruners.github.io/flit 21 | # Please also read 22 | # https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | # 24 | # Redistribution and use in source and binary forms, with or 25 | # without modification, are permitted provided that the following 26 | # conditions are met: 27 | # 28 | # - Redistributions of source code must retain the above copyright 29 | # notice, this list of conditions and the disclaimer below. 30 | # 31 | # - Redistributions in binary form must reproduce the above 32 | # copyright notice, this list of conditions and the disclaimer 33 | # (as noted below) in the documentation and/or other materials 34 | # provided with the distribution. 35 | # 36 | # - Neither the name of the LLNS/LLNL nor the names of its 37 | # contributors may be used to endorse or promote products derived 38 | # from this software without specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | # DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | # SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | # THE POSSIBILITY OF SUCH DAMAGE. 54 | # 55 | # Additional BSD Notice 56 | # 57 | # 1. This notice is required to be provided under our contract 58 | # with the U.S. Department of Energy (DOE). This work was 59 | # produced at Lawrence Livermore National Laboratory under 60 | # Contract No. DE-AC52-07NA27344 with the DOE. 61 | # 62 | # 2. Neither the United States Government nor Lawrence Livermore 63 | # National Security, LLC nor any of their employees, makes any 64 | # warranty, express or implied, or assumes any liability or 65 | # responsibility for the accuracy, completeness, or usefulness of 66 | # any information, apparatus, product, or process disclosed, or 67 | # represents that its use would not infringe privately-owned 68 | # rights. 69 | # 70 | # 3. Also, reference herein to any specific commercial products, 71 | # process, or services by trade name, trademark, manufacturer or 72 | # otherwise does not necessarily constitute or imply its 73 | # endorsement, recommendation, or favoring by the United States 74 | # Government or Lawrence Livermore National Security, LLC. The 75 | # views and opinions of authors expressed herein do not 76 | # necessarily state or reflect those of the United States 77 | # Government or Lawrence Livermore National Security, LLC, and 78 | # shall not be used for advertising or product endorsement 79 | # purposes. 80 | # 81 | # -- LICENSE END -- 82 | 83 | ''' 84 | The Environment class along with things needed to define an environment 85 | ''' 86 | 87 | from collections import namedtuple 88 | 89 | Variable = namedtuple('Variable', 'name, type') 90 | class Variable(object): 91 | 'Represents a variable with a certain type' 92 | 93 | def __init__(self, name, vartype): 94 | 'initialize this' 95 | self.name = name 96 | self.type = vartype 97 | def __str__(self): 98 | 'return this object as a string' 99 | return self.name 100 | def __repr__(self): 101 | 'return this object as a string, but retaining the type' 102 | return 'Variable({0}, {1})'.format(self.name.__repr__(), self.type.__repr__()) 103 | 104 | class Environment(dict): 105 | 'Represents an environment of variables' 106 | 107 | def __init__(self, parent=None): 108 | 'Initialize an environment. Copies from the parent if not None.' 109 | self.parent = parent 110 | if parent is not None: 111 | self.update(parent) 112 | 113 | empty_env = Environment() 114 | 115 | -------------------------------------------------------------------------------- /images/bisect-search.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/FLiT/27b6061b9d2302fa8c3252fe770287bb4d07905b/images/bisect-search.pdf -------------------------------------------------------------------------------- /images/flit-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/FLiT/27b6061b9d2302fa8c3252fe770287bb4d07905b/images/flit-small.png -------------------------------------------------------------------------------- /images/flit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/FLiT/27b6061b9d2302fa8c3252fe770287bb4d07905b/images/flit.png -------------------------------------------------------------------------------- /images/flit.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FLiT Logo 5 | 6 | 7 | 8 | image/svg+xml 9 | 10 | FLiT Logo 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /inputGen/.ycm_extra_conf.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2014 Google Inc. 2 | # 3 | # This file is part of ycmd. 4 | # 5 | # ycmd is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # ycmd is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with ycmd. If not, see . 17 | 18 | import os 19 | import ycm_core 20 | 21 | # These are the compilation flags that will be used in case there's no 22 | # compilation database set (by default, one is not set). 23 | # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. 24 | flags = [ 25 | '-std=c++14', 26 | '-lm', 27 | '-Wno-shift-count-overflow', 28 | '-Wall', 29 | '-Wextra', 30 | '-Werror', 31 | '-fexceptions', 32 | '-x', 'c++', 33 | '-isystem', '/usr/include', 34 | '-isystem', '/usr/local/include', 35 | '-I../src', 36 | ] 37 | 38 | 39 | # Set this to the absolute path to the folder (NOT the file!) containing the 40 | # compile_commands.json file to use that instead of 'flags'. See here for 41 | # more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html 42 | # 43 | # Most projects will NOT need to set this to anything; you can just change the 44 | # 'flags' list of compilation flags. 45 | compilation_database_folder = '' 46 | 47 | if os.path.exists( compilation_database_folder ): 48 | database = ycm_core.CompilationDatabase( compilation_database_folder ) 49 | else: 50 | database = None 51 | 52 | SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ] 53 | 54 | def DirectoryOfThisScript(): 55 | return os.path.dirname( os.path.abspath( __file__ ) ) 56 | 57 | 58 | def MakeRelativePathsInFlagsAbsolute( flags, working_directory ): 59 | if not working_directory: 60 | return list( flags ) 61 | new_flags = [] 62 | make_next_absolute = False 63 | path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ] 64 | for flag in flags: 65 | new_flag = flag 66 | 67 | if make_next_absolute: 68 | make_next_absolute = False 69 | if not flag.startswith( '/' ): 70 | new_flag = os.path.join( working_directory, flag ) 71 | 72 | for path_flag in path_flags: 73 | if flag == path_flag: 74 | make_next_absolute = True 75 | break 76 | 77 | if flag.startswith( path_flag ): 78 | path = flag[ len( path_flag ): ] 79 | new_flag = path_flag + os.path.join( working_directory, path ) 80 | break 81 | 82 | if new_flag: 83 | new_flags.append( new_flag ) 84 | return new_flags 85 | 86 | 87 | def IsHeaderFile( filename ): 88 | extension = os.path.splitext( filename )[ 1 ] 89 | return extension in [ '.h', '.hxx', '.hpp', '.hh' ] 90 | 91 | 92 | def GetCompilationInfoForFile( filename ): 93 | # The compilation_commands.json file generated by CMake does not have entries 94 | # for header files. So we do our best by asking the db for flags for a 95 | # corresponding source file, if any. If one exists, the flags for that file 96 | # should be good enough. 97 | if IsHeaderFile( filename ): 98 | basename = os.path.splitext( filename )[ 0 ] 99 | for extension in SOURCE_EXTENSIONS: 100 | replacement_file = basename + extension 101 | if os.path.exists( replacement_file ): 102 | compilation_info = database.GetCompilationInfoForFile( 103 | replacement_file ) 104 | if compilation_info.compiler_flags_: 105 | return compilation_info 106 | return None 107 | return database.GetCompilationInfoForFile( filename ) 108 | 109 | 110 | # This is the entry point; this function is called by ycmd to produce flags for 111 | # a file. 112 | def FlagsForFile( filename, **kwargs ): 113 | if database: 114 | # Bear in mind that compilation_info.compiler_flags_ does NOT return a 115 | # python list, but a "list-like" StringVec object 116 | compilation_info = GetCompilationInfoForFile( filename ) 117 | if not compilation_info: 118 | return None 119 | 120 | final_flags = MakeRelativePathsInFlagsAbsolute( 121 | compilation_info.compiler_flags_, 122 | compilation_info.compiler_working_dir_ ) 123 | else: 124 | relative_to = DirectoryOfThisScript() 125 | final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to ) 126 | 127 | return { 128 | 'flags': final_flags, 129 | 'do_cache': True 130 | } 131 | 132 | -------------------------------------------------------------------------------- /inputGen/InfoStream.cpp: -------------------------------------------------------------------------------- 1 | ../src/InfoStream.cpp -------------------------------------------------------------------------------- /inputGen/TestBase.cpp: -------------------------------------------------------------------------------- 1 | ../src/TestBase.cpp -------------------------------------------------------------------------------- /inputGen/flitHelpers.cpp: -------------------------------------------------------------------------------- 1 | ../src/flitHelpers.cpp -------------------------------------------------------------------------------- /inputGen/groundtruth.h: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #ifndef GROUNDTRUTH_H 85 | #define GROUNDTRUTH_H 86 | 87 | #include 88 | #include 89 | #include 90 | #include 91 | 92 | template 93 | using TruthType = std::pair, long double>; 94 | 95 | TruthType 96 | runGroundtruth(const std::string &testName, std::function randGen); 97 | 98 | TruthType 99 | runGroundtruth(const std::string &testName, std::function randGen); 100 | 101 | TruthType 102 | runGroundtruth(const std::string &testName, std::function randGen); 103 | 104 | #endif // GROUNDTRUTH_H 105 | -------------------------------------------------------------------------------- /inputGen/testbed.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #include "testbed.h" 85 | 86 | #include 87 | 88 | #include 89 | 90 | // Only store these locally because we want multiple compiled copies 91 | namespace { 92 | template long double 93 | runTestbed_impl(const std::string &testName, 94 | const std::vector &inputvals) 95 | { 96 | auto test = flit::getTests()[testName]->get(); 97 | auto scores = test->run(inputvals); 98 | 99 | // Return only the first score. Ignore the key 100 | return std::get<0>(scores.begin()->second); 101 | } 102 | } // end of unnamed namespace 103 | 104 | 105 | long double 106 | runTestbed_float(const std::string &testName, const std::vector &inputs) { 107 | return runTestbed_impl(testName, inputs); 108 | } 109 | 110 | long double 111 | runTestbed_double(const std::string &testName, const std::vector &inputs) { 112 | return runTestbed_impl(testName, inputs); 113 | } 114 | 115 | long double 116 | runTestbed_longdouble(const std::string &testName, const std::vector &inputs) { 117 | return runTestbed_impl(testName, inputs); 118 | } 119 | -------------------------------------------------------------------------------- /inputGen/testbed.h: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #ifndef TESTBED_H 85 | #define TESTBED_H 86 | 87 | #include 88 | #include 89 | #include 90 | #include 91 | 92 | extern "C" 93 | long double 94 | runTestbed_float(const std::string &testName, const std::vector &inputs); 95 | 96 | extern "C" 97 | long double 98 | runTestbed_double(const std::string &testName, const std::vector &inputs); 99 | 100 | extern "C" 101 | long double 102 | runTestbed_longdouble(const std::string &testName, const std::vector &inputs); 103 | 104 | #endif // TESTBED_H 105 | -------------------------------------------------------------------------------- /litmus-tests/tests/DoSimpleRotate90.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- */ 82 | 83 | #include "Vector.h" 84 | 85 | #include 86 | 87 | #include 88 | 89 | #include 90 | 91 | template 92 | class DoSimpleRotate90: public flit::TestBase { 93 | public: 94 | DoSimpleRotate90(std::string id):flit::TestBase(std::move(id)) {} 95 | 96 | virtual size_t getInputsPerRun() override { return 3; } 97 | virtual std::vector getDefaultInput() override { 98 | return { 1, 1, 1 }; 99 | } 100 | 101 | protected: 102 | virtual flit::Variant run_impl(const std::vector& ti) override { 103 | Vector A(ti); 104 | Vector expected = {-A[1], A[0], A[2]}; 105 | flit::info_stream << "Rotating A: " << A << ", 1/2 PI radians" << std::endl; 106 | A = A.rotateAboutZ_3d(M_PI/2); 107 | flit::info_stream << "Resulting vector: " << A << std::endl; 108 | flit::info_stream << "in " << id << std::endl; 109 | A.dumpDistanceMetrics(expected, flit::info_stream); 110 | return A.L1Distance(expected); 111 | } 112 | 113 | protected: 114 | using flit::TestBase::id; 115 | }; 116 | 117 | REGISTER_TYPE(DoSimpleRotate90) 118 | -------------------------------------------------------------------------------- /litmus-tests/tests/FMACancel.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- */ 82 | #include 83 | 84 | #include 85 | 86 | #include 87 | 88 | template 89 | class FMACancel : public flit::TestBase { 90 | public: 91 | FMACancel(std::string id) : flit::TestBase(std::move(id)) {} 92 | 93 | virtual size_t getInputsPerRun() override { return 2; } 94 | 95 | virtual std::vector getDefaultInput() override { 96 | return { .1, 1.1e5 }; 97 | } 98 | 99 | protected: 100 | virtual flit::Variant run_impl(const std::vector& ti) override { 101 | const T a = ti[0]; 102 | const T b = ti[1]; 103 | const T c = a; 104 | const T d = -b; 105 | 106 | const T score = a*b + c*d; 107 | flit::info_stream << id << ": score = " << score << std::endl; 108 | return score; 109 | } 110 | 111 | protected: 112 | using flit::TestBase::id; 113 | }; 114 | 115 | 116 | REGISTER_TYPE(FMACancel) 117 | -------------------------------------------------------------------------------- /litmus-tests/tests/InliningProblem.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- */ 82 | #include 83 | 84 | #include 85 | 86 | #include 87 | 88 | template 89 | class InliningProblem : public flit::TestBase { 90 | public: 91 | InliningProblem(std::string id) : flit::TestBase(std::move(id)) {} 92 | 93 | virtual size_t getInputsPerRun() override { return 1; } 94 | 95 | virtual std::vector getDefaultInput() override { 96 | return { .1, 1.1e3, 0.5, 3.14159256, 1/3 }; 97 | } 98 | 99 | protected: 100 | T identity(const T x) { 101 | const T nx = -x; 102 | const T x_again = -nx; 103 | return x_again; 104 | } 105 | virtual flit::Variant run_impl(const std::vector& ti) override { 106 | T a = ti[0]; 107 | T also_a = identity(a); 108 | 109 | const T score = std::sqrt(a) * std::sqrt(also_a); 110 | 111 | flit::info_stream << id << ": score = " << score << std::endl; 112 | 113 | return score; 114 | } 115 | 116 | protected: 117 | using flit::TestBase::id; 118 | }; 119 | 120 | 121 | REGISTER_TYPE(InliningProblem) 122 | -------------------------------------------------------------------------------- /litmus-tests/tests/Kahan.h: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- */ 82 | #ifndef KAHAN_H 83 | #define KAHAN_H 84 | 85 | template 86 | class Kahan { 87 | public: 88 | Kahan() : m_sum(0), m_c(0) {} 89 | 90 | void add(const T next) { 91 | const T y = next - m_c; 92 | const T t = m_sum + y; 93 | m_c = (t - m_sum) - y; 94 | m_sum = t; 95 | } 96 | 97 | T sum() { return m_sum; } 98 | 99 | private: 100 | T m_sum; 101 | T m_c; 102 | }; 103 | 104 | #endif // KAHAN_H 105 | -------------------------------------------------------------------------------- /litmus-tests/tests/RandHelper.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- */ 82 | 83 | #include "RandHelper.h" 84 | 85 | const std::vector float_rands = createRandSeq(RAND_VECT_SIZE); 86 | const std::vector double_rands = createRandSeq(RAND_VECT_SIZE); 87 | const std::vector long_rands = createRandSeq(RAND_VECT_SIZE); 88 | 89 | template<> 90 | const std::vector& 91 | getRandSeq() { return float_rands; } 92 | 93 | template<> 94 | const std::vector& 95 | getRandSeq() { return double_rands; } 96 | 97 | template<> 98 | const std::vector& 99 | getRandSeq() { return long_rands; } 100 | -------------------------------------------------------------------------------- /litmus-tests/tests/RandHelper.h: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- */ 82 | 83 | #ifndef RAND_HELPER_H 84 | #define RAND_HELPER_H 85 | 86 | #include 87 | #include 88 | 89 | static const int RAND_SEED = 1; 90 | static const int RAND_VECT_SIZE = 256; 91 | 92 | extern const std::vector float_rands; 93 | extern const std::vector double_rands; 94 | extern const std::vector long_rands; 95 | 96 | template 97 | const std::vector 98 | createRandSeq(size_t size, int32_t seed = RAND_SEED){ 99 | // there may be a bug with float uniform_real_dist 100 | // it is giving very different results than double or long double 101 | std::vector ret(size); 102 | std::mt19937 gen; 103 | gen.seed(seed); 104 | std::uniform_real_distribution dist(-6.0, 6.0); 105 | for(auto& i: ret) i = T(dist(gen)); 106 | return ret; 107 | } 108 | 109 | // this section provides a pregenerated random 110 | // sequence that can be used by tests 111 | 112 | template 113 | std::vector const & 114 | getRandSeq(); 115 | 116 | #endif // RAND_HELPER_H 117 | -------------------------------------------------------------------------------- /litmus-tests/tests/SinInt.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- */ 82 | #include "Shewchuk.h" 83 | 84 | #include 85 | 86 | #include 87 | 88 | #include 89 | 90 | template 91 | class SinInt : public flit::TestBase { 92 | public: 93 | SinInt(std::string id) : flit::TestBase(std::move(id)) {} 94 | 95 | virtual size_t getInputsPerRun() override { return 1; } 96 | 97 | virtual std::vector getDefaultInput() override { 98 | const T pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998L; 99 | return { pi }; 100 | } 101 | 102 | protected: 103 | virtual flit::Variant run_impl(const std::vector& ti) override { 104 | const int zero = (rand() % 10) / 99; 105 | const T val = ti[0]; 106 | const T score = std::sin(val + zero) / std::sin(val); 107 | flit::info_stream << id << ": score = " << score << std::endl; 108 | flit::info_stream << id << ": score - 1.0 = " << score - 1.0 << std::endl; 109 | return score; 110 | } 111 | 112 | protected: 113 | using flit::TestBase::id; 114 | }; 115 | 116 | 117 | REGISTER_TYPE(SinInt) 118 | -------------------------------------------------------------------------------- /plans/clang-versions.md: -------------------------------------------------------------------------------- 1 | # Compiler Versions 2 | 3 | When I ran the experiment during the summer (April 2017), I used Clang version 4.0.0, which was release on 13 March 2017. For the run being done on 21 March 2018, I am using Clang version 5.0.1 which was released on 21 December 2017. I would like to use Clang version 6.0.0 that was released on 08 March 2018. I get the release dates from the [LLVM Releases page](http://releases.llvm.org). 4 | 5 | 6 | | Run Date | Clang | GCC | Intel | 7 | |---------------|--------|--------|---------| 8 | | 13 March 2017 | v4.0.0 | v4.9.2 | v16.0.1 | 9 | | 21 March 2018 | v5.0.1 | v7.3.1 | v18.0.1 | 10 | 11 | 12 | | Version | Release Date | 13 | |--------------|------------------| 14 | | Clang 4.0.0 | 13 March 2017 | 15 | | Clang 5.0.1 | 21 December 2017 | 16 | | Clang 6.0.0 | 08 March 2018 | 17 | | GCC 4.9.2 | 30 October 2014 | 18 | | GCC 7.3.1 | 25 January 2018 | 19 | | Intel 16.0.1 | 21 October 2015 | 20 | | Intel 18.0.1 | 18 October 2017 | 21 | 22 | As of this writing (21 March 2018), the latest version of each compiler is GCC 23 | 7.3.1, Intel 18.0.1, and Clang 6.0.0. 24 | -------------------------------------------------------------------------------- /plans/intel-linker.md: -------------------------------------------------------------------------------- 1 | # Intel Linker 2 | 3 | When linking executables using the Intel compiler, by default, the following 4 | static libraries are used instead of system dynamic libraries: 5 | 6 | - `libdecimal.a` 7 | - `libimf.a` 8 | - `libipgo.a` 9 | - `libirc_s.a` 10 | - `libirc.a` 11 | - `libirng.a` 12 | - `libsvml.a` 13 | 14 | If any of these libraries override functionality in shared libraries that are 15 | installed on the system, there is a possibility that it can cause 16 | reproducibility problems. This static linking is performed by default, even if 17 | `-O0` is used. 18 | 19 | For example, `libimf.a` redefines many of the math functions found in 20 | `libm.so`. 21 | 22 | These libraries are not the same as the Intel MKL. Yet inside of `libimf.a`, 23 | we have definitions of functions such as `sin()`, `cos()`, and `exp()`. When 24 | these libraries cause reproducibility issues, it is not clear which symbols are 25 | to blame, and I do not think there is a safe way to isolate these symbols. 26 | 27 | 28 | ## Bisect Identify Problem Library 29 | 30 | I cannot guarantee that I can identify which symbol within the library is 31 | causing problems, but at the very least, I can identify which of the static 32 | libraries are to blame by doing the bisect approach. It may be good as a first 33 | approach to simply identify **if** extra static libraries are used and identify 34 | **if** the static libraries cause variability. Then, if that is true, then we 35 | can try to identify **which** static library is to blame. 36 | 37 | It turns out that I cannot isolate which of the static libraries are to blame 38 | because they depend on each other. Furthermore, if an object file is compiled 39 | with the intel compiler, it has a very large likelihood of requiring at least 40 | `libirc.a`, if not most of the other libraries. I have not yet found a way to 41 | separate out compilation with the linking of these static libraries. We cannot 42 | compile with intel and then _not_ link with these static libraries, it will 43 | fail to compile. 44 | -------------------------------------------------------------------------------- /scripts/flitcli/README.md: -------------------------------------------------------------------------------- 1 | # FLiT Architecture 2 | 3 | The flit command-line tool is split up modularly into separate subcommands. 4 | Inside of the script folder where flit.py resides, there are a few other 5 | things: 6 | 7 | - `README.md`: This documentation 8 | - `flitconfig.py`: Contains paths to FLiT files needed by the command-line tool 9 | - `flit_*.py`: Each subcommand is isolated into its own executable 10 | python script. This allows for modularity and easy extensibility. 11 | - `flitelf.py`: helper script for reading ELF binary files 12 | - `flitutil.py`: helper functions used in many subcommands 13 | - `experimental/flit_*.py`: experimental subcommands 14 | 15 | ## FLiT Subcommands 16 | 17 | To add an additional subcommand, there are only a few things you need to do. 18 | For this documentation, let us use the example subcommand of squelch. 19 | 20 | 1. Create a file in this same directory called `flit_squelch.py`. The 21 | subcommand should not be too long in length, otherwise it makes it hard to 22 | use and the help documentation becomes a bit hard to read. Other than that, 23 | there is no technical reason long subcommand names cannot be used. Try to 24 | stay within 8 characters. 25 | 2. Define a string on the global scope named `brief_description`. This 26 | variable is used to generate a brief description of the submodule. Try to 27 | keep this to one or two sentences. More detailed explanations can be given 28 | by the help documentation of the subcommand. 29 | 3. Implement a main method with the following declaration: 30 | `def main(arguments, prog=None)`. The `prog` argument is intended to be in 31 | the help documentation for that subcommand as the executable that was 32 | called. It can be passed directly into the `prog` argument for the 33 | `argparse.ArgumentParser` class. The `arguments` arg only contain the 34 | arguments and not the program name (similar to `sys.argv[1:]`). 35 | 4. Implement a method called `populate_parser(parser=None)` where it populates 36 | a given `argparse.ArgumentParser` instance (if `None` is given, you create 37 | one in the function) and returns the parser. 38 | 39 | ## Example Subcommand 40 | 41 | `flit_squelch.py`: 42 | 43 | ```python 44 | 'Implements the squelch subcommand' 45 | 46 | import argparse 47 | import sys 48 | 49 | brief_description = 'Quiets any communication with the server' 50 | 51 | def populate_parser(parser=None): 52 | if not parser: 53 | parser = ArgumentParser() 54 | parser.description = ''' 55 | The squelch command rejects any commands to communicate from 56 | the server. This is not an actual command or feature of flit, 57 | this subcommand is only for illustrative purposes on how to 58 | generate a subcommand. 59 | ''' 60 | parser.add_argument('-s', '--server', default='127.0.0.1', 61 | help='The server IP address') 62 | parser.add_argument('-v', '--verbose', action='store_true', 63 | help='Show verbose messages') 64 | return parser 65 | 66 | def main(arguments, prog=None): 67 | parser = populate_parser() 68 | if prog: parser.prog = prog 69 | args = parser.parse_args(arguments) 70 | 71 | # Subcommand logic here 72 | # ... 73 | 74 | if __name__ == '__main__': 75 | sys.exit(main(sys.argv[1:])) 76 | ``` 77 | -------------------------------------------------------------------------------- /scripts/flitcli/config/version.txt: -------------------------------------------------------------------------------- 1 | v2.1.0 2 | -------------------------------------------------------------------------------- /scripts/watch-progress.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # -- LICENSE BEGIN -- 3 | # 4 | # Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 5 | # 6 | # Produced at the Lawrence Livermore National Laboratory 7 | # 8 | # Written by 9 | # Michael Bentley (mikebentley15@gmail.com), 10 | # Geof Sawaya (fredricflinstone@gmail.com), 11 | # and Ian Briggs (ian.briggs@utah.edu) 12 | # under the direction of 13 | # Ganesh Gopalakrishnan 14 | # and Dong H. Ahn. 15 | # 16 | # LLNL-CODE-743137 17 | # 18 | # All rights reserved. 19 | # 20 | # This file is part of FLiT. For details, see 21 | # https://pruners.github.io/flit 22 | # Please also read 23 | # https://github.com/PRUNERS/FLiT/blob/master/LICENSE 24 | # 25 | # Redistribution and use in source and binary forms, with or 26 | # without modification, are permitted provided that the following 27 | # conditions are met: 28 | # 29 | # - Redistributions of source code must retain the above copyright 30 | # notice, this list of conditions and the disclaimer below. 31 | # 32 | # - Redistributions in binary form must reproduce the above 33 | # copyright notice, this list of conditions and the disclaimer 34 | # (as noted below) in the documentation and/or other materials 35 | # provided with the distribution. 36 | # 37 | # - Neither the name of the LLNS/LLNL nor the names of its 38 | # contributors may be used to endorse or promote products derived 39 | # from this software without specific prior written permission. 40 | # 41 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 42 | # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 43 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 44 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 45 | # DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 46 | # SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 47 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 48 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 49 | # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 50 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 51 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 52 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 53 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 54 | # THE POSSIBILITY OF SUCH DAMAGE. 55 | # 56 | # Additional BSD Notice 57 | # 58 | # 1. This notice is required to be provided under our contract 59 | # with the U.S. Department of Energy (DOE). This work was 60 | # produced at Lawrence Livermore National Laboratory under 61 | # Contract No. DE-AC52-07NA27344 with the DOE. 62 | # 63 | # 2. Neither the United States Government nor Lawrence Livermore 64 | # National Security, LLC nor any of their employees, makes any 65 | # warranty, express or implied, or assumes any liability or 66 | # responsibility for the accuracy, completeness, or usefulness of 67 | # any information, apparatus, product, or process disclosed, or 68 | # represents that its use would not infringe privately-owned 69 | # rights. 70 | # 71 | # 3. Also, reference herein to any specific commercial products, 72 | # process, or services by trade name, trademark, manufacturer or 73 | # otherwise does not necessarily constitute or imply its 74 | # endorsement, recommendation, or favoring by the United States 75 | # Government or Lawrence Livermore National Security, LLC. The 76 | # views and opinions of authors expressed herein do not 77 | # necessarily state or reflect those of the United States 78 | # Government or Lawrence Livermore National Security, LLC, and 79 | # shall not be used for advertising or product endorsement 80 | # purposes. 81 | # 82 | # -- LICENSE END -- 83 | 84 | 85 | cd results 86 | watch -n 2 \ 87 | 'echo ...; \ 88 | ls -tr | \ 89 | tail -n 10; \ 90 | echo; \ 91 | echo -n "$(find . -name \*-out -type f -not -executable | wc -l)"; \ 92 | echo -n " of "; \ 93 | echo -n "$(find . -executable -type f | wc -l)"; \ 94 | echo -n ", "; \ 95 | echo -n "$(find . -name \*-out -type f -empty -not -executable | \ 96 | tail -n +2 | \ 97 | wc -l)"; \ 98 | echo -n " were skipped - "; \ 99 | echo -n "$(for file in $(find . -type f -name \*-comparison.csv); do \ 100 | cat $file | \ 101 | awk -F, \{print\ \$11\} | \ 102 | tail -n +2; \ 103 | done | 104 | grep -v "^0$" | wc -l)"; \ 105 | echo -n " bad answers found"; \ 106 | echo' 107 | 108 | 109 | -------------------------------------------------------------------------------- /src/flit.h: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | // This wrapper file simply includes all of the header files for ease of use 85 | // and backward-compatability 86 | 87 | #ifndef TOP_FLIT_H 88 | #define TOP_FLIT_H 89 | 90 | #include 91 | #include 92 | #include 93 | #include 94 | #include 95 | #include 96 | #include 97 | #include 98 | #include 99 | #include 100 | 101 | #endif // TOP_FLIT_H 102 | -------------------------------------------------------------------------------- /src/flit/ALL-FLIT.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | // This file includes all of the source files within FLiT to be compiled in one go 85 | 86 | #include "flit.cpp" 87 | #include "FlitCsv.cpp" 88 | #include "flitHelpers.cpp" 89 | #include "fsutil.cpp" 90 | #include "InfoStream.cpp" 91 | #include "subprocess.cpp" 92 | #include "TestBase.cpp" 93 | #include "timeFunction.cpp" 94 | #include "Variant.cpp" 95 | -------------------------------------------------------------------------------- /src/flit/InfoStream.h: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #ifndef INFO_STREAM_H 85 | #define INFO_STREAM_H 86 | 87 | #include 88 | #include 89 | 90 | namespace flit { 91 | 92 | class InfoStream : public std::ostream { 93 | public: 94 | InfoStream(); 95 | ~InfoStream(); 96 | 97 | void show(); 98 | void hide(); 99 | void flushout(); 100 | 101 | private: 102 | std::ostringstream _threadbuf; 103 | }; 104 | 105 | } //end of namespace flit 106 | 107 | #endif // INFO_STREAM_H 108 | -------------------------------------------------------------------------------- /src/flit/TestBase.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | //this is the base instantiation for tests 85 | 86 | #include 87 | 88 | #include 89 | 90 | namespace flit { 91 | 92 | std::ostream& operator<<(std::ostream& os, const TestResult& res) { 93 | std::string comparison = 94 | (res.is_comparison_null() ? std::to_string(res.comparison()) : "NULL"); 95 | 96 | os << res.name() << ":" << res.precision() << "," 97 | << res.result() << "," 98 | << comparison << "," 99 | << res.nanosecs(); 100 | 101 | return os; 102 | } 103 | 104 | std::map& getTests() { 105 | static std::map tests; 106 | return tests; 107 | } 108 | 109 | } // end of namespace flit 110 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | harness/tst_test_harness 2 | harness/tst_fsutil 3 | flit_src/tst_FlitCsv 4 | flit_src/tst_TestBase 5 | flit_src/tst_Variant 6 | flit_src/tst_flitHelpers_h 7 | flit_src/tst_flit_cpp 8 | flit_src/tst_fsutil 9 | flit_src/tst_subprocess 10 | flit_src/*.gcda 11 | flit_src/*.gcno 12 | -------------------------------------------------------------------------------- /tests/Makefile: -------------------------------------------------------------------------------- 1 | CC := g++ 2 | CFLAGS := -O2 3 | CFLAGS += -std=c++11 4 | LDFLAGS := 5 | HARNESS := test_harness.h 6 | HARNESS_PY := test_harness.py 7 | SUB_MAKES := $(wildcard */Makefile */makefile) 8 | SUB_DIRS := $(patsubst %/,%,$(dir $(SUB_MAKES))) 9 | CHECK_TARGETS := $(addprefix check__,$(SUB_DIRS)) 10 | CLEAN_TARGETS := $(addprefix clean__,$(SUB_DIRS)) 11 | BUILD_TARGETS := $(addprefix build__,$(SUB_DIRS)) 12 | 13 | .PHONY: build check help clean 14 | build: $(BUILD_TARGETS) 15 | 16 | include color_out.mk 17 | 18 | ifndef VERBOSE 19 | .SILENT: 20 | endif 21 | 22 | check: run_tester_py $(CHECK_TARGETS) 23 | @$(call color_out,GREEN,All tests pass) 24 | 25 | help: 26 | @echo "Makefile for running tests on FLiT framework" 27 | @echo " help print this help documentation and exit" 28 | @echo " build just compile all subdirectories" 29 | @echo " check run tests and print results to the console" 30 | @echo " clean remove all generated files" 31 | 32 | clean: $(CLEAN_TARGETS) 33 | 34 | .PHONY: run_tester_py 35 | run_tester_py: $(HARNESS_PY) 36 | @$(call color_out_noline,BROWN, testing) 37 | @echo " $(HARNESS_PY)" 38 | python3 -m doctest $(HARNESS_PY) 39 | 40 | build__%: 41 | @$(MAKE) --no-print-directory build --directory $* 42 | 43 | check__%: 44 | @$(MAKE) --no-print-directory check --directory $* 45 | 46 | clean__%: 47 | @$(MAKE) --no-print-directory clean --directory $* 48 | 49 | -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | # Tests for FLiT 2 | 3 | Yes, I know this is a testing framework. But, how can you trust your testing 4 | framework unless it is itself tested? This directory contains regression tests 5 | for the FLiT framework. We may not have full coverage, but it gives us some 6 | confidence that regressions do not occur. 7 | 8 | As part of this suite of regression tests, there is a test harness in 9 | `test_harness.h`. This is intended to be a very simple C++ testing framework 10 | so that we can test the C++ functionality of FLiT. To make sure this new 11 | harness works correctly, there is also a tester for the harness called 12 | `harness_tester.cpp`. This is part of the set of tests that are executed. 13 | 14 | I know, we have a minimal framework for testing our test framework, and then 15 | simple tests to test the minimal framework that will be used to test our test 16 | framework. Believe me, it's worth it to be confident that your code works as 17 | expected. 18 | 19 | To run all of the tests, simply type `make check` from either this directory or 20 | from the top-level directory. 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/color_out.mk: -------------------------------------------------------------------------------- 1 | ECHO := printf "%s" 2 | ECHO_NEWLINE := printf "%s\n" 3 | 4 | # Call TPUT in the shell for one argument ($1) 5 | TPUT = $(shell tput $1 2>/dev/null) 6 | NCOLORS := $(call TPUT,colors) 7 | 8 | # A Makefile function 9 | # @param 1: color (e.g., BLUE or GREEN) 10 | # @param 2: message to be printed in the color 11 | bold_color_noline = $(call print_impl,$(ECHO),$(BASH_BOLD)$(BASH_$1),$2) 12 | bold_color = $(call print_impl,$(ECHO_NEWLINE),$(BASH_BOLD)$(BASH_$1),$2) 13 | color_out_noline = $(call print_impl,$(ECHO),$(BASH_$1),$2) 14 | color_out = $(call print_impl,$(ECHO_NEWLINE),$(BASH_$1),$2) 15 | 16 | # implementation 17 | # @param 1: print command 18 | # @param 2: terminal settings (e.g., $(BASH_BLUE) or $(BASH_GREEN)) 19 | # @param 3: message to be printed in the color 20 | print_impl = \ 21 | if [ -t 1 ] && [ $(NCOLORS) -ge 8 ]; then \ 22 | $1 "$2$3$(BASH_CLEAR)"; \ 23 | else \ 24 | $1 "$3"; \ 25 | fi 26 | 27 | BASH_CLEAR := $(call TPUT,sgr0) 28 | BASH_BOLD := $(call TPUT,bold) 29 | BASH_BLACK := $(call TPUT,setaf 0) 30 | BASH_RED := $(call TPUT,setaf 1) 31 | BASH_GREEN := $(call TPUT,setaf 2) 32 | BASH_YELLOW := $(call TPUT,setaf 3) 33 | BASH_BLUE := $(call TPUT,setaf 4) 34 | BASH_PURPLE := $(call TPUT,setaf 5) 35 | BASH_CYAN := $(call TPUT,setaf 6) 36 | BASH_WHITE := $(call TPUT,setaf 7) 37 | BASH_BROWN := $(call TPUT,setaf 94) 38 | BASH_GRAY := $(call TPUT,setaf 245) 39 | BASH_GREY := $(BASH_GRAY) 40 | BASH_DARKGRAY := $(call TPUT,setaf 240) 41 | BASH_DARKGREY := $(BASH_DARKGRAY) 42 | BASH_LIGHTGRAY:= $(call TPUT,setaf 250) 43 | BASH_LIGHTGREY:= $(BASH_LIGHTGRAY) 44 | 45 | -------------------------------------------------------------------------------- /tests/flit_cli/Makefile: -------------------------------------------------------------------------------- 1 | SUB_MAKES := $(wildcard */Makefile */makefile) 2 | SUB_DIRS := $(patsubst %/,%,$(dir $(SUB_MAKES))) 3 | CHECK_TARGETS := $(addprefix check__,$(SUB_DIRS)) 4 | CLEAN_TARGETS := $(addprefix clean__,$(SUB_DIRS)) 5 | BUILD_TARGETS := $(addprefix build__,$(SUB_DIRS)) 6 | 7 | ifndef VERBOSE 8 | .SILENT: 9 | endif 10 | 11 | .PHONY: build check help clean 12 | build: $(BUILD_TARGETS) 13 | 14 | check: $(CHECK_TARGETS) 15 | 16 | help: 17 | @echo "Makefile for running tests on FLiT framework" 18 | @echo " help print this help documentation and exit" 19 | @echo " build just compile all subdirectories" 20 | @echo " check run tests and print results to the console" 21 | @echo " clean remove all generated files" 22 | 23 | .PHONY: build__% check__% clean__% 24 | 25 | build__%: 26 | @$(MAKE) --no-print-directory build --directory $* 27 | 28 | check__%: 29 | @$(MAKE) --no-print-directory check --directory $* 30 | 31 | clean__%: 32 | @$(MAKE) --no-print-directory clean --directory $* 33 | 34 | -------------------------------------------------------------------------------- /tests/flit_cli/bash_completion/Makefile: -------------------------------------------------------------------------------- 1 | RUNNER := python3 2 | SRC := $(wildcard tst_*.py) 3 | RUN_TARGETS := $(SRC:%.py=run_%) 4 | 5 | include ../../color_out.mk 6 | 7 | ifndef VERBOSE 8 | .SILENT: 9 | endif 10 | 11 | .PHONY: check help clean build run_% 12 | check: $(TARGETS) $(RUN_TARGETS) 13 | 14 | help: 15 | @echo "Makefile for running tests on FLiT framework" 16 | @echo " help print this help documentation and exit" 17 | @echo " build just compile the targets" 18 | @echo " check run tests and print results to the console" 19 | @echo " clean remove all generated files" 20 | 21 | build: 22 | clean: 23 | 24 | run_% : %.py 25 | @$(call color_out_noline,BROWN, running) 26 | @echo " $<" 27 | $(RUNNER) $< 28 | -------------------------------------------------------------------------------- /tests/flit_cli/bash_completion/tst_completion_flit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import sys 5 | import unittest 6 | 7 | import util.arginspect as arginspect 8 | from util.completion import get_completion 9 | 10 | SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) 11 | prev_path = sys.path 12 | sys.path.append(os.path.join(SCRIPT_DIR, '..', '..')) 13 | import test_harness as th 14 | sys.path = prev_path 15 | 16 | class TestArgparse_Flit(arginspect.ArgParseTestBase): 17 | FLIT_PROG = 'flit' 18 | FLIT_BASH_COMPLETION = os.path.join( 19 | th._flit_dir, 'scripts', 'bash-completion', 'flit') 20 | 21 | def bashcomplete(self, args): 22 | return get_completion(self.FLIT_BASH_COMPLETION, self.FLIT_PROG, args) 23 | 24 | def get_parser(self): 25 | subcommands = th.flit.load_subcommands(th.config.script_dir) 26 | subcommands.append(th.flit.create_help_subcommand(subcommands)) 27 | return th.flit.populate_parser(subcommands=subcommands, recursive=True) 28 | 29 | def test_empty_available_options(self): 30 | self.assertEmptyAvailableOptions(self.get_parser()) 31 | 32 | def test_empty_available_options_for_subparsers(self): 33 | self.assertEachSubparserEmptyAvailableOptions(self.get_parser()) 34 | 35 | def test_no_positional_args(self): 36 | inspector = arginspect.ParserInspector(self.get_parser()) 37 | # test that there are no positional arguments 38 | self.assertEqual(inspector.position_actions, []) 39 | 40 | if __name__ == '__main__': 41 | sys.exit(th.unittest_main()) 42 | -------------------------------------------------------------------------------- /tests/flit_cli/bash_completion/util/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/FLiT/27b6061b9d2302fa8c3252fe770287bb4d07905b/tests/flit_cli/bash_completion/util/__init__.py -------------------------------------------------------------------------------- /tests/flit_cli/bash_completion/util/completion.py: -------------------------------------------------------------------------------- 1 | import subprocess as subp 2 | 3 | class Completion(): 4 | def prepare(self, program, command): 5 | self.program = program 6 | self.COMP_LINE = program + ' ' + command 7 | self.COMP_WORDS = self.COMP_LINE.rstrip() 8 | 9 | args=command.split() 10 | self.COMP_CWORD=len(args) 11 | self.COMP_POINT=len(self.COMP_LINE) 12 | 13 | if (self.COMP_LINE[-1] == ' '): 14 | self.COMP_WORDS += " " 15 | self.COMP_CWORD += 1 16 | 17 | def run(self, completion_file, program, command): 18 | self.prepare(program, command) 19 | full_cmdline = \ 20 | r'source {compfile};' \ 21 | 'COMP_LINE="{COMP_LINE}"' \ 22 | ' COMP_WORDS=({COMP_WORDS})' \ 23 | ' COMP_CWORD={COMP_CWORD}' \ 24 | ' COMP_POINT={COMP_POINT};' \ 25 | '$(complete -p {program} |' \ 26 | ' sed "s/.*-F \\([^ ]*\\) .*/\\1/") &&' \ 27 | ' for elem in "${{COMPREPLY[@]}}"; do' \ 28 | ' echo "${{elem}}";' \ 29 | ' done'.format( 30 | compfile=completion_file, 31 | COMP_LINE=self.COMP_LINE, 32 | COMP_WORDS=self.COMP_WORDS, 33 | COMP_POINT=self.COMP_POINT, 34 | program=self.program, 35 | COMP_CWORD=self.COMP_CWORD, 36 | ) 37 | #print(full_cmdline) 38 | proc = subp.Popen(['bash', '-i', '-c', full_cmdline], stdout=subp.PIPE) 39 | out, _ = proc.communicate() 40 | return out.decode('utf-8').splitlines() 41 | 42 | def _completion_vars(program, command): 43 | ''' 44 | Returns a dictionary of bash varibles to trigger bash-completion. 45 | 46 | >>> vals = _completion_vars('foo', 'bar --he') 47 | >>> sorted(vals.keys()) 48 | ['COMP_CWORD', 'COMP_LINE', 'COMP_POINT', 'COMP_WORDS'] 49 | >>> [vals[x] for x in sorted(vals.keys())] 50 | [2, 'foo bar --he', 12, 'foo bar --he'] 51 | 52 | >>> vals = _completion_vars('foo', 'bar --help ') 53 | >>> sorted(vals.keys()) 54 | ['COMP_CWORD', 'COMP_LINE', 'COMP_POINT', 'COMP_WORDS'] 55 | >>> [vals[x] for x in sorted(vals.keys())] 56 | [3, 'foo bar --help ', 15, 'foo bar --help '] 57 | ''' 58 | line = program + ' ' + command 59 | words = line.rstrip() 60 | args = command.split() 61 | cword = len(args) 62 | point = len(line) 63 | if line[-1] == ' ': 64 | words += ' ' 65 | cword += 1 66 | return { 67 | 'COMP_LINE': line, 68 | 'COMP_WORDS': words, 69 | 'COMP_CWORD': cword, 70 | 'COMP_POINT': point, 71 | } 72 | 73 | def get_completion(completion_file, program, command): 74 | ''' 75 | Returns the potential completions from a bash-completion 76 | 77 | @param completion_file (str): file containing bash-completion definition 78 | @param program (str): program being invoked and completed (e.g., 'cp') 79 | @param command (str): rest of the command-line args (e.g., '-r ./') 80 | @return (list(str)): All potential completions if the user were to have 81 | entered program + ' ' + command into an interactive terminal and hit 82 | tab twice. 83 | ''' 84 | replacements = _completion_vars(program, command) 85 | replacements['completion_file'] = completion_file 86 | replacements['program'] = program 87 | full_cmdline = ( 88 | r'source {completion_file};' 89 | 'COMP_LINE="{COMP_LINE}"' 90 | ' COMP_WORDS=({COMP_WORDS})' 91 | ' COMP_CWORD={COMP_CWORD}' 92 | ' COMP_POINT={COMP_POINT};' 93 | '$(complete -p {program} |' 94 | ' sed "s/.*-F \\([^ ]*\\) .*/\\1/") &&' 95 | ' for elem in "${{COMPREPLY[@]}}"; do' 96 | ' echo "${{elem}}";' 97 | ' done'.format(**replacements)) 98 | out = subp.check_output(['bash', '-i', '-c', full_cmdline]) 99 | return out.decode('utf-8').splitlines() 100 | 101 | def main(): 102 | 'Compares the two implementations' 103 | cfile = '../completions/bar' 104 | prog = 'bar' 105 | args = 'import ' 106 | complete_1 = Completion().run(cfile, prog, args) 107 | complete_2 = get_completion(cfile, prog, args) 108 | assert complete_1 == complete_2 109 | from pprint import pprint 110 | pprint(complete_1) 111 | 112 | if __name__ == '__main__': 113 | main() 114 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/Makefile: -------------------------------------------------------------------------------- 1 | RUNNER := python3 2 | SRC := $(wildcard tst_*.py) 3 | RUN_TARGETS := $(SRC:%.py=run_%) 4 | 5 | include ../../color_out.mk 6 | 7 | ifndef VERBOSE 8 | .SILENT: 9 | endif 10 | 11 | .PHONY: check help clean build run_% 12 | check: $(TARGETS) $(RUN_TARGETS) 13 | 14 | help: 15 | @echo "Makefile for running tests on FLiT framework" 16 | @echo " help print this help documentation and exit" 17 | @echo " build just compile the targets" 18 | @echo " check run tests and print results to the console" 19 | @echo " clean remove all generated files" 20 | 21 | build: 22 | clean: 23 | 24 | run_% : %.py 25 | @$(call color_out_noline,BROWN, running) 26 | @echo " $<" 27 | $(RUNNER) $< 28 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/common.py: -------------------------------------------------------------------------------- 1 | from io import StringIO 2 | import os 3 | import sys 4 | 5 | before_path = sys.path[:] 6 | sys.path.append('../..') 7 | import test_harness as th 8 | sys.path = before_path 9 | 10 | class BisectTestError(RuntimeError): pass 11 | 12 | def flit_init(directory): 13 | 'Creates a new FLiT directory returning the standard output' 14 | with StringIO() as ostream: 15 | retval = th.flit.main(['init', '-C', directory], outstream=ostream) 16 | if retval != 0: 17 | raise BisectTestError( 18 | 'Could not initialize (retval={0}):\n'.format(retval) + 19 | ostream.getvalue()) 20 | init_out = ostream.getvalue().splitlines() 21 | return init_out 22 | 23 | def flit_update(directory): 24 | 'Calls flit update in the given directory' 25 | with StringIO() as ostream: 26 | retval = th.flit.main(['update', '-C', directory], 27 | outstream=ostream) 28 | if retval != 0: 29 | raise BisectTestError('Could not update Makefile\n' + 30 | ostream.getvalue()) 31 | 32 | def bisect_compile(compiler, directory=None, linker=None, ldflags=None, 33 | add_ldflags=None): 34 | ''' 35 | Runs bisect with the given compiler and returns makefile variables 36 | 37 | @param compiler (str): name or path to invoke the compiler under test 38 | @param directory (str): directory path to flit test directory 39 | If None is given, use the current working directory 40 | @param linker (str): Linker program to use 41 | If None is given, use baseline compiler 42 | @param ldflags (str): Linker flags to use 43 | If None is given, use value from flit-config.toml for the linker 44 | executable (if given) 45 | @param add_ldflags (str): Linker flags to add to the base linker flags 46 | (either from the ldflags given or the ones from the baseline compiler) 47 | If None is given, no linker flags are added 48 | 49 | @return Dictionary of Makefile variables for first bisect Makefile 50 | ''' 51 | 52 | # create static variable i for how many times this function is called 53 | if not hasattr(bisect_compile, 'i'): 54 | bisect_compile.i = 0 # initialize only once 55 | bisect_compile.i += 1 56 | 57 | # Note: we give a bad flag to cause bisect to error out early 58 | # we just need it to get far enough to create the first makefile 59 | args = ['bisect'] 60 | 61 | if directory is not None: 62 | args.extend(['-C', directory]) 63 | if linker is not None: 64 | args.extend(['--use-linker', linker]) 65 | if ldflags is not None: 66 | args.extend(['--ldflags={}'.format(ldflags)]) 67 | if add_ldflags is not None: 68 | args.extend(['--add-ldflags={}'.format(add_ldflags)]) 69 | 70 | args.extend([ 71 | '--precision', 'double', 72 | compiler + ' -bad-flag', 73 | 'EmptyTest' 74 | ]) 75 | 76 | with StringIO() as ostream: 77 | retval = th.flit.main(args, outstream=ostream) 78 | if retval == 0: 79 | raise BisectTestError('Expected bisect to fail\n' + 80 | ostream.getvalue()) 81 | 82 | # Since each call creates a separate bisect dir, we use our counter 83 | makepath = os.path.join(directory, 84 | 'bisect-{0:02d}'.format(bisect_compile.i), 85 | 'bisect-make-01.mk') 86 | makevars = th.util.extract_make_vars( 87 | makefile=os.path.relpath(makepath, directory), 88 | directory=directory) 89 | return makevars 90 | 91 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/auto-bisect-run-flit-config.toml: -------------------------------------------------------------------------------- 1 | [dev_build] 2 | compiler_name = 'g++' 3 | optimization_level = '-O2' 4 | switches = '' 5 | 6 | [ground_truth] 7 | compiler_name = 'g++' 8 | optimization_level = '-O0' 9 | switches = '' 10 | 11 | [[compiler]] 12 | binary = 'g++' 13 | name = 'g++' 14 | type = 'gcc' 15 | optimization_levels = ['-O1'] 16 | switches_list = [''] 17 | 18 | [[compiler]] 19 | binary = './fake_clang34.py' 20 | name = 'clang++' 21 | type = 'clang' 22 | optimization_levels = ['-O1'] 23 | switches_list = [''] 24 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/auto-bisect-run.csv: -------------------------------------------------------------------------------- 1 | name,host,compiler,optl,switches,precision,score_hex,score,resultfile,comparison_hex,comparison,file,nanosec 2 | BisectTest,does not matter,./fake_clang34.py,-O2,-funsafe-math-optimizations,d,0x40059200000000000000,73,NULL,0x3f800000,1,CLANG_yoga-manjaro_FUNSAFE_MATH_OPTIMIZATIONS_O2,106 3 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/fake_clang34.py: -------------------------------------------------------------------------------- 1 | ../../../shared/fake_clang34.py -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/fake_gcc4.py: -------------------------------------------------------------------------------- 1 | ../../../shared/fake_gcc4.py -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/fake_gcc9.py: -------------------------------------------------------------------------------- 1 | ../../../shared/fake_gcc9.py -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/fake_intel19.py: -------------------------------------------------------------------------------- 1 | ../../../shared/fake_intel19.py -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/flit-config-compilerspecificflags.toml: -------------------------------------------------------------------------------- 1 | [dev_build] 2 | compiler_name = 'fake-gcc' 3 | optimization_level = '-O2' 4 | switches = '-funsafe-math-optimizations' 5 | 6 | [ground_truth] 7 | compiler_name = 'fake-gcc' 8 | optimization_level = '-O0' 9 | switches = '-W-baseline-flag1' 10 | 11 | [[compiler]] 12 | binary = './fake_gcc4.py' 13 | name = 'fake-gcc' 14 | type = 'gcc' 15 | fixed_compile_flags = '-W-gcc-flag1 -W-gcc-flag2' 16 | fixed_link_flags = '-l-gcc-link1 -l-gcc-link2' 17 | 18 | [[compiler]] 19 | binary = './fake_clang34.py' 20 | name = 'fake-clang' 21 | type = 'clang' 22 | fixed_compile_flags = '-W-clang-flag1 -W-clang-flag2' 23 | fixed_link_flags = '-l-clang-link1 -l-clang-link2' 24 | 25 | [[compiler]] 26 | binary = './fake_intel19.py' 27 | name = 'fake-intel' 28 | type = 'intel' 29 | fixed_compile_flags = '-W-intel-flag1 -W-intel-flag2' 30 | fixed_link_flags = '-l-intel-link1 -l-intel-link2' 31 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/tests/A.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #include "A.h" 85 | 86 | #include 87 | 88 | #include 89 | 90 | int A::offset = 2; 91 | 92 | A::A() {} 93 | A::~A() {} 94 | 95 | int A::fileA_method1_PROBLEM() { 96 | if (std::string(FLIT_OPTL) == "-O3") { 97 | return 3 + offset; // variability introduced = offset = 2 98 | } else { 99 | return 3; 100 | } 101 | } 102 | 103 | int fileA_all() { 104 | A a; 105 | return a.fileA_method1_PROBLEM(); 106 | } 107 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/tests/A.h: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #ifndef A_H 85 | #define A_H 86 | 87 | class A { 88 | public: 89 | static int offset; // is a global strong symbol that is not a function 90 | A(); 91 | virtual ~A(); 92 | virtual int fileA_method1_PROBLEM(); 93 | }; 94 | 95 | int fileA_all(); 96 | 97 | #endif // A_H 98 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/tests/file1.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #include "file1.h" 85 | 86 | #include 87 | 88 | #include 89 | 90 | int file1_func1() { return 1; } 91 | 92 | int file1_func2_PROBLEM() { 93 | if (std::string(FLIT_OPTL) == "-O3") { 94 | return 2 + 5; // variability introduced = 5 95 | } else { 96 | return 2; 97 | } 98 | } 99 | 100 | int file1_func3_PROBLEM() { 101 | if (std::string(FLIT_OPTL) == "-O3") { 102 | return 3 + 2; // variability introduced = 2 103 | } else { 104 | return 3; 105 | } 106 | } 107 | 108 | int file1_func4_PROBLEM() { 109 | if (std::string(FLIT_OPTL) == "-O3") { 110 | return 4 + 3; // variability introduced = 3 111 | } else { 112 | return 4; 113 | } 114 | } 115 | 116 | int file1_func5() { return 5; } 117 | 118 | int file1_all() { 119 | return file1_func1() 120 | + file1_func2_PROBLEM() 121 | + file1_func3_PROBLEM() 122 | + file1_func4_PROBLEM() 123 | + file1_func5(); 124 | } 125 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/tests/file1.h: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #ifndef FILE1_H 85 | #define FILE1_H 86 | 87 | int file1_func1(); 88 | int file1_func2_PROBLEM(); // variability = 5 89 | int file1_func3_PROBLEM(); // variability = 2 90 | int file1_func4_PROBLEM(); // variability = 3 91 | int file1_func5(); 92 | int file1_all(); 93 | 94 | #endif // FILE1_H 95 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/tests/file2.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #include "file2.h" 85 | 86 | #include 87 | 88 | #include 89 | 90 | int file2_func1_PROBLEM() { 91 | if (std::string(FLIT_OPTL) == "-O3") { 92 | return 1 + 7; // variability introduced = 7 93 | } else { 94 | return 1; 95 | } 96 | } 97 | 98 | int file2_func2() { return 2; } 99 | int file2_func3() { return 3; } 100 | int file2_func4() { return 4; } 101 | int file2_func5() { return 5; } 102 | 103 | int file2_all() { 104 | return file2_func1_PROBLEM() 105 | + file2_func2() 106 | + file2_func3() 107 | + file2_func4() 108 | + file2_func5(); 109 | } 110 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/tests/file2.h: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #ifndef FILE2_H 85 | #define FILE2_H 86 | 87 | int file2_func1_PROBLEM(); // variability = 7 88 | int file2_func2(); 89 | int file2_func3(); 90 | int file2_func4(); 91 | int file2_func5(); 92 | int file2_all(); 93 | 94 | #endif // FILE2_H 95 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/tests/file3.cpp: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #include "file1.h" 85 | 86 | #include 87 | 88 | #include 89 | 90 | int file3_func1() { return 1; } 91 | 92 | int file3_func2_PROBLEM() { 93 | if (std::string(FLIT_OPTL) == "-O3") { 94 | return 2 + 1; // variability introduced = 1 95 | } else { 96 | return 2; 97 | } 98 | } 99 | 100 | int file3_func3() { return 3; } 101 | int file3_func4() { return 4; } 102 | 103 | int file3_func5_PROBLEM() { 104 | if (std::string(FLIT_OPTL) == "-O3") { 105 | return 5 + 3; // variability introduced = 3 106 | } else { 107 | return 5; 108 | } 109 | } 110 | 111 | int file3_all() { 112 | return file3_func1() 113 | + file3_func2_PROBLEM() 114 | + file3_func3() 115 | + file3_func4() 116 | + file3_func5_PROBLEM(); 117 | } 118 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/tests/file3.h: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #ifndef FILE3_H 85 | #define FILE3_H 86 | 87 | int file3_func1(); 88 | int file3_func2_PROBLEM(); // variability = 1 89 | int file3_func3(); 90 | int file3_func4(); 91 | int file3_func5_PROBLEM(); // variability = 3 92 | int file3_all(); 93 | 94 | #endif // FILE3_H 95 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/tests/file4.cxx: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #include "file4.h" 85 | 86 | #include 87 | 88 | #include 89 | 90 | int file4_func1() { return 1; } 91 | int file4_func2() { return 2; } 92 | int file4_func3() { return 3; } 93 | int file4_func4() { return 4; } 94 | 95 | // Needs to be put into an unnamed namespace so that the symbols are local 96 | // instead of global and weak. This is needed for Bisect to work properly. 97 | namespace { 98 | 99 | template 100 | int file4_func5_TEMPLATE_PROBLEM() { 101 | if (std::string(FLIT_OPTL) == "-O3") { 102 | return 5 + 10; // variability introduced = 10 103 | } else { 104 | return 5; 105 | } 106 | } 107 | 108 | } // end of unnamed namespace 109 | 110 | int file4_all() { 111 | return file4_func1() 112 | + file4_func2() 113 | + file4_func3() 114 | + file4_func4() 115 | + file4_func5_TEMPLATE_PROBLEM<0>() 116 | + file4_func5_TEMPLATE_PROBLEM<1>() 117 | + file4_func5_TEMPLATE_PROBLEM<2>(); 118 | } 119 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_bisect/data/tests/file4.h: -------------------------------------------------------------------------------- 1 | /* -- LICENSE BEGIN -- 2 | * 3 | * Copyright (c) 2015-2020, Lawrence Livermore National Security, LLC. 4 | * 5 | * Produced at the Lawrence Livermore National Laboratory 6 | * 7 | * Written by 8 | * Michael Bentley (mikebentley15@gmail.com), 9 | * Geof Sawaya (fredricflinstone@gmail.com), 10 | * and Ian Briggs (ian.briggs@utah.edu) 11 | * under the direction of 12 | * Ganesh Gopalakrishnan 13 | * and Dong H. Ahn. 14 | * 15 | * LLNL-CODE-743137 16 | * 17 | * All rights reserved. 18 | * 19 | * This file is part of FLiT. For details, see 20 | * https://pruners.github.io/flit 21 | * Please also read 22 | * https://github.com/PRUNERS/FLiT/blob/master/LICENSE 23 | * 24 | * Redistribution and use in source and binary forms, with or 25 | * without modification, are permitted provided that the following 26 | * conditions are met: 27 | * 28 | * - Redistributions of source code must retain the above copyright 29 | * notice, this list of conditions and the disclaimer below. 30 | * 31 | * - Redistributions in binary form must reproduce the above 32 | * copyright notice, this list of conditions and the disclaimer 33 | * (as noted below) in the documentation and/or other materials 34 | * provided with the distribution. 35 | * 36 | * - Neither the name of the LLNS/LLNL nor the names of its 37 | * contributors may be used to endorse or promote products derived 38 | * from this software without specific prior written permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44 | * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL 45 | * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE 46 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 47 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 50 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 52 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 53 | * THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | * Additional BSD Notice 56 | * 57 | * 1. This notice is required to be provided under our contract 58 | * with the U.S. Department of Energy (DOE). This work was 59 | * produced at Lawrence Livermore National Laboratory under 60 | * Contract No. DE-AC52-07NA27344 with the DOE. 61 | * 62 | * 2. Neither the United States Government nor Lawrence Livermore 63 | * National Security, LLC nor any of their employees, makes any 64 | * warranty, express or implied, or assumes any liability or 65 | * responsibility for the accuracy, completeness, or usefulness of 66 | * any information, apparatus, product, or process disclosed, or 67 | * represents that its use would not infringe privately-owned 68 | * rights. 69 | * 70 | * 3. Also, reference herein to any specific commercial products, 71 | * process, or services by trade name, trademark, manufacturer or 72 | * otherwise does not necessarily constitute or imply its 73 | * endorsement, recommendation, or favoring by the United States 74 | * Government or Lawrence Livermore National Security, LLC. The 75 | * views and opinions of authors expressed herein do not 76 | * necessarily state or reflect those of the United States 77 | * Government or Lawrence Livermore National Security, LLC, and 78 | * shall not be used for advertising or product endorsement 79 | * purposes. 80 | * 81 | * -- LICENSE END -- 82 | */ 83 | 84 | #ifndef FILE4_H 85 | #define FILE4_H 86 | 87 | int file4_func1(); 88 | int file4_func2(); 89 | int file4_func3(); 90 | int file4_func4(); 91 | template 92 | int file4_func5_TEMPLATE_PTOBLEM(); // variability = 10 93 | int file4_all(); 94 | 95 | #endif // FILE4_H 96 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_disguise/Makefile: -------------------------------------------------------------------------------- 1 | RUNNER := python3 2 | SRC := $(wildcard tst_*.py) 3 | RUN_TARGETS := $(SRC:%.py=run_%) 4 | 5 | include ../../color_out.mk 6 | 7 | ifndef VERBOSE 8 | .SILENT: 9 | endif 10 | 11 | .PHONY: check help clean build run_% 12 | check: $(TARGETS) $(RUN_TARGETS) 13 | 14 | help: 15 | @echo "Makefile for running tests on FLiT framework" 16 | @echo " help print this help documentation and exit" 17 | @echo " build just compile the targets" 18 | @echo " check run tests and print results to the console" 19 | @echo " clean remove all generated files" 20 | 21 | build: 22 | clean: 23 | 24 | run_% : %.py 25 | @$(call color_out_noline,BROWN, running) 26 | @echo " $<" 27 | $(RUNNER) $< 28 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_import/Makefile: -------------------------------------------------------------------------------- 1 | RUNNER := python3 2 | SRC := $(wildcard tst_*.py) 3 | RUN_TARGETS := $(SRC:%.py=run_%) 4 | 5 | include ../../color_out.mk 6 | 7 | ifndef VERBOSE 8 | .SILENT: 9 | endif 10 | 11 | .PHONY: check help clean build run_% 12 | check: $(TARGETS) $(RUN_TARGETS) 13 | 14 | help: 15 | @echo "Makefile for running tests on FLiT framework" 16 | @echo " help print this help documentation and exit" 17 | @echo " build just compile the targets" 18 | @echo " check run tests and print results to the console" 19 | @echo " clean remove all generated files" 20 | 21 | build: 22 | clean: 23 | 24 | run_% : %.py 25 | @$(call color_out_noline,BROWN, running) 26 | @echo " $<" 27 | $(RUNNER) $< 28 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_import/data/data1.csv: -------------------------------------------------------------------------------- 1 | name,host,compiler,optl,switches,precision,score_hex,score,resultfile,comparison_hex,comparison,file,nanosec 2 | Test-name 1,My-host,g++,-O3,-funsafe-math-optimizations,d,0x3fc1f3bf9fbd47d9a800,4.13E-19,NULL,0xbf8d8000000000000000,-4.81E-35,Executable-1,0 3 | Test-name 1,My-host,g++,-O3,-funsafe-math-optimizations,e,0x39b1f4945ea2bda83e1d,2.622993437820000000049493126424993646159392840860537999954199990192081383442238818022440754628591392062370104918700079633947091308461839161171640941846366999487116897033647392640059787776192308046148485442313923637505619864489663342532546868165054067822553526472224056250818846029404834715074970010619585201127975867937128686584859879235956730154796047568484754028218349365890624790982353393885557838362503601335004366804753200077871854785718735900172999572949926325063118472484723814495993721500770550490477690570702216083488816431615025776587959223632347438896354452271830717685450631135729485941832893902859041046485120727804367381754781456875315095074113343122617644273653171652021857112889615423937484463835787809320022112937369856636506646976768460185212153428152275393010129262643490977972613221204038554898919875314600364413668735286620701405148737003869390251211450716301354137742031331212078879640318656013417890315294552993898491795938960646946762588295746816126420665952524682531599334464e-486,NULL,0x00000000000000000,0,Executable-1,0 4 | Test-name 1,My-host,g++,-O3,-funsafe-math-optimizations,f,0x406bfbc7780000000000,6.38336044132261E+032,NULL,0x40548000000000000000,3.86856262276681E+025,Executable-1,0 5 | Test-name 2,My-host,g++,-O3,-funsafe-math-optimizations,d,0x43f3f78060de921d6800,8.48639885075809E+304,NULL,0x43bf8000000000000000,9.74531401139999E+288,Executable-1,0 6 | Test-name 2,My-host,g++,-O3,-funsafe-math-optimizations,e,0x750fc6e7f87ea219b5f0,2.414900878482699999795508402316024758692093524806230899470711317155208208917239351004592145700838964809713539689950081780652142004017701820489109185237739731776069652775475587364235041317881184647657737514056077406660197340530427402720810614023982185997501558174758654488852938662786077427428151283412205029413321065359541219873748339197031818496674331872259620434905462771175297875629859443933488190292705817203369288279859977237950632350306150894955353470107246953620032474441533425556138127561529626825449889989460593037745787637371551643659888695656111848431709385771441755211411455955350026612450283221437557870777655391290501233122703416744333570839252203524526590014751409815036338943626475847611276171463663976894962144501520730899078171939790820650957206041614439841880474407327983121273223057622974837366966306292949739537499800325401059186202791792679518011908836657422244571139693819475514296103878538735858327875567104379905240638787073442073798378865190480293376910192972788631712551243e+4089,NULL,0x00000000000000000,0,Executable-1,0 7 | Test-name 2,My-host,g++,-O3,-funsafe-math-optimizations,f,0x3fa7f4dbb50000000000,6.18E-27,NULL,0x3f908000000000000000,3.85E-34,Executable-1,0 8 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_init/Makefile: -------------------------------------------------------------------------------- 1 | RUNNER := python3 2 | SRC := $(wildcard tst_*.py) 3 | RUN_TARGETS := $(SRC:%.py=run_%) 4 | 5 | include ../../color_out.mk 6 | 7 | ifndef VERBOSE 8 | .SILENT: 9 | endif 10 | 11 | .PHONY: check help clean build run_% 12 | check: $(TARGETS) $(RUN_TARGETS) 13 | 14 | help: 15 | @echo "Makefile for running tests on FLiT framework" 16 | @echo " help print this help documentation and exit" 17 | @echo " build just compile the targets" 18 | @echo " check run tests and print results to the console" 19 | @echo " clean remove all generated files" 20 | 21 | build: 22 | clean: 23 | 24 | run_% : %.py 25 | @$(call color_out_noline,BROWN, running) 26 | @echo " $<" 27 | $(RUNNER) $< 28 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_update/Makefile: -------------------------------------------------------------------------------- 1 | RUNNER := python3 2 | SRC := $(wildcard tst_*.py) 3 | RUN_TARGETS := $(SRC:%.py=run_%) 4 | 5 | include ../../color_out.mk 6 | 7 | ifndef VERBOSE 8 | .SILENT: 9 | endif 10 | 11 | .PHONY: check help clean build run_% 12 | check: $(TARGETS) $(RUN_TARGETS) 13 | 14 | help: 15 | @echo "Makefile for running tests on FLiT framework" 16 | @echo " help print this help documentation and exit" 17 | @echo " build just compile the targets" 18 | @echo " check run tests and print results to the console" 19 | @echo " clean remove all generated files" 20 | 21 | build: 22 | clean: 23 | 24 | run_% : %.py 25 | @$(call color_out_noline,BROWN, running) 26 | @echo " $<" 27 | $(RUNNER) $< 28 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_update/README.md: -------------------------------------------------------------------------------- 1 | # Tests 2 | 3 | ## Tests covering `[[compiler]]` section 4 | 5 | 1. `tst_nocompilers.py`: Test that not specifying the `[[compiler]]` section 6 | gives the default values 7 | 2. `tst_nooptl.py`: Test that specifying a compiler, but not specifying the 8 | optimization levels gives the default values 9 | 3. `tst_noswitches.py`: Test that specifying a compiler, but not specifying the 10 | switches list gives the default values 11 | 4. `tst_onlyprovidedoptlswitches.py`: Test that the provided list of 12 | optimization levels and switches are used, and nothing more. 13 | 5. `tst_onlyprovidedcompilers.py`: Test that by only specifying one compiler, 14 | only that specified compiler is used 15 | 6. `tst_badconfig.py`: Tests error cases in the configuration file, such as 16 | specifying more than one of a certain type of compiler 17 | 18 | # Needed tests 19 | 20 | 1. `FLIT_INC_DIR`, `FLIT_LIB_DIR`, `FLIT_DATA_DIR`, and `FLIT_SCRIPT_DIR`, for 21 | both from git repository and for an installed FLiT 22 | 2. `DEV_CXX`, `DEV_OPTL`, and `DEV_SWITCHES` for both provided and non-provided 23 | 3. `GT_CXX`, `GT_OPTL`, and `GT_SWITCHES` for both provided and non-provided 24 | 4. `TEST_RUN_ARGS` from `timing`, `timing_loops`, and `timing_repeats` for both 25 | provided and non-provided 26 | 5. `ENABLE_MPI` and `MPIRUN_ARGS` for both provided and non-provided 27 | 6. `HOSTNAME` 28 | 7. `UNAME_S` 29 | 30 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_update/data/compilerspecificflags.toml: -------------------------------------------------------------------------------- 1 | # Test the fixed_compile_flags and fixed_link_flags 2 | 3 | [[compiler]] 4 | binary = './fake_gcc9.py' 5 | name = 'g++' 6 | type = 'gcc' 7 | fixed_compile_flags = '-first-gxx' 8 | fixed_link_flags = '-first-gxx-ld -second-gxx-ld' 9 | 10 | [[compiler]] 11 | binary = './fake_clang34.py' 12 | name = 'clang++' 13 | type = 'clang' 14 | fixed_compile_flags = '-first-clang -second-clang' 15 | 16 | [[compiler]] 17 | binary = './fake_intel19.py' 18 | name = 'icpc' 19 | type = 'intel' 20 | fixed_link_flags = '-first-intel-ld' 21 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_update/data/fake_clang34.py: -------------------------------------------------------------------------------- 1 | ../../../shared/fake_clang34.py -------------------------------------------------------------------------------- /tests/flit_cli/flit_update/data/fake_gcc9.py: -------------------------------------------------------------------------------- 1 | ../../../shared/fake_gcc9.py -------------------------------------------------------------------------------- /tests/flit_cli/flit_update/data/fake_intel19.py: -------------------------------------------------------------------------------- 1 | ../../../shared/fake_intel19.py -------------------------------------------------------------------------------- /tests/flit_cli/flit_update/data/nocompilers.toml: -------------------------------------------------------------------------------- 1 | # Test that with no compilers specified the default three compilers with their 2 | # default flags are used. 3 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_update/data/nooptl.toml: -------------------------------------------------------------------------------- 1 | # Test that missing optimization levels causes the defaults to be used 2 | 3 | [[compiler]] 4 | binary = 'g++' 5 | name = 'g++' 6 | type = 'gcc' 7 | 8 | # missing optimization levels 9 | 10 | switches_list = [ 11 | '-fassociative-math', 12 | '-fcx-fortran-rules', 13 | '-fcx-limited-range', 14 | '-fexcess-precision=fast', 15 | '-ffinite-math-only', 16 | '-ffloat-store', 17 | '-ffp-contract=on', 18 | '-fmerge-all-constants', 19 | '-fno-trapping-math', 20 | '-freciprocal-math', 21 | '-frounding-math', 22 | '-fsignaling-nans', 23 | '-funsafe-math-optimizations', 24 | '-mavx', 25 | '-mavx2 -mfma', 26 | '-mfpmath=sse -mtune=native', 27 | '' 28 | ] 29 | 30 | [[compiler]] 31 | binary = 'clang++' 32 | name = 'clang++' 33 | type = 'clang' 34 | 35 | # missing optimization levels 36 | 37 | switches_list = [ 38 | '-fassociative-math', 39 | '-fexcess-precision=fast', 40 | '-fexcess-precision=standard', 41 | '-ffinite-math-only', 42 | '-ffloat-store', 43 | '-ffp-contract=on', 44 | '-fmerge-all-constants', 45 | '-fno-trapping-math', 46 | '-freciprocal-math', 47 | '-frounding-math', 48 | '-fsignaling-nans', 49 | '-fsingle-precision-constant', 50 | '-funsafe-math-optimizations', 51 | '-march=core-avx2', 52 | '-mavx', 53 | '-mavx2 -mfma', 54 | '-mfpmath=sse -mtune=native', 55 | '' 56 | ] 57 | 58 | [[compiler]] 59 | binary = 'icpc' 60 | name = 'icpc' 61 | type = 'intel' 62 | 63 | # missing optimization levels 64 | 65 | switches_list = [ 66 | '--use_fast_math', 67 | '-fcx-limited-range', 68 | '-ffloat-store', 69 | '-fma', 70 | '-fmerge-all-constants', 71 | '-fp-model fast=1', 72 | '-fp-model fast=2', 73 | '-fp-model=double', 74 | '-fp-model=except', 75 | '-fp-model=extended', 76 | '-fp-model=precise', 77 | '-fp-model=source', 78 | '-fp-model=strict', 79 | '-fp-port', 80 | '-frounding-math', 81 | '-fsingle-precision-constant', 82 | '-ftz', 83 | '-march=core-avx2', 84 | '-mavx', 85 | '-mavx2 -mfma', 86 | '-mfpmath=sse -mtune=native', 87 | '-mp1', 88 | '-no-fma', 89 | '-no-ftz', 90 | '-no-prec-div', 91 | '-prec-div', 92 | '' 93 | ] 94 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_update/data/noswitches.toml: -------------------------------------------------------------------------------- 1 | # Test that missing switches causes the compiler-specific defaults to be used 2 | 3 | [[compiler]] 4 | binary = 'g++' 5 | name = 'g++' 6 | type = 'gcc' 7 | optimization_levels = [ 8 | '-O0', 9 | '-O1', 10 | '-O2', 11 | '-O3', 12 | ] 13 | 14 | # Missing switches 15 | 16 | [[compiler]] 17 | binary = 'clang++' 18 | name = 'clang++' 19 | type = 'clang' 20 | optimization_levels = [ 21 | '-O0', 22 | '-O1', 23 | '-O2', 24 | '-O3', 25 | ] 26 | 27 | # Missing switches 28 | 29 | [[compiler]] 30 | binary = 'icpc' 31 | name = 'icpc' 32 | type = 'intel' 33 | optimization_levels = [ 34 | '-O0', 35 | '-O1', 36 | '-O2', 37 | '-O3', 38 | ] 39 | 40 | # Missing switches 41 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_update/data/onlyprovidedcompilers.toml: -------------------------------------------------------------------------------- 1 | # Test only providing g++ 2 | 3 | [[compiler]] 4 | binary = './fake_gcc9.py' 5 | name = 'g++' 6 | type = 'gcc' 7 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_update/data/onlyprovidedoptlswitches.toml: -------------------------------------------------------------------------------- 1 | # Test that only the provided optimization levels and switches are used 2 | 3 | [[compiler]] 4 | binary = 'g++' 5 | name = 'g++' 6 | type = 'gcc' 7 | 8 | optimization_levels = [ 9 | '-O2', 10 | '-O3', 11 | ] 12 | switches_list = [ 13 | '-funsafe-math-optimizations', 14 | '-mavx', 15 | '' 16 | ] 17 | 18 | [[compiler]] 19 | binary = 'clang++' 20 | name = 'clang++' 21 | type = 'clang' 22 | 23 | optimization_levels = [ 24 | '-O0', 25 | '-O1', 26 | ] 27 | switches_list = [ 28 | '-ffinite-math-only', 29 | '-ffloat-store', 30 | ] 31 | 32 | [[compiler]] 33 | binary = 'icpc' 34 | name = 'icpc' 35 | type = 'intel' 36 | 37 | optimization_levels = [ 38 | '-Ofast', 39 | '-Og', 40 | ] 41 | switches_list = [ 42 | '-fmerge-all-constants', 43 | '-fp-model fast=1', 44 | '-fp-model fast=2', 45 | '-DUSE_MPI' 46 | ] 47 | -------------------------------------------------------------------------------- /tests/flit_cli/flit_version/Makefile: -------------------------------------------------------------------------------- 1 | RUNNER := python3 2 | SRC := $(wildcard tst_*.py) 3 | RUN_TARGETS := $(SRC:%.py=run_%) 4 | 5 | include ../../color_out.mk 6 | 7 | ifndef VERBOSE 8 | .SILENT: 9 | endif 10 | 11 | .PHONY: check help clean build run_% 12 | check: $(TARGETS) $(RUN_TARGETS) 13 | 14 | help: 15 | @echo "Makefile for running tests on FLiT framework" 16 | @echo " help print this help documentation and exit" 17 | @echo " build just compile the targets" 18 | @echo " check run tests and print results to the console" 19 | @echo " clean remove all generated files" 20 | 21 | build: 22 | clean: 23 | 24 | run_% : %.py 25 | @$(call color_out_noline,BROWN, running) 26 | @echo " $<" 27 | $(RUNNER) $< 28 | -------------------------------------------------------------------------------- /tests/flit_install/Makefile: -------------------------------------------------------------------------------- 1 | RUNNER := python3 2 | SRC := $(wildcard tst_*.py) 3 | RUN_TARGETS := $(SRC:%.py=run_%) 4 | 5 | include ../color_out.mk 6 | 7 | ifndef VERBOSE 8 | .SILENT: 9 | endif 10 | 11 | .PHONY: check help clean build run_% 12 | check: $(TARGETS) $(RUN_TARGETS) 13 | 14 | help: 15 | @echo "Makefile for running tests on FLiT framework" 16 | @echo " help print this help documentation and exit" 17 | @echo " build just compile the targets" 18 | @echo " check run tests and print results to the console" 19 | @echo " clean remove all generated files" 20 | 21 | build: 22 | clean: 23 | 24 | run_% : %.py 25 | @$(call color_out_noline,BROWN, running) 26 | @echo " $<" 27 | $(RUNNER) $< 28 | -------------------------------------------------------------------------------- /tests/flit_makefile/Makefile: -------------------------------------------------------------------------------- 1 | RUNNER := python3 2 | SRC := $(wildcard tst_*.py) 3 | RUN_TARGETS := $(SRC:%.py=run_%) 4 | 5 | include ../color_out.mk 6 | 7 | ifndef VERBOSE 8 | .SILENT: 9 | endif 10 | 11 | .PHONY: check help clean build run_% 12 | check: $(TARGETS) $(RUN_TARGETS) 13 | 14 | help: 15 | @echo "Makefile for running tests on FLiT framework" 16 | @echo " help print this help documentation and exit" 17 | @echo " build just compile the targets" 18 | @echo " check run tests and print results to the console" 19 | @echo " clean remove all generated files" 20 | 21 | build: 22 | clean: 23 | 24 | run_% : %.py 25 | @$(call color_out_noline,BROWN, running) 26 | @echo " $<" 27 | $(RUNNER) $< 28 | -------------------------------------------------------------------------------- /tests/flit_makefile/fake_clang34.py: -------------------------------------------------------------------------------- 1 | ../shared/fake_clang34.py -------------------------------------------------------------------------------- /tests/flit_makefile/fake_gcc4.py: -------------------------------------------------------------------------------- 1 | ../shared/fake_gcc4.py -------------------------------------------------------------------------------- /tests/flit_mpi/Makefile: -------------------------------------------------------------------------------- 1 | RUNNER := python3 2 | SRC := $(wildcard tst_*.py) 3 | RUN_TARGETS := $(SRC:%.py=run_%) 4 | MPIRUN := $(shell command -v mpirun 2>/dev/null) 5 | MPICXX := $(shell command -v mpic++ 2>/dev/null) 6 | 7 | include ../color_out.mk 8 | 9 | ifndef VERBOSE 10 | .SILENT: 11 | endif 12 | 13 | .PHONY: check help clean build run_% 14 | ifeq ($(MPIRUN),) 15 | check: 16 | $(call color_out,RED,Warning: mpirun is not found on your system; skipping the MPI tests) 17 | else ifeq ($(MPICXX),) 18 | check: 19 | $(call color_out,RED,Warning: mpic++ is not found on your system; skipping the MPI tests) 20 | else 21 | check: $(TARGETS) $(RUN_TARGETS) 22 | endif 23 | 24 | help: 25 | @echo "Makefile for running tests on FLiT framework" 26 | @echo " help print this help documentation and exit" 27 | @echo " build just compile the targets" 28 | @echo " check run tests and print results to the console" 29 | @echo " clean remove all generated files" 30 | 31 | build: 32 | clean: 33 | 34 | run_% : %.py 35 | @$(call color_out_noline,BROWN, running) 36 | @echo " $<" 37 | $(RUNNER) $< 38 | -------------------------------------------------------------------------------- /tests/flit_mpi/data/flit-config.toml: -------------------------------------------------------------------------------- 1 | [run] 2 | enable_mpi = true 3 | 4 | # Use default for all other options 5 | -------------------------------------------------------------------------------- /tests/flit_src/Makefile: -------------------------------------------------------------------------------- 1 | CC := g++ 2 | FLITDIR := ../.. 3 | FLIT_SRC := $(FLITDIR)/src/flit/ALL-FLIT.cpp 4 | 5 | CFLAGS := -O0 -g 6 | CFLAGS += -std=c++11 7 | CFLAGS += -fprofile-arcs 8 | CFLAGS += -ftest-coverage 9 | CFLAGS += -fPIC 10 | LDFLAGS := -lflit -L. -Wl,-rpath=$(CURDIR) 11 | SRC := $(wildcard *.cpp) 12 | DEPS := $(SRC:%.cpp=%.d) 13 | DEPS += $(notdir $(FLIT_SRC:%.cpp=%.d)) 14 | TARGETS := $(SRC:%.cpp=%) 15 | GCOV_FILES := $(SRC:%.cpp=%.gcda) 16 | GCOV_FILES += $(SRC:%.cpp=%.gcno) 17 | GCOV_FILES += $(notdir $(FLIT_SRC:%.cpp=%.gcda)) 18 | GCOV_FILES += $(notdir $(FLIT_SRC:%.cpp=%.gcno)) 19 | RUN_TARGETS := $(TARGETS:%=run_%) 20 | HARNESS := ../test_harness.h 21 | CFLAGS += $(addprefix -I,$(dir $(HARNESS))) 22 | CFLAGS += -I../../src 23 | 24 | DEPFLAGS = -MD -MF $*.d 25 | 26 | include ../color_out.mk 27 | 28 | ifndef VERBOSE 29 | .SILENT: 30 | endif 31 | 32 | .PHONY: build check help clean run_% 33 | build: $(TARGETS) 34 | 35 | check: $(TARGETS) $(RUN_TARGETS) 36 | 37 | help: 38 | @echo "Makefile for running tests on FLiT framework" 39 | @echo " help print this help documentation and exit" 40 | @echo " build just compile the targets" 41 | @echo " check run tests and print results to the console" 42 | @echo " clean remove all generated files" 43 | 44 | clean: 45 | rm -f $(DEPS) 46 | rm -f $(TARGETS) 47 | rm -f $(GCOV_FILES) 48 | rm -f libflit.so 49 | 50 | run_% : % 51 | @$(call color_out_noline,BROWN, running) 52 | @echo " $<" 53 | ./$< --semi-quiet 54 | 55 | % : %.cpp $(HARNESS) Makefile 56 | @$(call color_out,CYAN, $< -> $@) 57 | $(CC) $(CFLAGS) $(DEPFLAGS) $< -o $@ $(LDFLAGS) 58 | 59 | .PRECIOUS: %.d 60 | -include $(DEPS) 61 | 62 | $(TARGETS): libflit.so 63 | 64 | libflit.so: $(FLIT_SRC) Makefile 65 | @$(call color_out,CYAN, $< -> $@) 66 | $(CC) -shared $(CFLAGS) $(DEPFLAGS) $< -o $@ 67 | -------------------------------------------------------------------------------- /tests/harness/Makefile: -------------------------------------------------------------------------------- 1 | CC := g++ 2 | CFLAGS := -O0 -g 3 | CFLAGS += -std=c++11 4 | SRC := $(wildcard *.cpp) 5 | DEPS := $(SRC:%.cpp=%.d) 6 | TARGETS := $(SRC:%.cpp=%) 7 | RUN_TARGETS := $(TARGETS:%=run_%) 8 | HARNESS := $(wildcard ../*.h) 9 | CFLAGS += $(addprefix -I,$(sort $(dir $(HARNESS)))) 10 | TST_HARNESS := tst_test_harness 11 | 12 | DEPFLAGS = -MD -MF $*.d 13 | 14 | include ../color_out.mk 15 | 16 | ifndef VERBOSE 17 | .SILENT: 18 | endif 19 | 20 | .PHONY: build check help clean run_% 21 | build: $(TARGETS) 22 | 23 | check: $(TARGETS) $(RUN_TARGETS) 24 | 25 | help: 26 | @echo "Makefile for running tests on FLiT framework" 27 | @echo " help print this help documentation and exit" 28 | @echo " build just compile the targets" 29 | @echo " check run tests and print results to the console" 30 | @echo " clean remove all generated files" 31 | 32 | clean: 33 | rm -f $(DEPS) 34 | rm -f $(TARGETS) 35 | 36 | # Have a separate rule for test_harness since we expected exactly 10 failures 37 | run_tst_test_harness: tst_test_harness 38 | @$(call color_out_noline,BROWN, running) 39 | @echo " $<" 40 | ./tst_test_harness | grep "failures: *10$$" >/dev/null 41 | 42 | run_% : % 43 | @$(call color_out_noline,BROWN, running) 44 | @echo " $<" 45 | ./$< --semi-quiet 46 | 47 | % : %.cpp $(HARNESS) Makefile 48 | @$(call color_out,CYAN, $< -> $@) 49 | $(CC) $(CFLAGS) $(DEPFLAGS) $< -o $@ $(LDFLAGS) 50 | 51 | .PRECIOUS: %.d 52 | -include $(DEPS) 53 | 54 | $(TARGETS): $(FLITLIB) 55 | 56 | $(FLITLIB): 57 | @$(MAKE) -C $(FLITDIR) 58 | --------------------------------------------------------------------------------