Skip to content

stoflom/build-darktable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Darktable Build Automator

This repository contains a specialized build script, build_darktable.sh, designed to automate the process of updating the darktable source code and building it with a specific, pre-configured set of features and installation parameters.

Purpose

The build_darktable.sh script is a wrapper around the official darktable build.sh script. Its primary goal is to:

  1. Ensure consistency: It uses a predefined set of build options (like --enable-ai and --prefix /opt/darktable) so that every build is reproducible and contains the required features.
  2. Automate updates: It automatically performs a git pull --recurse-submodules to ensure the build is always based on the latest available source code and submodules.
  3. Guaranteed clean builds: It automatically removes any existing build directory to prevent conflicts between previous builds and the current one.
  4. Simplify the workflow: Instead of remembering complex build flags or running multiple commands (pull, then build, then install), a single command handles the entire lifecycle.

Prerequisites

Before running the script, ensure you have the following:

  • Darktable Source: The darktable/ directory must exist in the same folder as the script.
  • Dependencies: The system must have all the necessary dependencies for building darktable (as required by the darktable build.sh script).
  • Permissions: Since the script uses the --sudo flag during installation, you must have sudo privileges on the system.

Usage

To build and install darktable, simply execute the script from the root of this repository:

chmod +x build_darktable.sh
./build_darktable.sh

Build Configuration

The build configuration is defined within the BUILD_OPTIONS array inside build_darktable.sh. You can modify this array to change the installation prefix, build type, or enabled features. To see the available options:

darktable/build.sh --help

Current default options:

  • --prefix /opt/darktable
  • --build-type Release
  • --enable-ai
  • --install
  • --sudo

Running AI models

The options above includes the enable-ai flag which is required to use the new ai denoising, mask generation and upscaling features.

onnxruntime CPU provider

Works out-of-the-box after installing and using the darktable provided onnxruntime. Also works with a self compiled onnxruntime, see beloe.

MIGraphX provider under Fedora44

On Fedora44 the ROCm libraries are not stored under /opt/rocm but under /usr/lib64/rocm. Also when using the latest onnxruntime from MS and the ROCm 7.1.1 libraries I find the darktable src code must be patched to fix this hardcoded path, see my_changes.patch.

If the ROCm, hip and migraphix libraries in Fedora44 repository are installed, onnxruntime can be compiled to use migraphx. (Refer https://github.com/stoflom/onnxruntime). The compiled onnxruntime can then be selected in the preferences->ai submenu.

With onnxruntime and the migraphx execution provider on my AMD Ryzen Pro 9 8945HS ai is sped up about 10 times. However, initially compiling the onnx kernels take a very long time > 40min for the raw denoise. The kernels are compiled when first used a process which makes darktable appear to be frozen. It is better to run darktable from the commandline to initially compile the migraphix kernels so that progress can be monitored.

darktable -d ai

Saving the compiled kernels in a cache is essential for future use (see setenv.sh).

#Set migraphx cache directory
export ORT_MIGRAPHX_MODEL_CACHE_PATH='/home/stoflom/.cache/darktable/ai/amd/migraphx'
# Allow migraphx to compile with all cpu's'
export MIGRAPHX_GPU_COMPILE_PARALLEL=16

When all goes well the kernels (mxr files) will be created under /home/s/.cache/darktable/ai/amd/migraphx

About

Simple script to build darktable from sources

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages