Code Ocean User Guide
v3.6.0
v3.6.0
  • Welcome to Code Ocean
  • Onboarding
    • Quick Start Guides
      • Create a Capsule in 5 minutes
      • Create a Pipeline in 5 minutes
    • Video Library
  • Key Concepts
  • Capsule Guide
    • The Capsule Interface
      • File Navigation/App Builder Panel
      • Editor Panel
      • Reproducibility Panel
    • The Structure of a Capsule
      • Metadata
      • Environment
      • Code
      • Data
      • .codeocean
      • Scratch
      • Results
    • Reproducible Runs
    • Version Control
      • Importing a Capsule from a Git Provider
      • Clone via Git...
    • Managing Capsules
      • Sharing a Capsule with Secrets
      • Exporting Capsules to your Local Machine
    • Secret Management Guide
      • Setting a Secret in the Account Settings Page
      • Accessing a Secret in a Capsule
  • Setting up the Environment
    • Selecting a Starter Environment
    • Package Managers and Adding Packages
    • Installing R packages
    • Environment Variables
    • Build Log
    • Post-Install Script
    • Compute Resources
  • Working in a Cloud Workstation
    • Launching a Cloud Workstation
      • Running RShiny in Code Ocean
      • Running Streamlit in Code Ocean
      • Using Terminal in Code Ocean
      • Using Ubuntu Desktop in Code Ocean
      • Using MATLAB in Code Ocean
      • Using VS Code in Code Ocean
    • Exiting a Cloud Workstation Session
  • Data Assets Guide
    • Types of Data Assets
    • Creating a New Data Asset
    • Capturing a Result
      • Provenance of the Result Data Asset
    • Using Data Assets in a Capsule
    • Managing Data Assets
      • Finding Data Assets
        • Custom Metadata
  • Pipeline Guide
    • The Pipeline UI
      • File Tree System
      • Pipeline App Panel
      • Timeline
    • Components of a Pipeline
      • Nextflow File
      • Capsules
      • Data
      • Results Bucket
      • Map Paths
      • Capsule Settings
      • Pipeline Settings
      • .codeocean
    • Managing Pipelines
      • Exporting Pipelines to your Local Machine
    • Capsule vs Pipeline Differences
    • How to Run Code in Parallel
    • Nextflow Configurations
    • Pipeline Monitoring
      • Monitoring Dashboard
      • Task Details
    • Nextflow Artifacts
    • nf-core Pipelines
      • Import nf-core pipelines
      • nf-core RNASeq Tutorial
        • iGenomes
    • Pipeline Tutorial
  • Release Capsules and Pipelines
    • Creating and Using Release Capsules
    • Creating Release Pipelines
    • Internal Releases
  • Collections
  • Code Ocean Apps
    • Genomics
    • Cheminformatics
    • Visualization
    • Machine Learning
    • Data Connectors
    • Quality Control
    • Use Cases and Examples
      • CombFold Pipeline
      • Data Connector Example
      • Gene Set Enrichment Overview
      • RNASeq Quantification Pipeline
  • App Panel Guide
    • App Builder User Interface
      • Validation pattern for strings
    • Passing App Panel's Parameters to the Script
    • Releasing an App Panel Capsule
    • Executing an App Panel Capsule
  • MLflow Guide
    • Enable MLflow Tracking
    • MLflow UI
    • Creating Models
    • MLflow Permissions
  • Models Guide
    • Creating Models
    • Managing Models
  • Git Provider Integration Guide
    • Setting up the Integration
    • Using Git Provider Integration
  • Code Ocean API
    • Authentication
    • Errors
    • Capsule
    • Computation
    • Data Asset
    • Python SDK
  • More Support
Powered by GitBook
On this page
  • Setting Compute Resources
  • Methods of Allocating Compute Resources
  • Flex Machine
  • Dedicated Machine
  • Spot Instances
  • Provisioning sufficient resources
  • User Interface Feedback

Was this helpful?

  1. Setting up the Environment

Compute Resources

PreviousPost-Install ScriptNextWorking in a Cloud Workstation

Was this helpful?

A computation—whether a Reproducible Run or a Cloud Workstation session—runs as a Docker container occupying a compute slot on an EC2 instance in AWS. The instance type is determined by the Starter Environment you select, and will support either a general-purpose machine or one with GPU resources.

After selecting the starter environment, adjust the compute resources by choosing the number of slots to allocate for your computation. The default compute resource is based on the machine type of the starter environment.

Setting Compute Resources

  1. From the Environment editor, click Select Compute Resources.

  2. Select the allocation type.

  3. Select the number of slots or specific instance type.

  4. Click Apply.

Methods of Allocating Compute Resources

A Capsule allocates compute resources in two ways:

  • Flex

  • Dedicated

Flex Machine

Flex resources are the default option for running your Capsule. This method attempts to allocate the selected compute resource (slots) on a running worker machine in the deployment's fleet of workers. If none of them have enough available slots, a new machine is added to the fleet in order to meet the need. This allows low-intensity computations to run on the same EC2 instances to reduce the cost by avoiding turning on an additional instance.

Using flex resources ensures your organization gets the most value out of running machines in your deployment. When all slots become empty, for example, no computation on the EC2 instance, the EC2 instance will shut down automatically after one hour, or for a time specified in the deployment plan. To optimize resource usage, the system shuts down Cloud Workstation sessions after two hours of idleness (CPU usage <2%).

If you select a more powerful compute resource for a Capsule, it requires more available compute slots to launch a computation instantly. It may increase the chance of activating a new EC2 instance which could increase both cost and waiting time.

Dedicated Machine

Selecting a dedicated machine launches a new Amazon EC2 instance exclusively for your computation. There are dedicated machines with a wide range of specifications, for example, CPUs from 0.5 GB RAM to 4000 GB RAM, to ensure that there are always resources available to match your needs.

For AI/ML use cases, it is important to know how much of the available RAM is GPU-specific. This information is included in the description of every dedicated compute resource.

The EC2 instance will shut down directly after the computation is complete that is, the machine will shut down immediately after the reproducible run ends or the Cloud Workstation session is closed. The system will shut down a Cloud Workstation session after the session is idle (CPU <2%) for two hours (or for a time specified in the deployment plan) and terminate the machine.

Spot Instances

Spot instances allow you to provision unused capacity of a currently running dedicated machine at less than one tenth of the original cost. Since the machine is not reserved, your computation may be interrupted without notice.

Provisioning sufficient resources

To determine if your capsule needs higher compute resources, you can monitor usage and RAM metrics in two ways:

  1. At the top of your screen when in a Cloud Workstation

2. In the Capsule Timeline after a Reproducible Run

If your computation exceeds the resources you’ve allocated in a Cloud Workstation, you will get an error message such as:

If your computation exceeds allocated resources during a Reproducible Run, it will terminate abruptly. If there are no flex machines with more resources, you should use a dedicated machine. Start by slowly increasing the memory and cores of your dedicated machine depending on your use case.

User Interface Feedback

If a compute resources is no longer available, the system displays a notification on the screen.

Use dedicated machines when you have a computation with high compute demand or need a specific configuration for the EC2 instance. Keep in mind that it takes approximately two minutes to start up a new instance and the more powerful machine you choose, the higher the hourly cost (Refer to for more details). You also have the option to choose the spot instance to reduce cost.

AWS EC2 pricing website