<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Uday Chopra on Medium]]></title>
        <description><![CDATA[Stories by Uday Chopra on Medium]]></description>
        <link>https://medium.com/@uday.chopra0?source=rss-70b91e7ec7a2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Uday Chopra on Medium</title>
            <link>https://medium.com/@uday.chopra0?source=rss-70b91e7ec7a2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 13:33:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@uday.chopra0/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I Deployed Dask-CUDA Across 8 GPUs: Operations Checklist & Benchmark Setup]]></title>
            <link>https://medium.com/dunnhumby-data-science-engineering/how-i-deployed-dask-cuda-across-8-gpus-operations-checklist-benchmark-setup-fd35a2788649?source=rss-70b91e7ec7a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd35a2788649</guid>
            <category><![CDATA[dask]]></category>
            <category><![CDATA[gpu]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <dc:creator><![CDATA[Uday Chopra]]></dc:creator>
            <pubDate>Mon, 24 Aug 2026 08:32:59 GMT</pubDate>
            <atom:updated>2026-08-24T08:32:59.748Z</atom:updated>
            <content:encoded><![CDATA[<p>You know that feeling when you finally get access to multiple GPUs, run your workload, and still do not get the speedup you expected?</p><p>That is where this started for me.</p><p>I had a workload that could not comfortably fit on one machine anymore. Single-node runs were okay, but memory ceilings and longer runtimes kept showing up at exactly the wrong time. I needed to scale out, not just optimize one more kernel. So I moved to Dask with a distributed GPU setup and documented what actually mattered in practice: the networking details, the Docker flags people skip, and the sanity checks that save hours.</p><p>This article walks through the setup I used: two VMs, each with 4 NVIDIA T4 GPUs, for a total of 8 GPU workers.</p><p><strong>Why Dask for This?</strong></p><p>Dask is an open-source parallel computing library for Python that scales familiar APIs (NumPy, pandas, scikit-learn style workflows) beyond a single machine. It builds a task graph and executes lazily, which makes it useful for both exploration and production jobs.</p><p>The practical reason I chose it: I could start on one machine with almost no API changes, then move to multiple machines once the workload demanded it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dmc4X4R3JmTLS9p_2R-6xQ.jpeg" /></figure><p><strong>Single-Node: The Easy Win</strong></p><p>On a single machine, Dask spreads work across CPU cores or GPUs via dask-cuda. `LocalCUDACluster` gives one worker per GPU, and a single `Client` orchestrates execution. It is usually the fastest way to get immediate gains without introducing distributed-system complexity.</p><p><strong>Multi-Node: When One Box Is Not Enough</strong></p><p>When memory or compute demand grows, Dask scales horizontally.</p><p>- One scheduler manages the global task graph.</p><p>- Worker processes (often one per GPU) connect over TCP.</p><p>- Data partitions move between workers as needed.</p><p>That sounds simple on paper. In practice, network settings and container memory defaults are where most failures hide.</p><p><strong>Cluster Setup I Used</strong></p><p>- Main machine (scheduler): `gpu-scheduler-vm`</p><p>- Worker machine: `gpu-worker-vm`</p><p>- Total resources: 2 VMs x 4 T4 GPUs = 8 GPU workers</p><p><strong>The Three Things That Broke First (and How I Fixed Them)</strong></p><p><strong>1) Workers Could Not Reach Scheduler Reliably</strong></p><p>Distributed Dask lives or dies on connectivity.</p><p>What worked:</p><p>1. Created an ingress firewall rule on the scheduler VM.</p><p>2. Tagged the scheduler machine (`scheduler-vm-tag`) for clean targeting.</p><p>3. Whitelisted worker VM source IPs.</p><p>4. Exposed scheduler TCP port 8786.</p><p>5. Ran Docker with ` — network=host` to avoid container network surprises.</p><p>Example firewall rule:</p><blockquote>Name: Allow-Dask-Workers</blockquote><blockquote>Type: Ingress</blockquote><blockquote>Target: VM instances with tag ‘scheduler-vm-tag’</blockquote><blockquote>Source IPs: [Worker VM IP addresses]</blockquote><blockquote>Protocol: TCP</blockquote><blockquote>Port: 8786</blockquote><p><strong>2) Shared Memory Filled Up Mid-Run</strong></p><p>I kept seeing:</p><blockquote>OSError: No space left on device</blockquote><p>This usually points to `/dev/shm` being too small inside containers, especially with shuffle-heavy or memory-intensive operations.</p><p>Fix:</p><pre>- shm-size=32g</pre><p>I applied this on both scheduler and worker containers for consistency.</p><p><strong>3) GPU Workers Were Up, but Throughput Was Not</strong></p><p>It is possible to have all workers connected and still underperform because placement or process mapping is off.</p><p>I pinned one Dask worker per GPU using `CUDA_VISIBLE_DEVICES`, then validated on the Dask dashboard and with nvidia-smi.</p><p><strong>End-to-End Commands</strong></p><p><strong>Start Container on Each VM</strong></p><pre>docker run -it \<br> - runtime=nvidia \<br>-e NVIDIA_VISIBLE_DEVICES=all \<br> - network=host \<br> - shm-size=32g \<br>-v /home/user/project-repo:/repo \<br>-v /var/lib/nvidia/bin/nvidia-smi:/usr/bin/nvidia-smi \<br> - name dask_test \<br> - entrypoint /bin/bash \<br>&lt;your-container-registry&gt;/&lt;your-gpu-dask-image&gt;:latest</pre><p><strong>Start Scheduler (on main machine)</strong></p><blockquote>dask-scheduler — host 0.0.0.0 — port 8786 &amp;</blockquote><p><strong>Register GPU Workers (on each worker VM)</strong></p><blockquote>CUDA_VISIBLE_DEVICES=0 dask-cuda-worker tcp://&lt;scheduler-ip&gt;:8786 &amp;</blockquote><blockquote>CUDA_VISIBLE_DEVICES=1 dask-cuda-worker tcp://&lt;scheduler-ip&gt;:8786 &amp;</blockquote><blockquote>CUDA_VISIBLE_DEVICES=2 dask-cuda-worker tcp://&lt;scheduler-ip&gt;:8786 &amp;</blockquote><blockquote>CUDA_VISIBLE_DEVICES=3 dask-cuda-worker tcp://&lt;scheduler-ip&gt;:8786 &amp;</blockquote><p>After both VMs register workers, the cluster exposes 8 GPU workers.</p><p><strong>Verification Checklist Before Running Real Jobs</strong></p><p>1. Open dashboard (`http://scheduler-ip:8787`) and confirm all workers are visible.</p><p>2. Confirm each worker maps to the expected GPU.</p><p>3. Run one small Dask-CUDA workload and check GPU utilization patterns.</p><p>4. Watch for spilled memory, restarts, and task retries.</p><p>If these checks pass, you can trust your benchmark runs much more.</p><p><strong>Benchmarking: What I Measured First</strong></p><p>I treated benchmarks as a progression, not a one-shot number.</p><pre>import time<br>import statistics<br>import cupy as cp<br>import numpy as np<br>import dask.array as da<br>import dask.dataframe as dd<br>from dask.distributed import Client, wait<br><br><br>SCHEDULER_ADDRESS = &quot;tcp://localhost:8786&quot;<br>N_RUNS = 5<br><br><br>def connect_client():<br>    client = Client(SCHEDULER_ADDRESS)<br>    print(f&quot;Connected to: {SCHEDULER_ADDRESS}&quot;)<br>    print(f&quot;Dashboard:    {client.dashboard_link}&quot;)<br>    print(f&quot;Workers:      {len(client.scheduler_info()[&#39;workers&#39;])}&quot;)<br>    print(f&quot;Total GPUs:   {sum(w.get(&#39;gpu&#39;, {}).get(&#39;count&#39;, 1) for w in client.scheduler_info()[&#39;workers&#39;].values())}&quot;)<br>    print(&quot;-&quot; * 60)<br>    return client<br><br><br>def benchmark_matrix_multiply(client, size=10_000, n_runs=N_RUNS):<br>    &quot;&quot;&quot;CuPy matrix multiply distributed across workers.&quot;&quot;&quot;<br>    print(f&quot;\n[Benchmark] Matrix multiply ({size}x{size}), {n_runs} runs&quot;)<br><br>    def gpu_matmul(size):<br>        import cupy as cp<br>        x = cp.random.rand(size, size, dtype=cp.float32)<br>        y = cp.random.rand(size, size, dtype=cp.float32)<br>        result = cp.dot(x, y)<br>        cp.cuda.Stream.null.synchronize()<br>        return float(result[0, 0])<br><br>    times = []<br>    for i in range(n_runs):<br>        start = time.time()<br>        future = client.submit(gpu_matmul, size)<br>        _ = future.result()<br>        elapsed = time.time() - start<br>        times.append(elapsed)<br>        print(f&quot;  Run {i+1}: {elapsed:.3f}s&quot;)<br><br>    print(f&quot;  Mean: {statistics.mean(times):.3f}s | Std: {statistics.stdev(times):.3f}s&quot;)<br>    return times<br><br><br>def benchmark_dask_array(client, size=20_000, n_runs=N_RUNS):<br>    &quot;&quot;&quot;Distributed dask.array matmul across all workers.&quot;&quot;&quot;<br>    print(f&quot;\n[Benchmark] Dask array matmul ({size}x{size}), {n_runs} runs&quot;)<br><br>    n_workers = len(client.scheduler_info()[&quot;workers&quot;])<br>    chunk_size = size // max(n_workers, 1)<br><br>    times = []<br>    for i in range(n_runs):<br>        x = da.random.random((size, size), chunks=(chunk_size, chunk_size))<br>        y = da.random.random((size, size), chunks=(chunk_size, chunk_size))<br>        result = da.matmul(x, y)<br><br>        start = time.time()<br>        result.sum().compute()<br>        elapsed = time.time() - start<br>        times.append(elapsed)<br>        print(f&quot;  Run {i+1}: {elapsed:.3f}s&quot;)<br><br>    print(f&quot;  Mean: {statistics.mean(times):.3f}s | Std: {statistics.stdev(times):.3f}s&quot;)<br>    return times<br><br><br>def benchmark_dataframe(client, rows=10_000_000, n_runs=N_RUNS):<br>    &quot;&quot;&quot;Distributed groupby aggregation on dask dataframe.&quot;&quot;&quot;<br>    print(f&quot;\n[Benchmark] DataFrame groupby ({rows:,} rows), {n_runs} runs&quot;)<br><br>    n_workers = len(client.scheduler_info()[&quot;workers&quot;])<br>    n_partitions = n_workers * 4<br><br>    times = []<br>    for i in range(n_runs):<br>        df = dd.from_pandas(<br>            __import__(&quot;pandas&quot;).DataFrame({<br>                &quot;key&quot;: np.random.randint(0, 1000, size=rows),<br>                &quot;value&quot;: np.random.randn(rows),<br>            }),<br>            npartitions=n_partitions,<br>        )<br>        start = time.time()<br>        df.groupby(&quot;key&quot;).agg({&quot;value&quot;: [&quot;sum&quot;, &quot;mean&quot;, &quot;count&quot;]}).compute()<br>        elapsed = time.time() - start<br>        times.append(elapsed)<br>        print(f&quot;  Run {i+1}: {elapsed:.3f}s&quot;)<br><br>    print(f&quot;  Mean: {statistics.mean(times):.3f}s | Std: {statistics.stdev(times):.3f}s&quot;)<br>    return times<br><br><br>def benchmark_cupy_multi_worker(client, size=8_000, n_runs=N_RUNS):<br>    &quot;&quot;&quot;Submit one matmul per worker in parallel, measure total wall time.&quot;&quot;&quot;<br>    print(f&quot;\n[Benchmark] Parallel CuPy matmul across all workers ({size}x{size}), {n_runs} runs&quot;)<br><br>    def gpu_matmul(size):<br>        import cupy as cp<br>        x = cp.random.rand(size, size, dtype=cp.float32)<br>        y = cp.random.rand(size, size, dtype=cp.float32)<br>        result = cp.dot(x, y)<br>        cp.cuda.Stream.null.synchronize()<br>        return float(result.sum())<br><br>    n_workers = len(client.scheduler_info()[&quot;workers&quot;])<br>    times = []<br>    for i in range(n_runs):<br>        start = time.time()<br>        futures = [client.submit(gpu_matmul, size, pure=False) for _ in range(n_workers)]<br>        wait(futures)<br>        _ = [f.result() for f in futures]<br>        elapsed = time.time() - start<br>        times.append(elapsed)<br>        print(f&quot;  Run {i+1}: {elapsed:.3f}s ({n_workers} workers)&quot;)<br><br>    print(f&quot;  Mean: {statistics.mean(times):.3f}s | Std: {statistics.stdev(times):.3f}s&quot;)<br>    return times<br><br><br>def main():<br>    print(&quot;=&quot; * 60)<br>    print(&quot;SINGLE-NODE DISTRIBUTED GPU BASELINE&quot;)<br>    print(&quot;=&quot; * 60)<br><br>    client = connect_client()<br><br>    results = {}<br>    results[&quot;single_gpu_matmul&quot;] = benchmark_matrix_multiply(client)<br>    results[&quot;parallel_gpu_matmul&quot;] = benchmark_cupy_multi_worker(client)<br>    results[&quot;dask_array_matmul&quot;] = benchmark_dask_array(client)<br>    results[&quot;dataframe_groupby&quot;] = benchmark_dataframe(client)<br><br>    print(&quot;\n&quot; + &quot;=&quot; * 60)<br>    print(&quot;SUMMARY&quot;)<br>    print(&quot;=&quot; * 60)<br>    for name, times in results.items():<br>        print(f&quot;  {name:25s} | mean={statistics.mean(times):.3f}s  std={statistics.stdev(times):.3f}s&quot;)<br><br>    client.close()<br><br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><p><strong>Metrics That Matter</strong></p><ul><li>Throughput (data processed per second)</li><li>Latency (time for fixed-size jobs)</li><li>GPU utilization consistency (not just peak values)</li><li>Peak memory use per GPU</li><li>Scaling efficiency as workers increase</li></ul><p>I avoid setting hard performance expectations too early. First get stable behavior, then tune for higher throughput.</p><p><strong>Common Bottlenecks I Watch For</strong></p><p>1. Network saturation</p><ul><li>Symptom: speedup plateaus quickly.</li><li>Action: improve data locality, review network bandwidth.</li></ul><p>2. Scheduler overload</p><ul><li>Symptom: low GPU utilization while scheduler is busy.</li><li>Action: tune task granularity and scheduler resources.</li></ul><p>3. Memory pressure</p><ul><li>Symptom: OOM, spill storms, worker restarts.</li><li>Action: increase shared memory, rebalance partition sizes.</li></ul><p>4. Inter-GPU transfer overhead</p><ul><li>Symptom: communication dominates runtime.</li><li>Action: optimize placement, use faster links (for example NVLink) when available.</li></ul><p><strong>What This Setup Gives Me Today</strong></p><ul><li>2 VMs with 4 T4 GPUs each</li><li>Host-networked containers</li><li>8 active GPU workers ready for distributed jobs</li></ul><p>The biggest lesson: multi-GPU scaling is usually limited by systems details before it is limited by your model code. Once networking, memory, and worker pinning are solid, Dask becomes a very practical way to scale Python GPU workloads from one machine to many.</p><p>If you are moving from a single-node GPU setup to a distributed cluster, start with correctness and observability first. The speedups come much faster after that.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd35a2788649" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dunnhumby-data-science-engineering/how-i-deployed-dask-cuda-across-8-gpus-operations-checklist-benchmark-setup-fd35a2788649">How I Deployed Dask-CUDA Across 8 GPUs: Operations Checklist &amp; Benchmark Setup</a> was originally published in <a href="https://medium.com/dunnhumby-data-science-engineering">dunnhumby Science blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>