- Only 64-bit systems are supported
- C++ compilers with C++20 support (e.g., Clang-15, GCC-11, MSVC-17)
- On Linux,
uuid-devis required to build the core libraries and the following libraries are required for the GUI module:libopencv-devlibglfw3-devlibxinerama-devlibxcursor-devlibxi-dev
- XMake 3.0.4+
- Rust 1.64+ (latest stable version is recommended)
- To use the Rust frontend, please see luisa-compute-rs
-
CPU
clang++must be inPATH
-
CUDA
- CUDA 12.0 or higher
- Nvidia graphics cards with appropriate drivers (R535+ for OptiX 8).
- To use hardware ray tracing, RTX-compatible graphics cards are needed.
- To build with GPU compression/decompression support, you may specify
-D LUISA_COMPUTE_DOWNLOAD_NVCOMP=ONto let CMake automatically download the nvCOMP library for you - To build with GPU BC texture compression support, you may download NVTT 3
- On Linux (or when the library is installed to a custom location on Windows), also specify
-D NVTT_DIR=<path-to-nvtt>to the directory containing the NVTT DLLs so CMake could find it.
- On Linux (or when the library is installed to a custom location on Windows), also specify
-
DirectX
- DirectX 12 with ray tracing support
- DirectX-12.1 & Shader Model 6.5 compatible graphics cards with appropriate drivers
-
Metal
- macOS 13 or higher with Metal 3 support
- Apple M1 chips are recommended (older GPUs are probably supported but not tested)
xmake f -m release -c
xmakeAll xmake options declared in ./xmake.lua clearly, you can create ./scripts/options.lua to save a default config for your local environment. An example of options.lua is:
-- for xmake internal arguments
lc_options = {
toolchain = "llvm",
lc_enable_tests = true,
lc_cpu_backend = false,
lc_cuda_backend = true,
lc_dx_backend = false,
}
Options in options.lua can be covered by command-line config, for example:
xmake f --lc_enable_dsl=false --lc_enable_gui=false -c
xmakeNow both "lc_enable_dsl" and "lc_enable_gui" are false values so the DSL and GUI modules will not be built.
You can use ./scripts/write_options.lua to generate a default options.lua:
xmake lua scripts/write_options.luaWhen LuisaCompute is required by other xmake projects, include config/xmake_config.lua and call methods to add includedirs, linkdirs and defines to other projects.
cmake -S . -B <build-dir> -D CMAKE_BUILD_TYPE=Release # if you want a debug build, change to `-D CMAKE_BUILD_TYPE=Debug`; optionally followed by other flags as listed above
cmake --build <build-dir> # when building on Windows using Visual Studio Generators, add `--config=Release` in a release buildAll backends are enabled by default if the corresponding required
APIs/frameworks are detected available. You can override the default
settings by specifying CMake flags manually, in form of -D FLAG=value
behind the first cmake command.
Note: On Windows, please remember to replace the backslashes
\\in the paths with/when passing arguments to CMake.
LUISA_COMPUTE_ENABLE_CUDA: Enable CUDA backend (Default:ON)LUISA_COMPUTE_ENABLE_DX: Enable DirectX backend (Default:ON)LUISA_COMPUTE_ENABLE_METAL: Enable Metal backend (Default:ON)LUISA_COMPUTE_ENABLE_CPU: Enable CPU backend (Default:ON)LUISA_COMPUTE_ENABLE_GUI: Enable GUI display in C++ tests (Default:ON)
Note: You may also edit the
scripts/options.cmakefile (generated bybootstrap.pyor copied by yourself fromscripts/options.cmake.template) to set the default values of these flags. You can still override the default values by specifying the above CMake flags manually.
- LuisaCompute C++ tests are output to the
<build-dir>/binfolder. - All tests accept a command-line argument specifying the backend, which can be chosen from
cuda,dx,metal, andcpu(all in the lower case).