File: futhark-script.rst

package info (click to toggle)
haskell-futhark 0.25.32-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 18,236 kB
  • sloc: haskell: 100,484; ansic: 12,100; python: 3,440; yacc: 785; sh: 561; javascript: 558; lisp: 399; makefile: 277
file content (106 lines) | stat: -rw-r--r-- 2,772 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
.. role:: ref(emphasis)

.. _futhark-script(1):

================
futhark-script
================

SYNOPSIS
========

futhark script [options...] program [expression]

DESCRIPTION
===========

The command ``futhark script foo.fut expr`` will compile ``foo.fut``,
run the provided FutharkScript expression ``expr``, and finally print
the result to stdout. It is essentially a simpler way to access the
evaluation facilities of :ref:`futhark-literate(1)`, and provides the
same FutharkScript facilities, with a few additional built-in
procedures documented below.

If the provided program does not have a ``.fut`` extension, it is
assumed to be a previously compiled server-mode program, and simply
run directly.

When ``-e`` and ``-f`` are used, the expressions are run in the order
provided, and only the value of the last expression is printed. This
implies multiple uses of these options is only useful when they invoke
procedures with side effects.

OPTIONS
=======

--backend=name

  The backend used when compiling Futhark programs (without leading
  ``futhark``, e.g. just ``opencl``).  Defaults to ``c``.

-b, --binary

  Produce output in the binary data format. Fails if the value is not
  a primitive or array of primitives.

-D, --debug

  Pass ``-D`` to the executable and show debug prints.

-e, --expression=EXP

  Evaluate this FutharkScript expression. Expressions are run in the
  order provided.

--futhark=program

  The program used to perform operations (eg. compilation). Defaults
  to the binary running ``futhark script`` itself.

-f, --file=FILe

  Read and evaluate FutharkScript expression from this file.
  Expressions are run in the order provided.

-L, --log

  Pass ``-L`` to the executable and show debug prints.

--pass-option=opt

  Pass an option to benchmark programs that are being run.

--pass-compiler-option=opt

  Pass an extra option to the compiler when compiling the programs.

--skip-compilation

  Do not run the compiler, and instead assume that the program has
  already been compiled.  Use with caution.

-v, --verbose

  Print verbose information on stderr about directives as they are
  executing.  This is also needed to see ``#[trace]`` output.

ADDITIONAL BUILTINS
===================

* ``$store "file" v`` store the value *v* (which must be a primitive
  or an array) as a binary value in the given file.

BUGS
====

FutharkScript expressions can only refer to names defined in the file
passed to ``futhark script``, not any names in imported files.

If the result of the expression does not have an external
representation (e.g. is an array of tuples), the value that is printed
is misleading and somewhat nonsensical.

SEE ALSO
========

:ref:`futhark-test(1)`, :ref:`futhark-bench(1)`, :ref:`futhark-literate(1)`