Skip to content

Instantly share code, notes, and snippets.

@Ganbin
Last active February 11, 2024 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ganbin/27027c4f16846dfa9de9e40295ccec50 to your computer and use it in GitHub Desktop.
Save Ganbin/27027c4f16846dfa9de9e40295ccec50 to your computer and use it in GitHub Desktop.
Chia GPU Farming: Underclocking GPU

Chia GPU Farming: Underclocking GPU

This document aims to compile the knowledge I acquired while optimizing my GPU's power efficiency for farming compressed plots in Chia.

My Configuration

Here is my setup:

  • Ubuntu
  • AMD Ryzen 9 5950X (AM4, 3.40GHz, 16-Core)
  • 1x RTX 3070
  • 128 GB RAM
  • 692 raw TiB
  • 896 effective TiB

This provides context for my journey. While you'll need to adjust settings for your own configuration, I'll outline the steps I've taken to help guide you.

Having limited experience with ETH GPU mining, I've already experimented with over/underclocking to optimize performance while reducing energy consumption. However, unlike GPU mining, there are no tutorials available for Chia GPU farming, making experimentation crucial. Every farm is different so it is hard to share numbers, even for same GPU models.

Basics

Our goal is to reduce GPU power consumption by lowering memory and core clocks. Initially, we aim to decrease the memory clock as much as possible and then adjust the core clock accordingly. However, determining the ideal values can be challenging.

It's crucial to ensure that underclocking doesn't significantly impact harvester proof lookup times, as this could result in missed farming opportunities. Chia's debug logs issue a warning if lookup times exceed 8 seconds, so we aim to keep them below this threshold.

Know your GPU

To determine suitable values for your GPU, run the following command:

nvidia-smi --query-supported-clocks=gpu_name,memory,graphics --format=csv

This command provides a list of supported memory and core clock configurations for your GPU.

I don't really know why but on my RTX 3070 the memory clock frequenzy can only be 7001,6801,5001,810,405. I would have loved to try something between 5001 and 810. 5001 is a good value on my side but 810 was too low.

Before You Begin

Before adjusting clock settings, I recommend installing and running nvtop for real-time monitoring of GPU usage, power, and fan speed. This helps visualize the impact of different clock settings.

What you want is to have some gap between the peaks so that means the GPU is not underwater.

Monitor the "Harvester Latency" to ensure it stays below 8 seconds. You can use tools like the Chia farming Dashboard or the command:

grep "This should be below 8" ~/.chia/mainnet/log/debug.log

Let's Experiment!

If you're unsure about the values to use, experimentation is key!

To modify core and memory clock, use the command:

-ac, --applications-clocks=MEM_CLOCK,GRAPHICS_CLOCK

Specifies maximum <memory,graphics> clocks as a pair (e.g. 2000,800) that defines GPU's speed while running applications on a GPU. Supported on Maxwell-based GeForce and from the Kepler+ family in Tesla/Quadro/Titan devices. Requires root.

Let's try:

nvidia-smi -ac 5001,990

Then I got:

Setting applications clocks is not supported for GPU

According to some, this is because I access my GPU via ssh. But according to this post:

Setting application clocks is a feature only available on select gpus, mainly Quadros/Teslas, rarely any Geforce type cards.

But thanksfully we have other commands:

-lgc, --lock-gpu-clocks=MIN_GPU_CLOCK,MAX_GPU_CLOCK

and

-lmc, --lock-memory-clocks=MIN_MEMORY_CLOCK,MAX_MEMORY_CLOCK

The differences with -ac? No idea, but lets go on.

Now you can do something like:

sudo nvidia-smi --lock-gpu-clocks=405,990
sudo nvidia-smi --lock-memory-clocks=405,5001

These values work well for my configuration; adjust them according to your needs.

Other Considerations

After optimizing clock settings, I managed to reduce power consumption by approximately 50W without significantly impacting lookup times. As I didn't see higher power cunsumption than 80W so I capped power consumption at 140W using:

sudo nvidia-smi -pl 140

But the power draw during idle time is still at ~40W (it was ~65W before underclocking). Someone on discord says:

My GPU has high idle power consumption when farming compressed plots. What can I do to lower it?

Try enabling persistence mode by running this command in Linux:

sudo nvidia-smi -pm 1

If it's working, you should see power consumption around 10W.

For me it didn't work but I would love to be able to reduce the power while idle.

My Results

Power Before After
Idle ~65W 40W
Peak ~120W ~68W

Reset values

In order to reset your values, use :

sudo nvidia-smi --reset-gpu-clocks
sudo nvidia-smi --reset-memory-clocks

Links

Thanks

Thank to scrutinous for his precious answers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment