Skip to content

Commit

Permalink
Make --backend and --outfmt options be consistently lowercase.
Browse files Browse the repository at this point in the history
It seems standard for CLIs to use lowercase option names.

Changed option names:

- `--backend llvm` (was LLVM)
- `--backend llvm-cuda` (was LLVM-CUDA)
- `--backend llvm-mc` (was LLVM-MC)

- `--outfmt html` (was HTML)
- `--outfmt json` (was JSON)
  • Loading branch information
dan-zheng committed Jan 8, 2021
1 parent 0451c7c commit 37e4f50
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions benchmarks/dexbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ def restore_machine():
def run_benches(lang, backend):
if lang == "dex":
if backend == "CPU":
backend_args = ["--backend", "LLVM-MC"]
backend_args = ["--backend", "llvm-mc"]
env = {}
elif backend == "GPU":
backend_args = ["--backend", "LLVM-CUDA"]
backend_args = ["--backend", "llvm-cuda"]
env = {"CUDA_LAUNCH_BLOCKING":"1"}
else:
raise Exception
command = (["stack", "exec", "dex", "--"] + backend_args +
["script", "--outfmt", "JSON", dex_microbench_file])
["script", "--outfmt", "json", dex_microbench_file])
elif lang == "jax":
if backend == "CPU":
env = {"CUDA_VISIBLE_DEVICES":""}
Expand Down
10 changes: 5 additions & 5 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ update-examples-%: examples/%.dx build

run-gpu-tests: export DEX_ALLOC_CONTRACTIONS=0
run-gpu-tests: tests/gpu-tests.dx build
misc/check-quine $< $(dex) --backend LLVM-CUDA script --allow-errors
misc/check-quine $< $(dex) --backend llvm-cuda script --allow-errors

update-gpu-tests: export DEX_ALLOW_CONTRACTIONS=0
update-gpu-tests: tests/gpu-tests.dx build
$(dex) --backend LLVM-CUDA script --allow-errors $< > $<.tmp
$(dex) --backend llvm-cuda script --allow-errors $< > $<.tmp
mv $<.tmp $<

uexpr-tests:
Expand Down Expand Up @@ -175,15 +175,15 @@ docs: doc-prelude $(doc-example-names) $(doc-lib-names) $(slow-docs)

doc-prelude: lib/prelude.dx
mkdir -p doc
$(dex) --prelude /dev/null script lib/prelude.dx --outfmt HTML > doc/prelude.html
$(dex) --prelude /dev/null script lib/prelude.dx --outfmt html > doc/prelude.html

doc/examples/%.html: examples/%.dx
mkdir -p doc/examples
$(dex) script $^ --outfmt HTML > $@
$(dex) script $^ --outfmt html > $@

doc/lib/%.html: lib/%.dx
mkdir -p doc/lib
$(dex) script $^ --outfmt HTML > $@
$(dex) script $^ --outfmt html > $@

clean:
$(STACK) clean
Expand Down
14 changes: 7 additions & 7 deletions src/dex.hs
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ parseMode = subparser $
<*> option
(optionList [ ("literate" , TextDoc)
, ("result-only", ResultOnly)
, ("HTML" , HTMLDoc)
, ("JSON" , JSONDoc)])
, ("html" , HTMLDoc)
, ("json" , JSONDoc)])
(long "outfmt" <> value TextDoc <>
helpOption "Output format" "literate (default) | result-only | HTML | JSON")
helpOption "Output format" "literate (default) | result-only | html | json")
<*> flag HaltOnErr ContinueOnErr (
long "allow-errors"
<> help "Evaluate programs containing non-fatal type errors")))
Expand All @@ -177,12 +177,12 @@ optionList opts = eitherReader \s -> case lookup s opts of
parseEvalOpts :: Parser EvalConfig
parseEvalOpts = EvalConfig
<$> option
(optionList [ ("LLVM", LLVM)
, ("LLVM-CUDA", LLVMCUDA)
, ("LLVM-MC", LLVMMC)
(optionList [ ("llvm", LLVM)
, ("llvm-cuda", LLVMCUDA)
, ("llvm-mc", LLVMMC)
, ("interpreter", Interpreter)])
(long "backend" <> value LLVM <>
helpOption "Backend" "LLVM (default) | LLVM-CUDA | LLVM-MC | interpreter")
helpOption "Backend" "llvm (default) | llvm-cuda | llvm-mc | interpreter")
<*> optional (strOption $ long "logto"
<> metavar "FILE"
<> help "File to log to" <> showDefault)
Expand Down

0 comments on commit 37e4f50

Please sign in to comment.