Configuration Options
Machine gives you granular control over your GPU-accelerated GitHub Actions workflows through a simple yet powerful configuration syntax. This guide covers all available configuration options to help you optimize your workflows.
Basic Configuration
The most basic configuration requires only specifying machine
and a GPU type in the runs-on
field:
jobs: ml-job: runs-on: - machine - gpu=t4
Complete Configuration Reference
Here’s a complete reference of all configuration options available:
jobs: ml-job: runs-on: - machine # Required: Activates Machine.dev runners - gpu=L40S # Required: GPU type to use - cpu=16 # Optional: Number of CPU cores (default varies by GPU) - ram=64 # Optional: RAM in GB (default varies by GPU) - architecture=x64 # Optional: x64 or arm64 (default: x64) - tenancy=spot # Optional: spot or on-demand (default: on_demand) - regions=us-east-1,eu-west-1 # Optional: Comma-separated AWS regions
Configuration Matrix
Below is a matrix of available configurations for each GPU type. Each row represents a GPU type with its available CPU and RAM scaling options.
GPU Type | Architecture | GPU Memory | Available vCPU & RAM Configurations |
---|---|---|---|
T4G | ARM64 | 16GB | 4 vCPU + 8GB RAM (default) 8 vCPU + 16GB RAM 16 vCPU + 32GB RAM |
T4 | x64 | 16GB | 4 vCPU + 16GB RAM (default) 8 vCPU + 32GB RAM 16 vCPU + 64GB RAM |
L4 | x64 | 24GB | 4 vCPU + 16GB RAM (default) 8 vCPU + 32GB RAM 16 vCPU + 64GB RAM |
A10G | x64 | 24GB | 4 vCPU + 16GB RAM (default) 8 vCPU + 32GB RAM 16 vCPU + 64GB RAM |
L40S | x64 | 48GB | 4 vCPU + 32GB RAM (default) 8 vCPU + 64GB RAM 16 vCPU + 128GB RAM |
TRN1 | x64 | 32GB | 8 vCPU + 32GB RAM (default) |
INF2 | x64 | 32GB | 4 vCPU + 16GB RAM (default) 32 vCPU + 128GB RAM |
Note: Bold options indicate default configurations that will be used if you don’t explicitly specify CPU and RAM values.
Custom Configurations
You can customize your runner’s specifications in the GitHub Actions workflow file:
runs-on: - machine - gpu=L40S - cpu=8 # Custom CPU cores (up to 16) - ram=32 # Custom RAM in GB (up to 128)
If you don’t specify CPU and RAM values, the default configuration for each GPU type will be used automatically.
Regional Availability
Machine GPU runners are available in multiple AWS regions. By default we search globally to find the most cost effective region to start each runner, but this can be overridden in the workflow. You can specify a list of regions to search to limit the search space.
runs-on: - machine - gpu=a10g - regions=us-east-1,us-east-2,eu-west-2
Available regions for the beta include:
- North America: us-east-1, us-east-2, us-west-2, ca-central-1
- Europe: eu-south-2
- Asia Pacific: ap-southeast-2
Benefits of region selection:
- Cost optimization: Different regions have different pricing
- Data locality: Run close to your data sources
- Availability: Some GPU types are more readily available in specific regions
- Compliance: Meet data sovereignty requirements
Spot vs. On-Demand Instances
Machine offers both on-demand and spot instances:
- On-Demand: Guaranteed availability with consistent pricing
- Spot: Up to 85% cost savings using AWS spot instances
Specify your preference in the workflow. We default to on_demand:
runs-on: - machine - gpu=L4 - tenancy=spot # or tenancy=on_demand
Note: Spot instances may be interrupted, so it’s important to implement error handling in your workflow.
When to use spot instances:
- Non-critical workloads
- Jobs that can be retried if interrupted
- Cost-sensitive projects
When to use on-demand instances:
- Critical production workloads
- Deadline-sensitive jobs
- Jobs that would be costly to restart
Architecture Support
Machine runners support both x64
and arm64
architectures:
runs-on: - machine - gpu=T4G - architecture=arm64 # Default is x64
Note: Not all GPU types support both architectures. T4G instances are optimized for ARM64, while other GPUs typically use X64.
Workflow Examples
Basic ML Training Job
name: Train ML Model
on: push: branches: [ main ]
jobs: train: name: Train Model runs-on: - machine - gpu=L4 - tenancy=spot
steps: - uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.10'
- name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt
- name: Train model run: python train.py
High-Performance Fine-Tuning
name: Fine-tune LLM
on: workflow_dispatch
jobs: finetune: name: Fine-tune Language Model runs-on: - machine - gpu=L40S - cpu=16 - ram=128 - tenancy=on_demand
steps: - uses: actions/checkout@v3 - name: Set up environment run: | pip install -r requirements.txt
- name: Fine-tune model run: python finetune.py env: WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }}
Best Practices
- Match resources to workload: Choose the appropriate GPU, CPU, and RAM for your specific task
- Use spot instances when possible: Save costs on non-critical workloads
- Set timeouts: Configure workflow timeouts to avoid runaway costs
- Monitor usage: Regularly check the Machine.dev dashboard to track spending
- Cache dependencies: Use GitHub’s caching to speed up workflow runs
Next Steps
- Explore Region Availability