npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@raykrueger/folding-on-ecs

v0.2.6

Published

This CDK library builds an [Amazon Elastic Container Service](https://aws.amazon.com/ecs/) GPU Cluster on AWS using Spot instances, and runs [Folding@Home](https://foldingathome.org/). via the [raykrueger/FoldingAtHomeContainer](https://github.com/raykrue

Downloads

2

Readme

Folding on Amazon ECS CDK Construct

This CDK library builds an Amazon Elastic Container Service GPU Cluster on AWS using Spot instances, and runs Folding@Home. via the raykrueger/FoldingAtHomeContainer container. The container is configured to consume the GPU on each instance in the cluster.

Why? COVID-19 of Course

Folding@home, in their own words...

"Folding@home (FAH or F@h) is a distributed computing project for simulating protein dynamics, including the process of protein folding and the movements of proteins implicated in a variety of diseases. It brings together citizen scientists who volunteer to run simulations of protein dynamics on their personal computers. Insights from this data are helping scientists to better understand biology, and providing new opportunities for developing therapeutics."

COVID-19 is ravaging the world right now. The folks at NVIDIA put out a call-to-arms for gamers to fire up their GPUs and put them to work on the new GPU COVID-19 workloads that are ready to run on the Folding@home network.

This inspired me to put this to work on the cloud. If you, or your employer, are able to spare some compute dollars for this critical need, it is easy to fire this up and contribute. The cluster uses Spot nodes for incredible savings over on-demand costs.

For me, personally, I also needed an excuse to force myself to do something in CDK. That being said, this is the first thing I've built with CDK. Which means I'm definitely open to feedback on how it could be done better. For example, I'm beginning to realize that CDK "apps" don't share well.

How to use it

This library is intended to be used as part of a CDK Stack. For example...

import * as cdk from '@aws-cdk/core';
import {FoldingAtHome} from '@raykrueger/folding-on-ecs'

class FoldingOnEcsStack extends cdk.Stack {
    constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
        super(scope, id, props);

        const cluster = new FoldingAtHome(this, 'FoldingAtHome');
    }
}

const app = new cdk.App();
new FoldingOnEcsStack(app, 'FoldingAtHomeStack');
app.synth();

Example App

See the cdk generated sample app Folding on ECS for an implementation of this library in an application. The sample application can be cloned and modified to your hearts content.

To start your own CDK app

  1. Install the AWS CLI and configure it using aws configure
  2. Install the AWS CDK
  3. $ mkdir MyFoldingCluster
  4. $ cd MyFoldingCluster
  5. $ cdk init app --language=typescript
  6. $ npm install @raykrueger/folding-on-ecs

Run Tests

git clone https://github.com/raykrueger/folding-on-ecs.git
cd folding-on-ecs
npm install
npm run build
npm test

Costs

This runs three g4dn.xlarge instances as spot requests by default. The spot request is for the base price of that instance in us-east-2, which is $0.52 an hour. Adjust for your region, and budget as needed.

In us-east-2 spot pricing, at the time of this writing, for g4dn.xlarge is around $0.16 on average. Which means a single g4dn.xlarge will cost about $117 a month. The default configuration of three nodes will cost around $351 a month. There would be additional costs for CloudWatch logs and network egress as well. I have not yet calculated an estimate for that.

To calculate the average spot price for the past 30 days in a region the following command will work on a mac.

aws ec2 describe-spot-price-history --region us-east-2 --instance-type g4dn.xlarge --start-time $(date -v-30d "+%Y-%m-%d") --product-descriptions Linux/UNIX | jq '[.SpotPriceHistory[].SpotPrice | tonumber] | length as $l | add / $l'

For linux the date command needs to be changed.

aws ec2 describe-spot-price-history --region us-east-2 --instance-type g4dn.xlarge --start-time $(date -d "30 days ago" "+%Y-%m-%d") --product-descriptions Linux/UNIX | jq '[.SpotPriceHistory[].SpotPrice | tonumber] | length as $l | add / $l'