> For the complete documentation index, see [llms.txt](https://help.fovus.co/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.fovus.co/docs/pipeline/miniwdl/miniwdl-submission/replace-miniwdl-directives.md).

# Replace miniwdl runtime directives

Replace WDL runtime cpu/memory directives with Fovus tokens so Fovus can inject the optimal vCPU and memory values into your task command at runtime.

Fovus automatically determines the optimal HPC strategy for each task — including vCPU count and memory — based on your benchmarking profile and time-to-cost objective. Standard WDL `cpu` and `memory` runtime attributes describe a static allocation, so they conflict with that optimization. Replace any command-line reference to `cpu` or `memory` with the equivalent Fovus environment token, and remove `cpu` / `memory` from `runtime{}` entirely.

## Fovus tokens

| Token              | Replaces                       | Value at runtime                                       |
| ------------------ | ------------------------------ | ------------------------------------------------------ |
| `$FovusNodeVcpu`   | WDL `cpu` runtime attribute    | Number of vCPUs available on the assigned compute node |
| `$FovusOptVcpuMem` | WDL `memory` runtime attribute | Optimal system memory allocated for the task, in GiB   |

Fovus injects these as environment variables before each task starts. For the full list of available environment tokens, see the [Environment tokens reference](/docs/reference/environment-tokens-reference.md).

{% hint style="info" %}
Inside a `command <<< >>>` block, a bare `$VAR` (not followed by `{`) passes straight through to the shell — WDL only interpolates `~{...}` expressions. Fovus tokens need no escaping.
{% endhint %}

## Replace thread count (cpu)

Drop the `cpu` runtime attribute and swap any command-line reference to it for `$FovusNodeVcpu`.

```wdl
# Before
task align {
    input {
        File reads
        File ref
        Int cpu = 8
    }

    command <<<
        bwa mem -t ~{cpu} ~{ref} ~{reads} > aligned.sam
    >>>

    output {
        File aligned = "aligned.sam"
    }

    runtime {
        docker: "biocontainers/bwa:latest"
        cpu: cpu
    }
}
```

```wdl
# After
task align {
    input {
        File reads
        File ref
    }

    command <<<
        bwa mem -t $FovusNodeVcpu ~{ref} ~{reads} > aligned.sam
    >>>

    output {
        File aligned = "aligned.sam"
    }

    runtime {
        docker: "biocontainers/bwa:latest"
        benchmarkingProfileName: "Default CPU"
    }
}
```

The `cpu` input and runtime attribute are gone entirely — the task now reads its thread count from the environment at run time instead of a value baked into the WDL.

## Replace memory

Drop the `memory` runtime attribute and swap any command-line reference to it for `$FovusOptVcpuMem`.

`$FovusOptVcpuMem` is in **GiB**. If your tool expects a different unit, convert with bash arithmetic in the command block.

```wdl
# Before
task sort_bam {
    input {
        File bam
        String memory = "16 GB"
    }

    command <<<
        samtools sort -m ~{memory} ~{bam} -o sorted.bam
    >>>

    runtime {
        docker: "biocontainers/samtools:latest"
        memory: memory
    }
}
```

```wdl
# After
task sort_bam {
    input {
        File bam
    }

    command <<<
        samtools sort -m "${FovusOptVcpuMem}G" ~{bam} -o sorted.bam
    >>>

    runtime {
        docker: "biocontainers/samtools:latest"
        minvCpuMemGiB: 16
    }
}
```

{% hint style="info" %}
`minvCpuMemGiB` in `runtime{}` is a Fovus Token that sets the benchmarking constraint Fovus optimizes against — it is not the same as the WDL `memory` runtime attribute, which is removed. See the [miniWDL configuration reference](/docs/pipeline/miniwdl/miniwdl-config-reference.md) for the full Fovus Token list.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.fovus.co/docs/pipeline/miniwdl/miniwdl-submission/replace-miniwdl-directives.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
