futhark opencl [options…] <program.fut>
futhark opencl translates a Futhark program to C code invoking
OpenCL kernels, and either compiles that C code with a C compiler to
an executable binary program, or produces a
that can be linked with other code. The standard Futhark optimisation
pipeline is used.
futhark opencl uses
-lOpenCL to link (
-framework OpenCL on
macOS). If using
--library, you will need to do the same when
linking the final binary.
Accepts the same options as futhark-c.
The C compiler used to compile the program. Defaults to
Space-separated list of options passed to the C compiler. Defaults to
-O -std=c99if unset.
Generated executables accept the same options as those generated by
futhark-c. For the
-t option, The time taken to perform
device setup or teardown, including writing the input or reading the
result, is not included in the measurement. In particular, this means
that timing starts after all kernels have been compiled and data has
been copied to the device buffers but before setting any kernel
arguments. Timing stops after the kernels are done running, but before
data has been read from the buffers or the buffers have been released.
The following additional options are accepted.
Add an additional build option to the string passed to
clBuildProgram(). Refer to the OpenCL documentation for which options are supported. Be careful - some options can easily result in invalid results.
The default size of OpenCL workgroups that are launched. Capped to the hardware limit if necessary.
The default number of OpenCL workgroups that are launched.
The default parallelism threshold used for comparisons when selecting between code versions generated by incremental flattening. Intuitively, the amount of parallelism needed to saturate the GPU.
The default tile size used when performing two-dimensional tiling (the workgroup size will be the square of the tile size).
- -d, --device=NAME
Use the first OpenCL device whose name contains the given string. The special string
kis an integer, can be used to pick the k-th device, numbered from zero. If used in conjunction with
-p, only the devices from matching platforms are considered.
Don’t run the program, but instead dump the embedded OpenCL program to the indicated file. Useful if you want to see what is actually being executed.
Don’t run the program, but instead dump the compiled version of the embedded OpenCL program to the indicated file. On NVIDIA platforms, this will be PTX code.
Instead of using the embedded OpenCL program, load it from the indicated file.
Load an OpenCL binary from the indicated file.
- -p, --platform=NAME
Use the first OpenCL platform whose name contains the given string. The special string
kis an integer, can be used to pick the k-th platform, numbered from zero.
List all OpenCL devices and platforms available on the system.