/cdkfoldingathome

Run Folding@Home on AWS Spot instances with aws-cdk

Primary LanguageTypeScriptApache License 2.0Apache-2.0

fah

CDK-Folding@Home

Run Folding@Home with this prebuild CDK library and never forget to shut off expensive instances. With built-in TTL for your stack, you just define the lifetime of your instances and the stack will be destroyed afterwards.

About Folding@Home

Folding@home is a project focused on disease research. The problems F@H is solving require many computer calcul­ations – so you can donate your excess compute power to help their research. In that sense, you are part of a huge distributed supercomputer!

The architecture follows this AWS blog post and leverages g4dn.xlarge Spot EC2 instances to maximise GPU vs price efficiency.

Running at spot price drastically reduces the price from 0.59$ per hour to around 0.17 in eu-west-1. That's a nice 70% in savings.

spotsavings

I hope you enjoy this package and together we can make a difference and help the Folding@Home program to succeed in their mission!

Progress

After deployment, you can go into CloudWatch logs and open the log group fahlog. You can now see the progress every one of your instances makes towards the goal of unfolding proteins. wu01fahlog.png wu01 represents the work of the GPU and wu00 is the work of the CPU .

Big thanks to cdk-time-bomb for the TTL function and Ash Belmokadem and Vikin Shetty for debugging help!

How to use it

  1. Create a new CDK app

  2. Install CDK-Folding@Home in your CDK app

npm install cdkfoldingathome
  1. Open your stack.ts file in ./bin

  2. Import cdkfoldingathome

import * as folding from 'cdkfoldingathome';
  1. Create folding stack - important to specify accountId and region
const fah = new folding.FoldingathomeStack(app, 'folding', {
    timeToLive: cdk.Duration.hours(5),
    spotPrice: '0.40',
    numberOfInstances: 10,
    env: {
        account: "754950554578",
        region: "eu-west-1"
    }
})
  1. Ready to build and deploy!

  2. Your stack gets destroyed once the TTL is up

  3. Double-check the first time to be sure your stack got really deleted 😉

If you have any questions reach out on Github or Twitter.