Using Thunder Compute
Thunder Compute provides managed instances that are optimized for performance. The Thunder Compute CLI contains all of the functionality you need to create, edit, use, and delete these instances.
The two CLI environments
The Thunder Compute CLI is split into two parts.
- Your local machine, where you can manage the Thunder Compute instances on your account and perform administrative actions.
- Within a Thunder Compute instance, where you can attach/detach GPUs and run code
Local environment
Start/create an instance
$ tnr create
- Creates a new Thunder Compute instance and automatically assigns an instance ID
$ tnr start [instance_ID]
- Starts an inactive Thunder Compute instance
$ tnr create --cores [core_count]
(not necessary for most use cases)- For most use cases, we highly recommend using the default 4 core configuration. Additional cores are billed proportionally.
- Creates a new Thunder Compute instance with a set number of cores. RAM scales according to how many cores you have (
4 * core count
)
Stop/delete an instance
$ tnr stop [instance_ID]
- Stops a running Thunder Compute instance
$ tnr delete [instance_ID]
- Deletes a Thunder Compute instance
Connect to a running instance
-
$ tnr connect [instance_ID]
- Connects you to a running Thunder Compute instance (default 0)
- This is a wrapper on SSHing. You can also manually SSH if desired using the IP displayed in
$ tnr status
-
$ tnr connect [instance_ID] -t PORT1 -t PORT2
- Connects you to a running Thunder Compute instance and sets up port forwarding
- Tunnels specified ports from the remote instance to your local machine
- Can specify multiple ports using -t/—tunnel flag repeatedly
- Example:
$ tnr connect 0 -t 8000 -t 8080
forwards ports 8000 and 8080 to respective ports on your local machine - Useful for accessing remote web servers, APIs, or other network services running on an instance locally
Resize a disk
$ tnr resize [instance_ID] [new_size_GB]
- Increases the persistent disk size of an instance to
new_size_GB
- This is not reversible and persistent disk sizes can only be increased. If you would like a smaller disk, delete your existing instance and create a new one
- Increases the persistent disk size of an instance to
By default, instances have 100GB of persistent storage. If you have significant amounts of data in a storage bucket and are constrained to a specific region or cloud provider, contact our support team.
Authentication
$ tnr login
- Logs in to Thunder Compute, prompting you to generate an API token which is saved in
~/.thunder/token
- Logs in to Thunder Compute, prompting you to generate an API token which is saved in
$ tnr logout
- Deletes the Thunder Compute API token file. Does not affect environment variables
When you use $ tnr connect
to connect to an instance, your local credentials are copied to the remote instance.
If your environment does not suit $ tnr login
, most commonly when using Docker, you can also set the TNR_API_TOKEN
environment variable with an API token to authenticate.
If both the TNR_API_TOKEN environment variable and token file exist, the environment variable takes priority.
You can generate and manage single-use API tokens in the console. API tokens do not expire and you can revoke them at any time. To access Thunder Compute from multiple devices, generate separate API tokens for each device.
Within a Thunder Compute instance
Attaching and switching GPUs
$ tnr device [device_name]
$ tnr device
without arguments will list current and available devices- Add
$ [device_name]
to switch to device - Use
$ device_name=cpu
to switch to CPU
Both environments
Status
$ tnr status
- On a local machine: Lists all TNR instances associated with your Thunder Compute account
- In a managed instance: Displays which GPUs are currently using processes and their runtime
Copy files to/from an instance
$ tnr scp [source_path] [destination_path]
- Copies files or directories between your local machine and Thunder instances
- For remote paths, use format
instance_id:path
(e.g.,0:/home/user/data
) - For local paths, use normal file paths (e.g.,
./data
or/home/user/file.txt
) - Must specify exactly one remote path and one local path
- Examples:
- Upload:
$ tnr scp ./local_file.txt 0:/remote/path/
- Download:
$ tnr scp 0:/remote/file.txt ./local_path/
- Upload:
- There is a 60 second connection timeout
- SSH key setup, compression, and
~/
expansion are automatically handled