-
Notifications
You must be signed in to change notification settings - Fork 32
docs: Add instant iteration step to Flash quickstart #612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
muhsinking
merged 3 commits into
main
from
promptless/flash-quickstart-reiteration-step
Apr 10, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,6 +70,7 @@ from runpod_flash import Endpoint, GpuGroup | |
| name="flash-quickstart", | ||
| gpu=GpuGroup.ANY, # Use any available GPU | ||
| workers=3, | ||
| idle_timeout=300, # Keep worker running for 5 minutes | ||
| dependencies=["numpy", "torch"] | ||
| ) | ||
| def gpu_matrix_multiply(size): | ||
|
|
@@ -147,10 +148,27 @@ export RUNPOD_API_KEY="your_key" | |
| Replace `your_key` with your actual API key from the [Runpod console](https://www.runpod.io/console/user/settings). | ||
| </Tip> | ||
|
|
||
| Try running the script again immediately and notice how much faster it is. Flash reuses the same endpoint and cached dependencies. You can even update the code and run it again to see the changes take effect instantly. | ||
| ## Step 5: Update and run again | ||
|
|
||
| With your endpoint running, make a change and run the script again: | ||
|
|
||
| ## Step 5: Understand what you just did | ||
| 1. Open `gpu_demo.py` and change the matrix size from `1000` to `2000`: | ||
|
|
||
| ```python | ||
| result = await gpu_matrix_multiply(2000) | ||
| ``` | ||
|
|
||
| 2. Run the script again: | ||
|
|
||
| ```bash | ||
| python gpu_demo.py | ||
| ``` | ||
|
|
||
| This time, the result should appear in 1-3 seconds instead of 30-60 seconds, injects the code into the running worker so code changes take effect immediately without reprovisioning. | ||
|
|
||
| This instant iteration is one of Flash's key features. You can develop and test GPU code as quickly as local development, even though it runs on remote hardware. | ||
|
|
||
| ## Step 6: Understand what you just did | ||
|
|
||
| Let's break down the code you just ran: | ||
|
|
||
|
|
@@ -174,6 +192,7 @@ Flash automatically loads your credentials from `flash login` or the `RUNPOD_API | |
| name="flash-quickstart", | ||
| gpu=GpuGroup.ANY, | ||
| workers=3, | ||
| idle_timeout=300, | ||
| dependencies=["numpy", "torch"] | ||
| ) | ||
| def gpu_matrix_multiply(size): | ||
|
|
@@ -202,6 +221,7 @@ The `@Endpoint` decorator configures everything in one place: | |
| - **`name`**: Identifies your endpoint in the [Runpod console](https://www.runpod.io/console/serverless). | ||
| - **`gpu`**: Which GPU to use (`GpuGroup.ANY` accepts any available GPU for faster provisioning). | ||
| - **`workers`**: Maximum parallel workers (allows 3 concurrent executions). | ||
| - **`idle_timeout`**: Seconds a worker stays active after completing a request before scaling down. Setting this to 300 (5 minutes) gives you more time to iterate on your code while the worker remains warm. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Referenced Source: https://docs.runpod.io/flash/configuration/parameters#idle_timeout |
||
| - **`dependencies`**: Python packages to install on the worker. | ||
| - **Function body**: The matrix multiplication code runs on the remote GPU, not your local machine. | ||
| - **Return value**: The result is returned to your local machine as a Python dictionary. | ||
|
|
@@ -238,7 +258,7 @@ Here's what happens when you call an `@Endpoint` decorated function: | |
|
|
||
| Everything outside the `@Endpoint` function (all the `print` statements, etc.) runs **locally on your machine**. Only the decorated function runs remotely. | ||
|
|
||
| ## Step 6: Run multiple operations in parallel | ||
| ## Step 7: Run multiple operations in parallel | ||
|
|
||
| Flash makes it easy to run multiple GPU operations concurrently. Replace your `main()` function with the code below: | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added new Step 5 demonstrating instant iteration per Mo King's request to show users how quickly they can re-deploy code (make a change, run it again) before the worker spins down.
Source: https://Team.slack.com/archives/D094WQKSXLK/p1775738158299809