Skip to content

Plotman

Guy Davis edited this page Sep 5, 2023 · 98 revisions

Plotman provides the background loop that launches plotting jobs using your preferred plotter (Bladebit, Madmax, or Chiapos). Machinaris uses an active fork of Plotman with many enhancements including scheduling, replotting, concurrent plot archiving, plus GPU plotting support with Gigahorse and Bladebit . To learn about all the different plotting methods and their requirements, please see this helpful comparison.

Table of Contents

NOTE: On a new install of Machinaris, Plotman will plot solo plots. If you want to ever pool using those plots, it is strongly recommended that you plot portable plots (aka NFT plots). This requires a few extra steps so is not the default, but you should do this for flexibility around pooling in the future!

Plotman Config

Visit the Settings | Plotting page to view and edit the Plotman configuration file via the Machinaris WebUI as shown here:

Config

Temporary Storage

This tells Plotman the directory to use for fast temporary plotting storage. Assuming that you took the default in-container path of /plotting, then the Plotman settings already point there.

...
directories:
    ...
    tmp:
       - /plotting
 ...

For more than one temporary plotting folder, see these config directions. As well, it is possible to configure a path to a second-stage (optional) tmp2 plotting space, possibly as a ram-disk.

WARNING: By default, if starting up Plotman on the Plotting page, and no plotting jobs are present within Machinaris, then any *.tmp files in your temporary folder paths WILL BE DELETED. Therefore, do not point other tools/plotters at the same temporary storage path. Machinaris and Plotman expect exclusive use of your temporary storage path. If you must share your temporary storage, create two separate folders on it, allowing Machinaris exlusive use of one folder. This applies to plotting in different Machinaris containers at the same time as well, for example both Chia and Chives.

Destination Storage

This tells Plotman the directory to use for completed plot storage. Assuming that you took the default in-container path of /plots1, then the Plotman settings already point there.

...
directories:
    ...
    dst:
       - /plots1
 ...

Example configuration page view:

Config

For more than one completed plots folder, see these config directions.

  • tmpdir_stagger_phase_major: 5 -> Major phase # to wait before starting next set of plots. 5th phase is at completion of last plot.
  • tmpdir_stagger_phase_minor: 0 -> Minor phase # to wait before starting next set of plots. 5:0 phase is at completion of last plot.
  • tmpdir_stagger_phase_limit: 1 -> Max # of plots per temp dir in the stagger phase (above) allowed.
  • tmpdir_max_jobs: 1 -> Don't run more than this many jobs at a time on a single temp dir.
  • global_max_jobs: 1 -> Don't run more than this many jobs at a time in total.

If you hardware supports it, you can increase the concurrent job count, however you're probably better to allocate more threads to Bladebit or Madmax and have them complete a single plot faster than run multiple slow ones at that same time. As well, you can set a global_stagger_m which is the minimum time in minutes to wait after starting one plot, before starting the next.

NOTE: If you comment out the dst section, then Plotman will use your tmp as dst. This is useful if you want to go from the plot on temporary storage, directly to archving it, without the intermediate dst copy step.

Plotting

Machinaris supports three plotting backends:

  1. The Bladebit plotter; plots either using a GPU, or all in-memory, or to fast SSD disk with RAM caching.
  2. The Madmax plotter (also for Gigahorse); also GPU, all in-memory, or to fast SSD disk with RAM caching.
  3. The Chiapos plotter; useless and slow. Don't bother with this original plotter unless you lack both RAM and SSDs.

Under the plotting section in the Settings | Plotting page, the type attribute can be either the default bladebit or optionally madmax. For both the bladebit and madmax plotters, you are aiming for sequential plotting using as many cores as possible on each plotting job. You may also enable replotting settings to migrate from old to new plots over time.

Archiving

Plotman supports optional archiving (transfer of plot to final destination) to either:

  1. A set of locally mounted drives on the plotting machine OR
  2. Transfered to a set of drives on another machine running rsync server.

After configuring archiving on the Settings | Plotting page (details below), visit the Plotting | Transfers page, select the drop-down for your Worker, and choose 'Start Archiving'. As plots are finished, the Archiver will move them to to their final drives (local or remote) for harvesting:

Config

As an enhancement over the original Plotman, the version bundled with Machinaris supports transferring multiple plots at the same time. This is a critical feature now that plotting is so much faster than back when Chia launched in early 2021.

Local Archiving

To simply distribute completed plots to final folders attached directly to the local machine, you first need to map each drive into the container:

        environment:
            ...
            - plots_dir=/plots1:/plots2:/plots3
        volumes: 
            ...
            - "/mnt/drives/disk1:/plots1" 
            - "/mnt/drives/disk2:/plots2" 
            - "/mnt/drives/disk3:/plots3" 

With your final plots volume mountpoints as /plots* folders within the Machinaris container, you can then tell Plotman to Archive locally as follows:

archiving:
        target: local_rsync
        env:
                 site_root: /
                 site_path_filter: plots

To be clear, Plotman will look to / inside the Machinaris container, list all folders, and include only those with the word plots in their name, for use as targets to store plot files.

To validate this configuration, save the Settings | Plotting page, and view the configured directories that Plotman will use.

Config

Finally, to start Plotman Archiving within Machinaris, visit the Plotting | Transfers page, select the drop-down for your Worker, and choose 'Start Archiving'.

For more background, see the Plotman wiki.

Remote Archiving

To transfer completed plots from your plotter to your farmer/harvester, first configure your farmer/harvester host to run an rsync daemon, accessed via SSH. On this Linux system holding plots, install SSH daemon and grant passwordless login (authorized_keys), ideally for root but regular users can work with correct permissions.

Use this /etc/rsyncd.conf for a system with different disks mounted at under /mnt, such as /mnt/plots1, /mnt/plots2, etc...

uid             = root
gid             = root
use chroot      = no
max connections = 4
pid file        = /var/run/rsyncd.pid
timeout         = 600
port            = 12000

[plots]
    path = /mnt
    comment = disks
    read only = FALSE

Once configured, start the rsync daemon:

systemctl start rsync
systemctl enable rsync
  1. When launching Machinaris on your plotter system, import the SSH private key for your plot storage server above.

For example, you could run Machinaris pointing to your id_rsa private key as follows:

/home/USER/.ssh/id_rsa:/id_rsa:ro

On Windows:

C:\Users\USER\.ssh\id_rsa:/id_rsa:ro

On Macintosh:

/Users/USER/.ssh/id_rsa:/id_rsa:ro

Be sure to change the USER name. This will mount your id_rsa private key file in the container read-only, configuring the local SSH to use it when connecting out to your rsync server, for the purpose of transferring new plots.

To verify that you can SSH from inside the plotter's container to your farmer/harvester host, try this from the plotter:

docker exec -it machinaris bash
ssh root@IP_OF_FARMER 'df -aBK | grep /mnt'
  1. Then configure Plotman for archiving on the Plotting | Settings page, by replacing the default archiving setting:
archiving:
        target: rsyncd
        env:
                site_root: /mnt
                site_path_filter: plots
                user: root
                host: SERVERNAME
                rsync_port: 12000
                site: plots
                options: --preallocate --bwlimit=100000 --remove-source-files --skip-compress plot --whole-file

To verify that Plotman on the plotter can see the target disks, via rsync, on the farmer/harvester, view the displayed directories on the Settings | Plotting page. Here's an example:

Config

  1. Finally, to start Plotman Archiving within Machinaris, visit the Plotting | Transfers page, select the drop-down for your Worker, and choose 'Start Archiving'.

At the command-line, the 'Start Archiving' web action is equivalent to:

docker exec -it machinaris bash
plotman archive

Running Plotman interactively, shows the first archive target found with adequate space is used: Plotman Interactive

Here's an example showing the transfer of a plot automatically: Plotman Archive

More Details

Additional details on Plotman configuration are available at that project's wiki.

Scheduling

Optionally, you may schedule the start and stop of the plotting manager to save on electricity (off-peak), avoid back-ups, minimize fan noise, etc. Each start and stop schedule is a cron entry.

Scheduling

Autoplot

After you have configured your plotting with Machinaris, you can add the AUTO_PLOT environment variable, to the environment: section, to have plotting begin automatically each time the container is started:

        environment:
            ...
            - AUTO_PLOT=true
            - AUTO_ARCHIVE=true
            ...

Don't enable this unless you have fully configured and thoroughly validated a working plotting configuration above. Optionally, you can also enable plotman archive to start on container launch with AUTO_ARCHIVE set.

Plotting View

Plotting

The Plotting page shows the plotman status output including the following columns:

  • plot_id: The 8-character unique prefix identifying the plot being created.
  • k: The k-size determines the end size of the completed plot. Default is 32.
  • lvl: The compression level applied to the plot. Default is zero for no-compression (original plot size).
  • tmp: The in-container path to the temporary plotting space being used.
  • dst: The in-container path to the final destination of the completed plot.
  • wall: The time (HH:MM) on the wall spent so far by the plotting process, as recorded by the container OS.
  • phase: The major:minor plotting phase of the job. Ranges from 1:1 to 4:0. Spends most time in phases #1 and #3.
  • size: Current size of the temporary plotting files for a single plotting job. Varies by phase, but can hit 267 GB or so for a k=32 plot.
  • pid: Process identifier which uniquely identifies the plotting job process in the container OS.
  • stat: Status of job: RUN (running), STP (stopped), DSK (disk wait), SLP (sleeping), or the status of OS process.
  • mem: Memory currently used by the plotting job process.
  • user: Time spent by process executing its own code.
  • sys: Time spent by the process executing OS kernel code.
  • io: Time spent by the process waiting on disk input/output.

Speed

Machinaris will also track the time taken for each plot, charting your historical progress and allowing you to easily see the impact of fine-tuning your plotting efforts. Charts are shown for each k-size you plot (31, 32, etc)

Troubleshooting

First, off ensure you are running the latest version of Machinaris. If, upon starting a plotting run from the Plotting page, you do not see a running plot job (chia, madmax, or bladebit) after a minute or so, then it is possible the plotter is immediately erroring out on launch. Reasons are varied and include:

  • Failure to write to either the tmp, tmp2 (optional), or dst (optional) paths.
  • Lack of memory resources
  • Invalid plotting configuration, such as missing farmer_pk. Or leaving both pool_pk and pool_contract_address enabled at same time... pick one. Or invalid configuration format, etc... See Settings | Plotting page and pay attention to error message when you click save.
  • Failure to contact the remote plotting system. See Workers page for status.

To find issues on the plotter system, please try manual plotting on your plotter system (might be your fullnode):

docker exec -it machinaris bash
plotman status
plotman dirs
plotman plot
... leave running while testing ...
Control-C to quit the plot launching loop

In another shell on the same system, monitor the Plotman job log:

docker exec -it machinaris bash
tail -f /root/.chia/plotman/logs/plotman.log

In another shell on the same system, monitor job-log created by bladebit or madmax plotters:

docker exec -it machinaris bash
cd /root/.chia/plotman/logs
tail -n 200 -f $(ls -1tr | tail -n 1)

This approach completely removes the Machinaris WebUI from the mix, leaving only Plotman invoking your plotter. Hopefully the Plotman log will make clear the issue you are encountering. When you know the cause, you can correct it. If not clear how to address, please ask for help in the Discord.

Clone this wiki locally