Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate compiler flags from toml file #251

Merged
merged 30 commits into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8276101
Generalize flags into toml file.
jjgarzella Nov 27, 2018
af4a367
Generalize flag indirection
jjgarzella Nov 28, 2018
e571475
Merge branch 'feature/flags_toml' into issue244-remove-hosts
mikebentley15 Nov 29, 2018
b2d2327
flit_update: handle defaults for compiler optl and switches
mikebentley15 Nov 27, 2018
b7c432e
Fix python doctest findings
mikebentley15 Nov 27, 2018
1ac371a
Put in an empty function that generates the optimization levels and s…
mikebentley15 Nov 29, 2018
b49bc26
docs: update flit-configuration-file.md
mikebentley15 Nov 29, 2018
44981e4
flit-update: do not ignore empty switches
mikebentley15 Nov 29, 2018
03f0976
flit-update: fix handling of missing compilers
mikebentley15 Nov 29, 2018
fcb705e
flit-update: docstring + doctest for gen_assignments
mikebentley15 Nov 29, 2018
e1c37a5
flit-update: simplify a bit with gen_multi_assignment
mikebentley15 Nov 29, 2018
48b4d9e
flit-update: solve pylint findings
mikebentley15 Nov 29, 2018
c612840
Makefile.in: have python give uname
mikebentley15 Nov 29, 2018
2031169
Makefile.in: have hostname come from python
mikebentley15 Nov 29, 2018
ec0f7bb
Merge branch 'devel' into feature/flags_toml
mikebentley15 Nov 29, 2018
d7ad945
Merge pull request #2 from PRUNERS/copyof-issue244-remove-hosts
jjgarzella Nov 30, 2018
076a956
Merge pull request #3 from PRUNERS/issue119-user-provided-flags
jjgarzella Dec 3, 2018
4b1f371
flit-update: test for no compilers specified
mikebentley15 Dec 12, 2018
ac823ae
Merge branch 'devel' into issue119-user-flag-tests
mikebentley15 Dec 12, 2018
40659d6
tests/flit_update: fix tst_nocompilers and tst_nooptl
mikebentley15 Dec 12, 2018
171c47d
tests/flit_update: add two new tests
mikebentley15 Dec 12, 2018
f36e9e1
tests/flit_update: remove debug code from test
mikebentley15 Dec 12, 2018
a918881
tests/flit_update: add test for 1 provided compiler
mikebentley15 Dec 12, 2018
f162372
tests/flit_update: add tst_badconfig.py
mikebentley15 Dec 13, 2018
0adf88e
tests/flit_update: make common functions file
mikebentley15 Dec 13, 2018
663b3aa
tests/flit_update: Add docstring tests for tst_common_funcs.py
mikebentley15 Dec 13, 2018
705b727
tests/flit_update/tst_common_funcs.py: pylint fixes
mikebentley15 Dec 13, 2018
385d791
Merge pull request #247 from jjgarzella/feature/flags_toml
mikebentley15 Dec 19, 2018
941c26b
Merge branch 'devel' into issue119-user-flag-tests
mikebentley15 Dec 19, 2018
2728341
Fix review finding
mikebentley15 Jan 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 15 additions & 126 deletions data/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,10 @@ DEV_TARGET ?= devrun
GT_TARGET ?= gtrun
GT_OUT := ground-truth.csv

UNAME_S := $(shell uname -s)
UNAME_S := {uname}

# will be None if not specified in flit-config.toml
CLANG := {clang_compiler}
INTEL := {intel_compiler}
GCC := {gcc_compiler}
{compiler_defs}
CLANG_TYPE := clang
INTEL_TYPE := intel
GCC_TYPE := gcc
Expand Down Expand Up @@ -227,7 +225,7 @@ GT_OBJ = $(addprefix $(OBJ_DIR)/,$(notdir $(SOURCE:%.cpp=%_gt.o)))
GT_DEPS = $(GT_OBJ:%.o=%.d)
GT_OBJ_FPIC = $(GT_OBJ:%.o=%_fPIC.o)

HOSTNAME := $(shell hostname)
HOSTNAME := {hostname}

RESULTS_DIR := results

Expand All @@ -245,128 +243,19 @@ endif
# more comp settings, taken from here:
# https://software.intel.com/sites/default/files/article/326703/fp-control-2012-08.pdf

#individual flags
# individual flags

## optls

O0 := -O0
O1 := -O1
O2 := -O2
O3 := -O3

#switches

ASSOCMATH := -fassociative-math
AVX := -mavx
COMPTRANS := -mp1
DEFFLAGS :=
DISFMA := -no-fma
ENAFMA := -fma
FASTEXPREC := -fexcess-precision=fast
FASTM := -ffast-math
FINMATH := -ffinite-math-only
FLUSHDEN := -ftz
FMAGCC := -mavx2 -mfma
FMAICC := -march=core-avx2
FORTRULES := -fcx-fortran-rules
FPCONT := -ffp-contract=on
FPMODDBL := -fp-model=double
FPMODEXC := -fp-model=except
FPMODEXT := -fp-model=extended
FPMODFST1 := -fp-model fast=1
FPMODFST2 := -fp-model fast=2
FPMODPRE := -fp-model=precise
FPMODSRC := -fp-model=source
FPMODSTR := -fp-model=strict
FPTRAP := -fp-trap=common
FSTORE := -ffloat-store
LIMITEDRANGE := -fcx-limited-range
MCONSTS := -fmerge-all-constants
NOFLUSHDEN := -no-ftz
NOPRECDIV := -no-prec-div
NOTRAP := -fno-trapping-math
PRECDIV := -prec-div
RECIPMATH := -freciprocal-math
ROUNDINGMATH := -frounding-math
ROUNDUSR := -fp-port
SIGNALNAN := -fsignaling-nans
SINGLEPRECCONST := -fsingle-precision-constant
SSE := -mfpmath=sse -mtune=native
STDEXPREC := -fexcess-precision=standard
UNSOPTS := -funsafe-math-optimizations
USEFASTM := --use_fast_math

# Collections

OPCODES := O0 O1 O2 O3

# NOTE: gcc disables ASSOCMATH @ O0
SWITCHES_GCC += ASSOCMATH
SWITCHES_GCC += AVX
SWITCHES_GCC += DEFFLAGS
SWITCHES_GCC += FASTEXPREC
SWITCHES_GCC += FINMATH
SWITCHES_GCC += FMAGCC
SWITCHES_GCC += FORTRULES
SWITCHES_GCC += FPCONT
SWITCHES_GCC += FSTORE
SWITCHES_GCC += LIMITEDRANGE
SWITCHES_GCC += MCONSTS
SWITCHES_GCC += NOTRAP
SWITCHES_GCC += RECIPMATH
SWITCHES_GCC += ROUNDINGMATH
SWITCHES_GCC += SIGNALNAN
SWITCHES_GCC += SSE
SWITCHES_GCC += UNSOPTS

#NOTE: Clang not honoring ASSOCMATH (issues warning with 3.9)
# see: https://llvm.org/bugs/show_bug.cgi?id=27372

SWITCHES_CLANG += ASSOCMATH
SWITCHES_CLANG += AVX
SWITCHES_CLANG += DEFFLAGS
SWITCHES_CLANG += FASTEXPREC
SWITCHES_CLANG += FINMATH
SWITCHES_CLANG += FMAGCC
SWITCHES_CLANG += FMAICC
SWITCHES_CLANG += FPCONT
SWITCHES_CLANG += FSTORE
SWITCHES_CLANG += MCONSTS
SWITCHES_CLANG += NOTRAP
SWITCHES_CLANG += RECIPMATH
SWITCHES_CLANG += ROUNDINGMATH
SWITCHES_CLANG += SIGNALNAN
SWITCHES_CLANG += SINGLEPRECCONST
SWITCHES_CLANG += SSE
SWITCHES_CLANG += STDEXPREC
SWITCHES_CLANG += UNSOPTS

SWITCHES_INTEL += AVX
SWITCHES_INTEL += COMPTRANS
SWITCHES_INTEL += DEFFLAGS
SWITCHES_INTEL += DISFMA
SWITCHES_INTEL += ENAFMA
SWITCHES_INTEL += FLUSHDEN
SWITCHES_INTEL += FMAGCC
SWITCHES_INTEL += FMAICC
SWITCHES_INTEL += FPMODDBL
SWITCHES_INTEL += FPMODEXT
SWITCHES_INTEL += FPMODFST1
SWITCHES_INTEL += FPMODFST2
SWITCHES_INTEL += FPMODPRE
SWITCHES_INTEL += FPMODSRC
SWITCHES_INTEL += FPMODSTR
SWITCHES_INTEL += FSTORE
SWITCHES_INTEL += LIMITEDRANGE
SWITCHES_INTEL += MCONSTS
SWITCHES_INTEL += NOFLUSHDEN
SWITCHES_INTEL += NOPRECDIV
SWITCHES_INTEL += PRECDIV
SWITCHES_INTEL += ROUNDINGMATH
SWITCHES_INTEL += ROUNDUSR
SWITCHES_INTEL += SINGLEPRECCONST
SWITCHES_INTEL += SSE
SWITCHES_INTEL += USEFASTM
{opcodes_definitions}

## switches

{switches_definitions}

{compiler_opcodes}

{compiler_switches}

##########################################################
#
Expand Down Expand Up @@ -459,7 +348,7 @@ TARGET_OUTS :=

# @param 1: compiler variable name (e.g. CLANG)
# @param 2: optimization level variable name (e.g. O2)
# @param 3: switches variable name (e.g. USEFASTM)
# @param 3: switches variable name (e.g. --use_fast_math)
define RECURSION_RULE
TARGETS += $$(RESULTS_DIR)/$(strip $1)_$$(HOSTNAME)_$(strip $3)_$(strip $2)

Expand All @@ -482,7 +371,7 @@ endef

$(foreach c, $(COMPILERS), \
$(foreach s, $(SWITCHES_$(strip $c)), \
$(foreach o, $(OPCODES), \
$(foreach o, $(OPCODES_$(strip $c)), \
$(eval $(call RECURSION_RULE, $c, $o, $s)))))
TARGET_OUTS := $(TARGETS:%=%-out)
TARGET_RESULTS := $(TARGET_OUTS:%=%-comparison.csv)
Expand Down
28 changes: 13 additions & 15 deletions documentation/available-compiler-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@ Convenient TOML lists:
* [Clang](#clang)
* [Intel](#intel)

Currently, the configuration file does not specify the flags and optimization
levels to use. We plan to change this in future updates. Consider the
documentation below to relate to future desired features. See
[issue-119](https://github.com/PRUNERS/FLiT/issues/119).

The flags below are still useful to understand because they are the current
flags that are hard-coded into the autogenerated `Makefile`. Below is a
comprehensive list of switches used.


## All Flags

Expand Down Expand Up @@ -73,9 +64,15 @@ For your convenience, here are toml-style lists that can be copied into your

## GCC

**Note:** in some versions of python-toml, there is a parsing bug when a list
has an empty string in the middle. So simply put it at the end without a
comma. This has been fixed in the latest version of python-toml.

You will likely want the empty string in your search space as it represents the
absence of any switches.

```toml
switches = [
'',
switches_list = [
'-fassociative-math',
'-fcx-fortran-rules',
'-fcx-limited-range',
Expand All @@ -92,14 +89,14 @@ switches = [
'-mavx',
'-mavx2 -mfma',
'-mfpmath=sse -mtune=native',
''
]
```

## Clang

```toml
switches = [
'',
switches_list = [
'-fassociative-math',
'-fexcess-precision=fast',
'-fexcess-precision=standard',
Expand All @@ -117,14 +114,14 @@ switches = [
'-mavx',
'-mavx2 -mfma',
'-mfpmath=sse -mtune=native',
''
]
```

## Intel

```toml
switches = [
'',
switches_list = [
'--use_fast_math',
'-fcx-limited-range',
'-ffloat-store',
Expand All @@ -151,6 +148,7 @@ switches = [
'-no-ftz',
'-no-prec-div',
'-prec-div',
''
]
```

Expand Down
Loading