{
  "title": "run",
  "public_path": "flex_rf.web.run",
  "lookup_path": "flex_rf.web.run",
  "slug": "flex_rf/web/run",
  "public_url": "/rf/latest/autogenerated/flex_rf/web/run/",
  "object_kind": "function",
  "introduction": "Submit one or many simulations and return results in the same container shape.\n\nThis is a convenience wrapper around the autograd runners that accepts a single\nsimulation **or** an arbitrarily nested container of simulations\n(`list`, `tuple`, or `dict` values). Internally, all simulations are collected,\ndeduplicated by object hash, executed either synchronously (single) or\nasynchronously (batch), and the returned data objects are reassembled to mirror\nthe input structure.\n\n**Path behavior**\n  - **Single simulation:** results are downloaded to `f\"{path}.hdf5\"` when `path` is\n    provided without a suffix.\n  - **Multiple simulations:** `path` is treated as a **directory**, and each\n    task will write its own results file inside that directory.\n\n**Lazy loading**\n  - If `lazy` is *not* specified: single runs default to `False` (eager load);\n    batch runs default to `True` (proxy objects that load on first access).",
  "notes": "- Simulations are indexed by `hash(sim)`. If the *same object* appears multiple\n  times in the input, it is executed once and its data is reused at all positions.\n  The *last* occurrence wins if duplicates with the same hash are encountered.\n- For each simulation, a mode-solver compatibility patch is applied so that\n  the returned data exposes expected convenience attributes.\n- `progress_callback_*` are only used in the single-run code path.\n- Passing run options directly is deprecated. Set defaults via\n  `td.config.run` and `td.config.vgpu` instead. Non-`None` values\n  passed here override the config for this call.",
  "examples": "Single run (eager by default)\n\n```python\nsim_data = run(sim, task_name=\"wg_bend\", path=\"out/bend\")\n# writes: \"out/bend.hdf5\"\n```\n\nBatch run with nested structure (lazy by default)\n\n```python\nsims = {\n    \"coarse\": [sim_a, sim_b],\n    \"fine\": sim_c,\n}\ndata = run(sims, path=\"out/batch_dir\", max_workers=4)\n\n# 'data' mirrors 'sims' structure:\n# data[\"coarse\"][0] -> data for sim_a, etc.\n```",
  "references": "",
  "signature": "run(simulation: RunInput, task_name: str | None = None, folder_name: str = 'default', path: PathLike | None = None, callback_url: str | None = None, verbose: bool = True, progress_callback_upload: typing.Callable[[float], None] | None = None, progress_callback_download: typing.Callable[[float], None] | None = None, solver_version: str | None = None, worker_group: str | None = None, simulation_type: str | None = None, parent_tasks: list[str] | None = None, local_gradient: bool | None = None, max_num_adjoint_per_fwd: int | None = None, reduce_simulation: typing.Literal['auto', True, False] = 'auto', pay_type: PayType | str | None = None, priority: int | None = None, max_workers: int | None = None, lazy: bool | None = None, vgpu_allocation: int | None = None, ignore_memory_limit: bool | None = None)",
  "source": {
    "path": "flex/public/tidy3d/tidy3d/web/api/run.py",
    "url": "",
    "lineno": 87,
    "endlineno": 321
  },
  "bases": [],
  "parameter_rows": [
    {
      "name": "simulation",
      "annotation": "RunInput",
      "default": "",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "task_name",
      "annotation": "str | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "folder_name",
      "annotation": "str",
      "default": "'default'",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "path",
      "annotation": "PathLike | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "callback_url",
      "annotation": "str | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "verbose",
      "annotation": "bool",
      "default": "True",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "progress_callback_upload",
      "annotation": "typing.Callable[[float], None] | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "progress_callback_download",
      "annotation": "typing.Callable[[float], None] | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "solver_version",
      "annotation": "str | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "worker_group",
      "annotation": "str | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "simulation_type",
      "annotation": "str | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "parent_tasks",
      "annotation": "list[str] | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "local_gradient",
      "annotation": "bool | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "max_num_adjoint_per_fwd",
      "annotation": "int | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "reduce_simulation",
      "annotation": "typing.Literal['auto', True, False]",
      "default": "'auto'",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "pay_type",
      "annotation": "PayType | str | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "priority",
      "annotation": "int | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "max_workers",
      "annotation": "int | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "lazy",
      "annotation": "bool | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "vgpu_allocation",
      "annotation": "int | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    },
    {
      "name": "ignore_memory_limit",
      "annotation": "bool | None",
      "default": "None",
      "description": "",
      "origin": "declared"
    }
  ],
  "members": [],
  "group": "flex_rf.web"
}
