Porting from Modal
Run Modal-style apps on supercomputer by changing one import line.
The SDK exposes a Modal-compatible surface. Most Modal scripts port by changing one import line:
import supercomputer as modal # was: import modal
app = modal.App("demo")
image = modal.Image.debian_slim().pip_install("torch", "numpy")
@app.function(image=image, gpu="H100", timeout=600)
def train(steps: int) -> float:
...
@app.cls(gpu="L4", volumes={"/data": modal.Volume.from_name("weights", create_if_missing=True)})
class Model:
@modal.enter()
def load(self): ...
@modal.method()
def predict(self, x): ...
@app.local_entrypoint()
def main(steps: int = 100):
print(train.remote(steps))
print(Model().predict.remote(1))Running
Run it the way you would with modal run:
super run demo.py --steps 500 # calls the local_entrypoint
super run demo.py::train --steps 500 # or .remote() a function directlysuper run detects a script that declares an App and dispatches it this way;
flags after the script are matched to the entrypoint's parameters by name and
coerced from its type annotations.
How it works
Each (gpu, image, volumes) combination gets one warm
session. .remote() pickles the arguments, uploads them, runs the function on
the host, streams stdout back live, and returns the unpickled result. A remote
exception surfaces locally as supercomputer.RemoteError with the host-side
traceback attached. Sessions close when the entrypoint returns.
GPU names
Modal GPU names map to SKUs: "T4", "L4", "A10G", "L40S", "A100",
"H100", "H200", "B200" and "RTX-PRO-6000", with an optional count
("A100:8"). gpu=None runs on a CPU-only SKU and "any" picks an L4. An
unknown name raises instead of inventing a SKU.
Supported
App, @app.function, @app.cls with @modal.enter /
@modal.exit / @modal.method / @modal.parameter, @app.local_entrypoint,
.remote() / .spawn() / .map(), the Image builder, Volume.from_name,
and Secret.from_dict / from_dotenv / from_local_environ. Options such as
cpu=, memory=, retries=, region= and container-scaling knobs are
accepted and ignored with a warning.
Not supported
web endpoints, Dict / Queue, schedules, sandboxes,
modal deploy, and Secret.from_name (there is no hosted secret store; load
secrets from a .env or the local environment instead). .map() runs inputs
sequentially on one session; use client.map(...) or super map for a real
fan-out (Batch Processing).
Example
A complete runnable port lives in the repo at examples/modal-port/app.py.