Skip to content

Bladebit

Guy Davis edited this page Jan 23, 2023 · 50 revisions

The Bladebit plotter offers two modes:

  • ramplot: 416 GiB of RAM are required with the entire plot built quickly in system memory.
  • diskplot: A minimum of 4 GiB of RAM is required for caching. About 480 GiB of total temporary space on an SSD is required.

Machinaris uses an enhanced Plotman plotting manager to interface with plotting backends: bladebit, chia and madmax. Machinaris provides a full WebUI with plotting management, monitoring and remote control.

Config

Here is a good starting point for Plotman config when using bladebit. Start with a single Bladebit plot allowed at one time, dial up threads and buckets to match your hardware:

# Learn more about Plotman at https://github.com/ericaltendorf/plotman
# https://github.com/ericaltendorf/plotman/wiki/Configuration#versions
version: [2]

logging:
        # DO NOT CHANGE THIS IN-CONTAINER PATH USED BY MACHINARIS!
        plots: /root/.chia/plotman/logs

user_interface:
        use_stty_size: False

commands:
        interactive:
                autostart_plotting: False
                autostart_archiving: False
  
# Where to plot and log.
directories:

        # One or more directories to use as tmp dirs for plotting.  The
        # scheduler will use all of them and distribute jobs among them.
        # It assumes that IO is independent for each one (i.e., that each
        # one is on a different physical device).
        #
        # If multiple directories share a common prefix, reports will
        # abbreviate and show just the uniquely identifying suffix.
        # REMEMBER ALL PATHS ARE IN-CONTAINER, THEY MAP TO HOST PATHS
        tmp:
                - /plotting

        # Optional: tmp2 directory.  If specified, will be passed to
        # the chia and madmax plotters as the '-2' param.
        #tmp2: /plotting2

        # One or more directories; the scheduler will use all of them.
        # These again are presumed to be on independent physical devices,
        # so writes (plot jobs) and reads (archivals) can be scheduled
        # to minimize IO contention.
        # REMEMBER ALL PATHS ARE IN-CONTAINER, THEY MAP TO HOST PATHS
        dst:
                - /plots1

# See: https://github.com/guydavis/machinaris/wiki/Plotman#archiving
#archiving:
        #target: local_rsync
        #env:
                #site_root: /
                #site_path_filter: plots

# Plotting scheduling parameters
scheduling:
        # Run a job on a particular temp dir only if the number of existing jobs
        # before tmpdir_stagger_phase_major tmpdir_stagger_phase_minor
        # is less than tmpdir_stagger_phase_limit.
        # Phase major corresponds to the plot phase, phase minor corresponds to
        # the table or table pair in sequence, phase limit corresponds to
        # the number of plots allowed before [phase major, phase minor]
        tmpdir_stagger_phase_major: 5
        tmpdir_stagger_phase_minor: 0
        # Optional: default is 1
        tmpdir_stagger_phase_limit: 1

        # Don't run more than this many jobs at a time on a single temp dir.
        # Increase for staggered plotting by chia, leave at 1 for madmax sequential plotting
        tmpdir_max_jobs: 1

        # Don't run more than this many jobs at a time in total.
        # Increase for staggered plotting by chia, leave at 1 for madmax sequential plotting
        global_max_jobs: 1 

        # Don't run any jobs (across all temp dirs) more often than this, in minutes.
        global_stagger_m: 30

        # How often the daemon wakes to consider starting a new plot job, in seconds.
        polling_time_s: 20

        # Optional: Allows overriding some characteristics of certain tmp
        # directories. This contains a map of tmp directory names to
        # attributes. If a tmp directory and attribute is not listed here,
        # it uses the default attribute setting from the main configuration.
        #
        # Currently support override parameters:
        #     - tmpdir_max_jobs
        #tmp_overrides:
                # In this example, /plotting3 is larger than the other tmp
                # dirs and it can hold more plots than the default.
                #/plotting3:
                #        tmpdir_max_jobs: 5

# Configure the plotter.  See: https://github.com/guydavis/machinaris/wiki/Plotman#plotting
plotting:
        # See Keys page, for 'Farmer public key' value
        farmer_pk: REPLACE_WITH_THE_REAL_VALUE
        # ONLY FOR OLD SOLO PLOTS, COMMENT OUT IF PORTABLE PLOTTING!!!
        pool_pk: REPLACE_WITH_THE_REAL_VALUE
        # See 'Settings | Pools' page, for 'P2 singleton address' value, UNCOMMENT IF PORTABLE PLOTTING!!!
        #pool_contract_address: REPLACE_WITH_THE_REAL_VALUE

        # If you enable 'chia', plot in *parallel* with higher tmpdir_max_jobs and global_max_jobs
        # If you enable 'bladebit' or 'madmax', plot in *sequence* with very low tmpdir_max_jobs and global_max_jobs
        type: bladebit

        bladebit:
                # BladeBit plotter; see https://github.com/guydavis/machinaris/wiki/Bladebit
                threads: 2            # Threads per job
                no_numa: true         # Whether to disable NUMA memory support or not
                diskplot: true        # Whether to plot to tmp1 (and tmp2) disks or only RAM (false)
                diskplot_cache:   4GB # If diskplot, amount of RAM to allocate to caching disk writes

diskplot

As seen above, the diskplot setting is on by default so be sure to set tmp, optionally the tmp2, disk paths. As well, you can optionally enable the RAM cache to direct more of the plotting I/O to memory. Anything helps, up to about 192 GB at most.

Alternatively, you can disable 'diskplot' mode (set to false) to run in 'ramplot' mode which requires 416 GIB of available memory for the plotter.

WARNING: Do not try to run bladebit with as many concurrent plots (tmpdir_max_jobs and global_max_jobs) as the official chia plotter unless you have more memory than the NSA!

Advanced Usage

GPU Plotting

In early 2023, Bladebit will offer plotting using a GPU, rather then just CPU. Still unreleased, this GPU plotting will probably work on Linux and Unraid, but probably not on Windows (due to Docker limitations). Please drop into the Machinaris Discord to share tips and tricks.

Nvidia

You'll need the Nvidia Driver Runtime. On Unraid, just install the Nvidia Driver plugin.

Then please add the following to your docker-compose.yml. Extend the existing environment section

    environment:
        - OPENCL_GPU=nvidia
        - NVIDIA_VISIBLE_DEVICES=0
        - NVIDIA_DRIVER_CAPABILITIES=compute,utility

Then add a new runtime line, (at same level as environment):

    runtime: nvidia

OR for Unraid, using the Docker admin tab, edit the Machinaris-MMX config, create 3 new Variables (shown) and add --runtime=nvidia to the "Extra Parameters" field.

Ideally you can target the device by position or GUID, which you can later override in Unraid Docker Configuration or compose ENVs,

-e NVIDIA_VISIBLE_DEVICES=0 or -e NVIDIA_VISIBLE_DEVICES=GPU-a8b96998-xxxx-xxxx

Further explained here.

AMD

For AMD GPUs, as per this tutorial (AMD section part-way down), please add the following to your docker-compose.yml. Extend the existing environment section

    environment:
        - OPENCL_GPU=amd
        - ROC_ENABLE_PRE_VEGA=1

and add the following devices section at the same level as environment:

    devices:
        - "/dev/kfd:/dev/kfd"
        - "/dev/dri/:/dev/dri/"

Intel iGPU

Extend the existing environment section

    environment:
        - OPENCL_GPU=intel

and add the following devices section at the same level as environment:

    devices:
        - "/dev/dri/:/dev/dri/"

On the host machine, add the user that runs the container to the "video" and "render" groups.

sudo adduser $USER video
sudo adduser $USER render

To see if it worked, after the container starts, connect to it and type "clinfo"

docker exec -it machinaris-mmx bash
clinfo

You should see something like:

root@localhost:/chia-blockchain# clinfo 
Number of platforms                               1
  Platform Name                                   Intel(R) OpenCL HD Graphics
  Platform Vendor                                 Intel(R) Corporation
  Platform Version                                OpenCL 3.0 
  Platform Profile                                FULL_PROFILE

Disable Building

Bladebit is built when the container launches, so if you want to disable plotter build for fullnodes & plotters (not happening on harvesters regardless of blockchain), then you can set env var: bladebit_skip_build with value true.

Clone this wiki locally