Folding At Home on Vast.ai: Automatic Configuration and Local Management

Zefcat
5 min readApr 28, 2020

--

If you’re like me, then you want to help contribute to the science of curing and preventing diseases like COVID19. Folding at Home is a distributed-computing project that uses your home computer to do science. But if you want to contribute more than just the power of your home pc, and don’t want to buy or build a computer just for folding, you can rent high-performance machines on the Vast.ai marketplace. I will show how to setup the Instance Configuration, find the right machine, and remotely manage the Folding at Home software. This guide assumes you are using Windows and have the FaH Advanced Control installed.

Sign Up

New accounts get $2 in free credit. A reliable, single gpu machine will usually cost around 20–30 cents per hour, so about 5–7 dollars per day. When you run out of credit, your folding will stop.

  1. Go to https://vast.ai/create
  2. Click “Sign Up” in the top right corner

Setup the Folding Instance

Once you’re logged in, we need to set the Instance Configuration to run the Folding at Home software.

3. Open the Create menu from the left navigation pane, and click on “Edit Image & Config”

4. Scroll to the bottom and find the “custom image” field. Copy and Paste this image name

ohgodatrini/fahclient:v7_5_1_ssh

5. We want launch mode “Run interactive shell server, SSH

6. Paste this script into the On-Start Script area, inserting your own username and team (and passkey if you have one)

bash -c 'export f_user=Anonymous f_team=245058 f_passkey=Z f_power=medium f_clientType=advanced; apt update; apt install wget xmlstarlet -y; wget https://git.io/Jftn8 -O fah_autorun.sh; bash ./fah_autorun.sh'

7. We can set the Disk space slider to around 2GB, and click “Select”

8. If you want to manage your rented machine, you must create a key pair. Follow this guide, perform steps 4 thru 7. Make sure you save your public key in Vast under the Account section.

Rent a machine

8. Now we have to select which machine to rent. This can be the most important step in this process so I have a few tips:
- Only use On-Demand rentals
- Host Reliability minimum to 95%
- PCIE Bandwidth minimum to 2.6–3GB/s
- Look for machines that don’t split their CPU cores, for example “8.0/8 cores”

9. When you have found a machine to rent, click “Rent”. You can watch your instance get built and come online by clicking “Instances” on the left menu. This should take 3-5 minutes

Also remember that machines will come and go from the list as they are rented and released. If you don’t see one that fits your budget give it some time, maybe try back in an hour or try tomorrow.

Manage your new folding rig

This section assumes you have installed Putty and have created an SSH key pair, and pasted the public key into Vast.

10. The first step is to find your rented Instance’s host name and port. Open the “Instances” pane, and look for the string in the picture. Each instance has a different combination.

Configure Putty

11. Open Putty
- Enter the host name and port on the front page
- Go to Connection -> SSH ->Auth and browse to your private key file
- Go to Connection -> SSH -> Tunnels and add the numbers in the picture below.
- Go to Session and enter a name for this session and click Save

12. Click “Open” and click “Yes” to trust the host certificate

Add client to Advanced Control

13. Now open the Advanced Control app on your local desktop. Click “Add” to add a new client, set a unique name for your client, and set the port to 36331 (or the Source port you used in the putty tunnel) and click “Save”

Now you can control your Vast.ai instance as if it was running on your local machine!

Conclusion

When you want to stop folding, it’s best to Finish your current Work Units before destroying the Vast.ai rental instance. After clicking Finish in Advanced Control, you can check the ETA for the remaining time. If you are folding for points and using a passkey, any lost Work Units will count against your bonus points.

Thank you to those that helped me out
- OhGodATrini and his great fahclient docker image
- Jason Price and his tutorial which helped me get started
- And tcprst for his Putty mastery

--

--