futhark cuda [options…] <program.fut>
futhark cuda translates a Futhark program to C code invoking CUDA
kernels, and either compiles that C code with a C compiler to an
executable binary program, or produces a
.c file that
can be linked with other code. The standard Futhark optimisation
pipeline is used.
futhark cuda uses
-lcuda -lcudart -lnvrtc to link. If using
--library, you will need to do the same when linking the final
The generated CUDA code can be called from multiple CPU threads, as it
brackets every API operation with
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
-t option behaves as with
futhark-opencl. For commonality, the options use OpenCL
nomenclature (“group” instead of “thread block”).
The following additional options are accepted.
- -h, --help
Print help text to standard output and exit.
The default size of thread blocks that are launched. Capped to the hardware limit if necessary.
The default number of thread blocks 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).
Don’t run the program, but instead dump the embedded CUDA kernels to the indicated file. Useful if you want to see what is actually being executed.
Don’t run the program, but instead dump the PTX-compiled version of the embedded kernels to the indicated file.
Instead of using the embedded CUDA kernels, load them from the indicated file.
Load PTX code from the indicated file.
- -n, --no-print-result
Do not print the program result.
Add an additional build option to the string passed to NVRTC. Refer to the CUDA documentation for which options are supported. Be careful - some options can easily result in invalid results.
Set a tuning parameter to the given value.
ASSIGNMENTmust be of the form
--print-paramsto see which names are available.
Print all tuning parameters that can be set with
Read size=value assignments from the given file.
If run without
futhark cuda will invoke a C
compiler to compile the generated C program into a binary. This only
works if the C compiler can find the necessary CUDA libraries. On
most systems, CUDA is installed in
/usr/local/cuda, which is
usually not part of the default compiler search path. You may need to
set the following environment variables before running
LIBRARY_PATH=/usr/local/cuda/lib64 LD_LIBRARY_PATH=/usr/local/cuda/lib64/ CPATH=/usr/local/cuda/include
At runtime the generated program must be able to find the CUDA
installation directory, which is normally located at
/usr/local/cuda. If you have CUDA installed elsewhere, set any of
variables to the proper directory.