Public course previewThis is not your assigned passport. No identity, answers, or completion progress are stored here.How to start your passport
Guided lesson
04 / 06About 35 minutesEuler resource planning

Measure And Right-Size An Euler Job

Read the completed training job's accounting, then reason about a separate fictional representative run. No new job is required.

Where you will workOn your computer first, then on the remote Euler computer
  1. 1Understand
  2. 2Try it yourself
  3. 3Check and submit

Before you start#

Requested resources and resources actually used are different. sacct reports recorded fields; seff summarizes efficiency for the same job. Use this table as a lookup while reading the output, rather than memorizing six definitions.

Resource Reservation Observation to compare
CPU AllocCPUS CPU efficiency in seff; allocated does not mean used
Memory ReqMem, with its units and per-CPU/total meaning MaxRSS on the relevant job step
Time Requested maximum time Elapsed, the actual run time

State and ExitCode say how the job ended. Inspect a software failure before changing its resources. The tiny training job helps locate these fields; only a representative workload can support a production sizing decision.

A serial run reserved four CPUs, 16 GiB per CPU and two hours, but took 20 minutes with 22% CPU efficiency and 9 GiB MaxRSS. Before reading the model, which reservations look unsupported by this evidence? The official questions ask you to choose the next test for this fictional case.

Reason about the next test

Four times 16 GiB reserves 64 GiB. If the program is serial, more allocated CPUs do not make its computation parallel. Compare memory and time with the observed values, leave sensible headroom, and test the reduced request on representative input. One sample does not establish every production input's needs. An import error needs a software fix, not an unexplained increase in resources.

Treating a deliberately tiny calculation as a production benchmark, or increasing every resource after an error without diagnosing it.

Start the practice

Practice

Follow the steps

Follow in order

Steps

Connect to Euler and reuse the job ID from the first-job mission. This mission does not submit another job.

Optional: using the terminal

A command is a line of text that tells a computer to do one task. You paste it into a terminal, the text application used for commands. A shell is the part inside that application that reads the command. PowerShell, zsh, and Bash are shells. Open only the application named for your computer below; it starts its configured shell. Follow the shell named below. You do not need to install a separate Bash or zsh application.

Your computer or local means the laptop or desktop in front of you. Remote means another computer reached through the network. A command affects whichever computer the step names, so check that label before pasting.

  • Windows: press the Windows key, type PowerShell, and open the result named PowerShell. Do not use Command Prompt, Git Bash, or WSL for a block labelled PowerShell.
  • macOS: press Command+Space, type Terminal, and press Return. Terminal normally starts the zsh shell. If it uses another shell, run zsh for this session.
  • Linux: open the app named Terminal from the applications menu. It normally starts the Bash shell. If it uses another shell, run bash for this session.

The prompt is the text beside the blinking cursor. For each card, check the named computer, choose Copy, paste only the command after the prompt, press Enter once, and wait for the prompt to return.

If you have never done this before, first run the harmless terminal-ready practice on the start page. It lets you practise copying, pasting, pressing Enter, and reading output before a setup command.

Practise one harmless command first

Euler card: Euler is ETH Zurich's service made of many managed computers for research calculations. SSH is the protected connection that opens a Bash shell on Euler in the same terminal window. Connect first, then run the card there, not on your laptop.

How to open a terminal and run a command
  1. 01

    Distinguish requested and used resources

    Read and answer on this web page

    Use the compact field guide above while reading your existing job. Requested resources describe its reservation, not measured use. The tiny training job locates the fields; the separate fictional serial run supplies the sizing exercise.

    Look forYou can distinguish allocated resources from measured use.

    Explanation and help
    What this means
    Connect and recover the existing job ID.
    Safe recovery
    Return to the first-job mission; do not submit another job for this exercise.
  2. 02

    Connect to Euler

    On your computer

    From the local terminal, connect with the tested euler alias. Run every later command in the Euler shell that opens.

    RunPowerShell on Windows
    ssh euler
    RunTerminal on macOS (zsh)
    ssh euler
    RunTerminal on Linux (Bash)
    ssh euler

    Look forThe prompt changes to an Euler login node.

    If this differsReturn to the SSH access mission; do not run Euler commands in the local shell.

    Explanation and help
    What this means
    Recover the existing training job ID on Euler.
  3. 03

    Use the existing job ID

    Use Euler after you connect from your computer

    Read the job ID saved by the previous mission. If the file is missing, list recent accounting records and identify the single passport-cpu job instead of submitting another job.

    RunThis text window after SSH connects to Euler
    id_file="$HOME/passport-euler/first-job.id"
    if [ -s "$id_file" ]; then printf 'Stored job ID: '; cat "$id_file"; else sacct -X -u "$USER" --starttime today --format=JobID,JobName,State,Elapsed; fi

    Look forYou identify the existing passport-cpu job ID.

    If this differsStop if you cannot identify one unambiguous training job.

    Explanation and help
    What this means
    Inspect its detailed accounting.
  4. 04

    Read the accounting fields

    Use Euler after you connect from your computer

    Load the stored ID. If it was missing, enter the passport-cpu ID you identified and save it. Then query state, exit code, elapsed time, allocated CPUs, requested memory, and maximum resident memory. Continue only after the main job is COMPLETED with exit code 0:0.

    RunThis text window after SSH connects to Euler
    (
    set -eu
    id_file="$HOME/passport-euler/first-job.id"
    if [ -e "$id_file" ] && [ ! -s "$id_file" ]; then printf 'STOP: %s exists but is empty. Ask for help before changing it.\n' "$id_file" >&2; exit 1; fi
    if [ -s "$id_file" ]; then job_id="$(cat "$id_file")"; else read -r -p 'Existing passport-cpu job ID: ' job_id; fi
    case "$job_id" in ''|*[^0-9]*) printf 'STOP: job ID must contain digits only.\n' >&2; exit 1;; esac
    if [ ! -e "$id_file" ]; then mkdir -p "$(dirname "$id_file")"; printf '%s\n' "$job_id" > "$id_file"; chmod 600 "$id_file"; fi
    sacct -j "$job_id" --format=JobID,JobName,State,ExitCode,Elapsed,AllocCPUS,ReqMem,MaxRSS
    state="$(sacct -X -n -j "$job_id" --format=State | awk 'NF {print $1; exit}' | cut -d+ -f1)"
    exit_code="$(sacct -X -n -j "$job_id" --format=ExitCode | awk 'NF {print $1; exit}')"
    [ "$state" = COMPLETED ] && [ "$exit_code" = 0:0 ] || { printf 'STOP: wait for COMPLETED 0:0 or inspect the failed job; do not resubmit. Current result: %s %s\n' "${state:-unavailable}" "${exit_code:-unavailable}" >&2; exit 1; }
    printf 'accounting-ready\n'
    )

    Look forsacct shows the main job and its steps, the main job is COMPLETED with exit code 0:0, MaxRSS is read from the relevant step when available, and the final line is accounting-ready.

    If this differsWait for accounting to appear or verify the job ID; do not resubmit.

    Explanation and help
    What this means
    Read the efficiency summary.
  5. 05

    Read seff

    Use Euler after you connect from your computer

    Use seff for a concise CPU and memory efficiency summary, while keeping sacct as the source for exact fields.

    RunThis text window after SSH connects to Euler
    (
    job_id="$(cat "$HOME/passport-euler/first-job.id")"
    case "$job_id" in ''|*[^0-9]*) printf 'STOP: stored job ID is invalid.\n' >&2; exit 1;; esac
    seff "$job_id"
    )

    Look forseff reports the same job's CPU and memory efficiency.

    If this differsUse sacct and application logs if seff is unavailable.

    Explanation and help
    What this means
    Decide what evidence is representative.
  6. 06

    Interpret before changing resources

    Use Euler after you connect from your computer

    Compare allocated CPU count, requested memory and time with measured use. The tiny job checks the workflow and field lookup; its utilization is not representative of a production input.

    Look forYou can explain AllocCPUS, ReqMem, MaxRSS, Elapsed, State, and ExitCode.

    Explanation and help
    What this means
    Use the fictional representative run for the next-test decision. MaxRSS belongs to a reported step and its units; do not multiply or interpret it blindly across a parallel/MPI workload.
    Safe recovery
    Return to the field definitions; do not increase resources by guesswork.
  7. 07

    Choose the next measured request

    Use Euler after you connect from your computer

    Use the representative serial-run scenario in the questions, not the tiny calculation, to choose the next test. Before reading the model, compare reserved and used resources and decide what headroom is justified. This lesson asks for a decision; it does not submit that request.

    Look forYour selected next test has a reason for its CPU, total memory and time values.

    Explanation and help
    What this means
    Complete the questions and local confirmation.
    Safe recovery
    Measure a representative input before claiming a production allocation.
  8. 08

    Submit accounting evidence

    On your computer

    Enter the existing job ID and confirm that you personally inspected sacct and seff. Do not paste logs into the public record.

    Look forThe result contains only the requested inspection facts and no username, path, log, or other private value.

    Explanation and help
    What this means
    Run Check my work and submit once.
    Safe recovery
    Return to Euler and inspect the named command before attesting.

Practise

One practice question. It does not affect your progress.

01A single-task request uses three CPUs and 4 GiB per CPU. MaxRSS is 6 GiB on the relevant step. Which comparison is correct?
See an explanation

The request reserves 3 x 4 = 12 GiB. MaxRSS is an observation for a reported step, not a per-CPU request to multiply again. Use units, workload structure and representative variation before a future sizing decision.

Finish the lesson

Questions to submit

Answer these 3 questions, then confirm the work you checked.

To pass: 80% and every safety question. Completion appears after the automatic GitHub check passes.

01Which value helps estimate memory actually used?
02A job exits immediately with a Python import error. What should you optimize first?Safety-critical
03A representative serial job requested 4 CPUs, 16 GiB per CPU, and 2 hours. It completed in 20 minutes with 22% CPU efficiency and 9 GiB MaxRSS. Which next test is justified?Safety-critical
Confirm the result you personally observed

These values are processed only by the local launcher. Private paths are not written to the public submission.

Before submitting
Open my real passport first

You can check sample answers here. Open your local Passport to check your practice files and submit the lesson.

Preview onlyYou can try the questions here. This page does not store or submit your answers.
Need help?Open recovery steps and AI-review guidance

If Blocked#

Do not increase resources when fields are unclear. Use Euler resource optimization and ask for help for MPI/multiprocess workloads, highly variable inputs, or disagreeing metrics.

Useful references:

Understand Before Accepting AI Output#

Verify arithmetic, per-CPU versus total memory, representativeness, and the parallelism claim. An agent cannot infer scaling merely from CPU availability.