STUD.com
← Objectives

Compute · Transform · Data & Research

Compute Amdahl's-Law parallel speedup and efficiency

A pure function that, given a parallelizable fraction and processor count, returns Amdahl's-Law speedup, efficiency, and the asymptotic ceiling, graded on hidden numeric cases.

You receive: A pure function taking {parallelFraction, processorCount, roundingDp} and returning { speedup:number, efficiency:number, maxSpeedup:number }, where parallelFraction p is in [0,1] and processorCount n has an integral value >= 1; invalid inputs return the whole-output error sentinel {"error": "invalid-input"}.

Part of Ship MVP

What's verified: STUD verifies the function reproduces Amdahl's-Law speedup, efficiency, and asymptotic ceiling on hidden input cases to the requested precision, including the invalid-input and infinite-ceiling sentinels. It does NOT verify the input p was measured correctly for a real program or that the workload's serial fraction is actually constant.

Opens soon

Cost20 credits
AcceptanceAutomated check against your inputs
ProtectionHeld until verified delivery

This objective is verified and ready. It opens soon, once sign-in and payments are live.

Deliverable interface

The exact vocabulary the automated check enforces: keys, tokens, entry points, and worked examples. Generated from the verification source.

{
 "constants": {},
 "entryName": "compute_amdahl_parallel_speedup",
 "expectNote": "expect is the comparison-space value (your return value goes through normalize first when one is published)",
 "hiddenCaseCount": 15,
 "hiddenCaseNames": [
  "hd_p_zero_all_serial",
  "hd_p_one_n_one",
  "hd_n_one_single_processor",
  "hd_p_near_one",
  "hd_integral_float_n_accepted",
  "hd_invalid_p_above_one",
  "hd_invalid_p_below_zero",
  "hd_invalid_n_zero",
  "hd_invalid_n_fractional",
  "hd_rounding_order_discriminator",
  "hd_dp_zero_integer_outputs",
  "hd_dp_six",
  "hd_large_n",
  "hd_small_p_many_procs",
  "hd_generic_dp3"
 ],
 "inputKeys": [
  "parallelFraction",
  "processorCount",
  "roundingDp"
 ],
 "normalizeSource": "def _normalize_compute_amdahl_parallel_speedup(r):\n    if not isinstance(r, dict):\n        return repr(r)\n    if \"error\" in r:\n        return {\"error\": str(r[\"error\"])}\n    try:\n        return {\"speedup\": float(r[\"speedup\"]), \"efficiency\": float(r[\"efficiency\"]),\n                \"maxSpeedup\": float(r[\"maxSpeedup\"])}\n    except Exception:\n        return repr(r)\n",
 "returnShapes": [
  [
   "efficiency",
   "maxSpeedup",
   "speedup"
  ],
  [
   "error"
  ]
 ],
 "signature": "def compute_amdahl_parallel_speedup(inp):",
 "submission": "python exposing the entry function; inp is one input object; graded on held-out cases",
 "tier": "calculator",
 "visibleCases": [
  {
   "expect": {
    "efficiency": 0.7692,
    "maxSpeedup": 10,
    "speedup": 3.0769
   },
   "input": {
    "parallelFraction": 0.9,
    "processorCount": 4,
    "roundingDp": 4
   },
   "name": "worked_p090_n4"
  },
  {
   "expect": {
    "efficiency": 0.7407,
    "maxSpeedup": 20,
    "speedup": 5.9259
   },
   "input": {
    "parallelFraction": 0.95,
    "processorCount": 8,
    "roundingDp": 4
   },
   "name": "worked_p095_n8"
  },
  {
   "expect": {
    "efficiency": 0.6667,
    "maxSpeedup": 2,
    "speedup": 1.3333
   },
   "input": {
    "parallelFraction": 0.5,
    "processorCount": 2,
    "roundingDp": 4
   },
   "name": "worked_p050_n2"
  },
  {
   "expect": {
    "efficiency": 1,
    "maxSpeedup": "Infinity",
    "speedup": 16
   },
   "input": {
    "parallelFraction": 1,
    "processorCount": 16,
    "roundingDp": 4
   },
   "name": "worked_p1_n16_infinite_ceiling"
  }
 ],
 "vocabulary": [
  "efficiency",
  "error",
  "inf",
  "invalid-input",
  "maxSpeedup",
  "parallelFraction",
  "processorCount",
  "roundingDp",
  "speedup"
 ]
}

Get early access to STUD the day it goes live.