FUTHARK-CUDA(1)
π futhark-cuda β the CUDA-flavored Futhark compiler, bestie π
okay so like. this is futhark-cuda, bestie. it's part of the Futhark fam and it compiles your Futhark programs to CUDA π
β¨ SYNOPSIS β¨
futhark cuda [options...] <program.fut>
πΈ DESCRIPTION πΈ
no cap</p>, futhark cuda translates a Futhark program into C code that calls CUDA kernels β¨ and then it does one of two iconic things:
- it compiles that C code with a C compiler into a whole executable binary, or
- it hands you a
.hand a.cfile that you can link with your other code π«Ά
and yes it runs the standard Futhark optimisation pipeline, because obviously π
ok and listen: futhark cuda links with -lcuda -lcudart -lnvrtc. so if you're using --library, you have to do the same thing yourself when you link the final binary. like, that's on you now bestie π
the generated CUDA code is actually built different β it can be called from multiple CPU threads at once, because it brackets every single API operation with cuCtxPushCurrent() and cuCtxPopCurrent(). slay π
π OPTIONS π
- Accepts the same options as
futhark-cβ literally identical. same options, same energy π
π ENVIRONMENT VARIABLES π
CCβ the C compiler used to compile the program. defaults toccif it's unset β¨CFLAGSβ a space-separated list of options passed to the C compiler. defaults to-O -std=c99if unset πΈ
π¦ EXECUTABLE OPTIONS π¦
the executables you generate accept the same options as the ones generated by futhark-c π and also β heads up β the -t option behaves exactly as it does with futhark-opencl π«
and then there's MORE. the following extra options are accepted too π
-h,--helpβ print help text to standard output and exit. periodt π--default-thread-block-size=INTβ the default size of the thread blocks that get launched. it gets capped to the hardware limit if it has to β¨--default-num-thread-blocks=INTβ the default number of thread blocks that get launched π--default-threshold=INTβ the default parallelism threshold used for comparisons when it's picking between code versions generated by incremental flattening. intuitively? it's the amount of parallelism you need to saturate the GPU π₯--default-tile-size=INTβ the default tile size used when doing two-dimensional tiling. (the workgroup size is gonna be the square of the tile size, jsyk π)--dump-cuda=FILEβ doesn't run the program, it just dumps the embedded CUDA kernels into the file you name. super useful if you wanna see what's actually being executed π--dump-ptx=FILEβ again, doesn't run anything β it dumps the PTX-compiled version of your embedded kernels into the indicated file π--load-cuda=FILEβ instead of using the embedded CUDA kernels, load them from the file you indicate πΈ--load-ptx=FILEβ load PTX code from the indicated file β¨--nvrtc-option=OPTβ adds another build option to the string passed to NVRTC. go check the CUDA docs for which options are supported, bestie. and be careful β some options can very easily get you invalid results π
π ENVIRONMENT π
if you run it without --library, futhark cuda will invoke a C compiler to compile the generated C program into a binary. now β this only works if the C compiler can actually find the CUDA libraries it needs π
on most systems, CUDA lives in /usr/local/cuda, which is usually not part of the default compiler search path. so you might need to set these environment variables before running futhark cuda:
LIBRARY_PATH=/usr/local/cuda/lib64
LD_LIBRARY_PATH=/usr/local/cuda/lib64/
CPATH=/usr/local/cuda/include
and at runtime, your generated program has to be able to find the CUDA installation directory, which is normally at /usr/local/cuda π if you have CUDA installed somewhere else, set any of the CUDA_HOME, CUDA_ROOT, or CUDA_PATH environment variables to the proper directory π«Ά
π SEE ALSO π
futhark-openclπ
β Copyright β
2013-2020, DIKU, University of Copenhagen
ok that's the whole page bestie, you ate that π
this was FUTHARK-CUDA(1), version 0.25.32, dated Mar 11, 2026, from the Futhark fam β now go compile something iconic, mwah πβ¨π¦π
π¦ where this page comes from
- ubuntu resolute: futhark 0.25.32-3build1 Β· ISC
- ubuntu stonking: futhark 0.25.32-3build1 Β· ISC
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms