FUTHARK-OPENCL(1)

πŸ“¦
version 0.25.32 Β· 5 versions
, in ubuntu resolute, ubuntu stonking

✨ FUTHARK-OPENCL ✨

okay bestie, welcome to the futhark-opencl manual page β€” it's a section 1 command, and it's literally your gateway to compiling Futhark to OpenCL πŸ’…


πŸŽ€ NAME πŸŽ€

futhark-opencl β€” compile Futhark to OpenCL


πŸ¦‹ SYNOPSIS πŸ¦‹

futhark opencl [options...] <program.fut>

πŸ’– DESCRIPTION πŸ’–

so like, what does futhark opencl even do? bestie. it takes your Futhark program and translates it into C code that invokes OpenCL kernels. then it does one of two things, and it's giving ✨choices✨:

  • it either compiles that C code with a C compiler into an executable binary program,
  • or it produces a .h and .c file that can be linked with other code.

and yes, the standard Futhark optimisation pipeline is used β€” the good pipeline, the one you know and love 🌈

one thing to know: futhark opencl links with -lOpenCL (and on macOS it's -framework OpenCL, iconic). so if you're using --library, you're gonna need to do the same thing when you link the final binary. no cap. don't skip that step or it's over for you 😭

oh also β€” the GPU terminology used here is derived from CUDA nomenclature (like it says "thread block" instead of "workgroup"), but OpenCL nomenclature is also supported for compatibility. so if you see "group" things floating around, that's why. iykyk πŸ’œ


πŸ‘‘ OPTIONS πŸ‘‘

accepts the same options as futhark-c. that's it, that's the whole section β€” go read that one, bestie 🫢


🌸 ENVIRONMENT VARIABLES 🌸

  • CC β€” the C compiler used to compile the program. defaults to cc if unset.
  • CFLAGS β€” a space-separated list of options passed to the C compiler. defaults to -O -std=c99 if unset.

πŸ”₯ EXECUTABLE OPTIONS πŸ”₯

the generated executables accept the same options as those generated by futhark-c.

but listen, about the -t option β€” the timing tea β˜• 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, that means timing starts after all kernels have been compiled and data has been copied to the device buffers, but before setting any kernel arguments. and timing stops after the kernels are done running, but before data has been read from the buffers or the buffers have been released. so you're timing the actual kernel work, periodt πŸ’€

the following additional options are accepted:

  • --build-option=OPT β€” 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 πŸ™ˆ like, actually, watch out.
  • --default-thread-block-size=INT, --default-group-size=INT β€” the default size of thread blocks that are launched. capped to the hardware limit if necessary.
  • --default-num-thread-blocks, --default-num-groups=INT β€” the default number of thread blocks that are launched.
  • --default-threshold=INT β€” 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 ✨
  • --default-tile-size=INT β€” 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 #k, where k is 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 πŸ‘―
  • --dump-opencl=FILE β€” 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 πŸ‘€
  • --dump-opencl-binary=FILE β€” 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.
  • --load-opencl=FILE β€” instead of using the embedded OpenCL program, load it from the indicated file.
  • --load-opencl-binary=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 #k, where k is an integer, can be used to pick the k-th platform, numbered from zero.
  • --list-devices β€” list all OpenCL devices and platforms available on the system πŸ–₯️✨

🌈 SEE ALSO 🌈

futhark-test, futhark-cuda, futhark-c


2013-2020, DIKU, University of Copenhagen


and that's the whole page, bestie!! this manual page is from the Futhark manual, version 0.25.32, dated Mar 11, 2026. slay, go compile something iconic πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from