<?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 Christoph Schranz on Medium]]></title>
        <description><![CDATA[Stories by Christoph Schranz on Medium]]></description>
        <link>https://medium.com/@cschranz?source=rss-96c791a49712------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MQbYxoY8EiKkXv2P2sUJUw.jpeg</url>
            <title>Stories by Christoph Schranz on Medium</title>
            <link>https://medium.com/@cschranz?source=rss-96c791a49712------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 05:27:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cschranz/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[ Reproducible Deep Learning Experiments with One Command: GPU-Jupyter]]></title>
            <link>https://cschranz.medium.com/dockerized-gpu-jupyter-for-reproducible-research-for-ml-and-ai-a596362b164e?source=rss-96c791a49712------2</link>
            <guid isPermaLink="false">https://medium.com/p/a596362b164e</guid>
            <category><![CDATA[reproducible-research]]></category>
            <category><![CDATA[gpu-computing]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Christoph Schranz]]></dc:creator>
            <pubDate>Mon, 01 Jan 2024 16:01:47 GMT</pubDate>
            <atom:updated>2025-03-31T07:08:25.251Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QIVl6i3UNxemhmkRWPQ8MA.png" /><figcaption>GPU-Jupyter: Your GPU-accelerated JupyterLab with a rich data science toolstack, TensorFlow and PyTorch for your reproducible deep learning experiments.</figcaption></figure><h3>🚨 The Reproducibility Crisis in ML &amp; DL</h3><p>In science, reproducibility is a cornerstone of credibility. But in the fast-evolving field of machine learning (ML) and deep learning (DL), reproducing research has become unexpectedly difficult. A recent meta-study showed that only about 6% of papers at leading AI conferences shared their code, and only a third shared their data. Reproducibility is further hampered by vague setup instructions, missing package versions, and evolving GPU dependencies.</p><p>This setup barrier is particularly severe in ML/DL, where:</p><ul><li>A high number of libraries (stacks) are required</li><li>Hardware access (e.g., GPUs) is essential, and</li><li>Versions change frequently (think TensorFlow, PyTorch, etc.).</li></ul><p>Without a reproducible setup, research cannot be trusted or reused.</p><h3>🏛️ The Four Pillars of Reproducible Research</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PlGSTUuhj1N54G_B-vsgDw.png" /><figcaption>The four pillars of reproducibility in deep learning: Open code managed by a<br>version control system, open and publicly available data, the usage of initialization seeds<br>for random functions, and a reproducible installation setup. GPU-Jupyter addresses<br>the fourth pillar, open setup.</figcaption></figure><p>Reproducibility isn’t just about sharing code and data — it’s about ensuring others can run your exact setup. The four pillars are:</p><ol><li><strong>Open Code</strong> — Version-controlled, readable, and executable.</li><li><strong>Open Data</strong> — Publicly accessible, referable datasets.</li><li><strong>Random Seeds</strong> — For controlled randomness.</li><li><strong>Open Setup</strong> — The full environment, from OS to GPU drivers, should be reproducible.</li></ol><p>While many efforts cover the first three, the <strong>Open Setup</strong> is often overlooked — and this is where <strong>GPU-Jupyter</strong> shines.</p><h3>🚀 Meet GPU-Jupyter: Reproducibility with One Command</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T4AB9Fk6oZyYMrkvSsv4ug.png" /><figcaption>Conceptual layers of the GPU-Jupyter framework.</figcaption></figure><p>GPU-Jupyter is an open-source framework that packages the entire DL environment — including CUDA drivers, JupyterLab, ML libraries, and system-level configurations — into <strong>Docker containers</strong>. These containers are:</p><ul><li><strong>GPU-accelerated</strong></li><li><strong>Fully isolated from your host system</strong></li><li><strong>Customizable and taggable</strong></li><li><strong>Launchable with a single command</strong></li></ul><blockquote><strong><em>One-command reproducibility</em></strong><em> becomes a reality:<br></em><em>docker run --gpus all -p 8888:8888 cschranz/gpu-jupyter:&lt;tag&gt;</em></blockquote><h3>Why Docker?</h3><p>Docker ensures OS-level isolation. That means:</p><ul><li>You don’t pollute your local machine version dependencies.</li><li>Conflicts between TensorFlow, PyTorch, or CUDA versions are avoided.</li><li>You can <strong>freeze</strong> and <strong>share</strong> environments via tagged images.</li></ul><h3>🧰 Standard vs. Customized Images</h3><p>GPU-Jupyter supports both:</p><h3>✅ Standard Images</h3><p>Use pre-built, maintained containers from DockerHub:</p><pre>docker run --gpus all -p 8888:8888 cschranz/gpu-jupyter:v1.9_cuda-12.6_ubuntu-24.04</pre><h3>🛠️ Customized Images</h3><p>Need your own packages, scripts, or dataset downloads? You can build your own reproducible container:</p><pre>git clone https://github.com/iot-salzburg/gpu-jupyter<br>bash generate-Dockerfile.sh --python-only<br>docker build -t my-custom-gpu-jupyter .build/</pre><p>To share, push to DockerHub or your own registry.</p><blockquote><em>Example:<br></em><em>docker run --gpus all -p 8888:8888 my-user/my-custom-gpu-jupyter:v1.0</em></blockquote><p>Full example repo: <a href="https://github.com/iot-salzburg/reproducible-research-with-gpu-jupyter">github.com/iot-salzburg/reproducible-research-with-gpu-jupyter</a></p><h3>🔄 Use Cases</h3><h3>1. Publish Reproducible Research</h3><p>Cite the Docker image used in your paper:</p><pre>All experiments were run using the image `cschranz/gpu-jupyter:v1.9_cuda-12.6_ubuntu-24.04`</pre><h3>2. Reproduce a GPU-Jupyter-based Project</h3><pre>docker run --gpus all -p 8888:8888 cschranz/gpu-jupyter:&lt;tag&gt;</pre><h3>3. Reproduce a Custom Image</h3><p>If the author published their own Docker image:</p><pre>docker run --gpus all -p 8888:8888 their-user/custom-image:tag</pre><h3>4. Make Any Old Project Reproducible</h3><p>Use a base GPU-Jupyter image, install original dependencies, and you’re done — no more dependency hell.</p><h3>🧑‍💻 Example in Action</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ONAFVVQ2osyltYgC.png" /><figcaption>GPU-Jupyter provides a light-weight Jupyterlab IDE. Additionally, the kernel can be accessed from professional IDEs.</figcaption></figure><p>Here’s a sample session in <strong>Visual Studio Code</strong>, connected to a <strong>GPU-Jupyter container</strong> running remotely. The environment is isolated, version-controlled, and replicable by anyone with the image.</p><h3>📚 Citing GPU-Jupyter (Paper under Review)</h3><p>The scientific foundation of GPU-Jupyter is discussed in the preprint:</p><blockquote><em>Schranz, C., Pilosov, M., Beeking, M. (2024). GPU-Jupyter: A Framework for Reproducible Deep Learning Research.<br></em><a href="https://github.com/iot-salzburg/gpu-jupyter"><em>GitHub</em></a><em> | Paper PDF</em></blockquote><p>It emphasizes:</p><ul><li>The reproducibility crisis in ML</li><li>The need for full-stack setups</li><li>The role of Docker containers for experiment isolation</li></ul><h3>💡 Final Thoughts</h3><p>Reproducible research isn’t optional — it’s a necessity. Especially in ML/DL, where GPU acceleration, fast-changing libraries, and complex workflows dominate.</p><p>With GPU-Jupyter, you get:</p><ul><li>🧠 Reproducibility from code to CUDA</li><li>🧰 Docker-based OS isolation</li><li>📦 Shareable, taggable container images</li><li>🧪 Reproduction with one command</li></ul><p><strong>Try it, cite it, and make reproducibility your default.</strong><br>Start here 👉 <a href="https://github.com/iot-salzburg/gpu-jupyter">https://github.com/iot-salzburg/gpu-jupyter</a></p><h3>The whole GPU-Jupyter Series:</h3><ul><li><a href="https://medium.com/p/e0d45fcacf43">Set up Your own GPU-based Jupyter easily using Docker</a>.</li><li><a href="https://cschranz.medium.com/connect-vs-code-to-your-remote-gpu-jupyter-instance-58b86a195d9e">Learn how to connect VS Code to your remote GPU-Jupyter instance</a> to incorporate the advantages of an IDE and the GPU-Jupyter.</li><li><a href="https://cschranz.medium.com/dockerized-gpu-jupyter-for-reproducible-research-for-ml-and-ai-a596362b164e">🧪 Reproducible Deep Learning Experiments with One Command: GPU-Jupyter</a></li></ul><p><strong>Enjoy running your own code on the GPU :)</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a596362b164e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[️ Connect VS Code to Your Remote GPU-Jupyter Instance — Step by Step for a Deep Learning IDE]]></title>
            <link>https://cschranz.medium.com/connect-vs-code-to-your-remote-gpu-jupyter-instance-58b86a195d9e?source=rss-96c791a49712------2</link>
            <guid isPermaLink="false">https://medium.com/p/58b86a195d9e</guid>
            <category><![CDATA[jupyter]]></category>
            <category><![CDATA[reproducible-research]]></category>
            <category><![CDATA[gpu-computing]]></category>
            <category><![CDATA[remote-computing]]></category>
            <dc:creator><![CDATA[Christoph Schranz]]></dc:creator>
            <pubDate>Tue, 07 Mar 2023 09:00:00 GMT</pubDate>
            <atom:updated>2025-03-31T07:09:35.122Z</atom:updated>
            <content:encoded><![CDATA[<p>Do you want to combine the power of GPU-accelerated Jupyter environments with the familiarity and features of your favorite IDE? With <a href="https://github.com/iot-salzburg/gpu-jupyter">GPU-Jupyter</a> and <a href="https://code.visualstudio.com/">Visual Studio Code</a> (VS Code), you can code, test, and run ML experiments remotely while keeping your local setup clean and productive.</p><p>Many developers are unaware of a powerful feature that is not provided by most free IDEs — the ability to connect to remote servers. This article shows how to connect VS Code to a remote GPU-Jupyter container — and why it’s a game changer for machine learning workflows.</p><h3>✅ Prerequisites</h3><p>1. A <strong>local machine</strong> on which you prefer to develop with <a href="https://code.visualstudio.com/">VS Code</a>.</p><p>2. A <strong>remote deep learning server with an NVIDIA GPU.</strong> Make sure <a href="https://github.com/iot-salzburg/gpu-jupyter"><strong>GPU-Jupyter</strong></a> is already set up using <strong>Docker</strong>. <em>Why GPU-Jupyter?</em> It offers isolated, scalable environments tailored for reproducible data science projects. For a comprehensive setup guide, refer to our <a href="https://cschranz.medium.com/dockerized-gpu-jupyter-for-reproducible-research-for-ml-and-ai-a596362b164e">Medium article</a> and the <a href="https://github.com/iot-salzburg/gpu-jupyter">GitHub repository</a>. In the deep learning server, GPU-Jupyter provides <strong>Jupyterlab</strong>, a light-weight IDE. <strong>Jupyter’s Python kernel can be connected with VS Code for improved IDE features.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2bUGcp-To2VVYctj.png" /><figcaption>The JupyterLab interface of GPU-Jupyter provides access to a GPU-accelerated environment with support for Julia, Python, and R — hence the playful name “JuPyt&amp;R”, or simply Jupyter. VS Code can seamlessly connect to these remote kernels for an enhanced development experience.</figcaption></figure><h3>🔧 Step 1: Install Code-Server on the Remote Machine</h3><p>To enable VS Code to interface with the remote server, install <a href="https://github.com/coder/code-server">code-server</a> on your GPU-equipped server:​</p><p><strong>Install Code-Server</strong>:</p><pre>curl -fsSL https://code-server.dev/install.sh | sh</pre><p><strong>Start and Enable Code-Server</strong>:</p><pre>sudo systemctl start code-server@$USER <br>sudo systemctl enable --now code-server@$USER</pre><p><em>Note</em>: Replace $USER with your actual username (or make sure this environment variable is set). This setup ensures code-server launches on startup.</p><h3>⚙️ Step 2: Set up the local VS Code</h3><p>Install and open <a href="https://code.visualstudio.com/download">VS Code</a> on the local machine on which you want to work with this IDE.</p><h4>✨ 2.1 Install Extensions in VS Code</h4><p>Open a new window in VS Code and install the following Extensions:</p><blockquote>Python<br>Jupyter<br>Remote - SSH</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*_nYxhCua0NZq7MeYujwc5g.png" /><figcaption>UI of VS Code, search for the extensions and install them.</figcaption></figure><h4>🌐 2.2 Connect in VS Code to the Server via SSH</h4><p>In the bottom-left corner click the green <strong>&gt;&lt;</strong> icon to open a remote window. Choose <strong>“Connect to Host…”</strong> and enter your SSH address:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/205/1*M_QNGhAw8DF1V5xZit08Ww.png" /></figure><pre>ssh your-username@your-remote-ip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*ZVxEz-LH_NfbjF5z--lO3Q.png" /><figcaption>Here, the username is “cschranz” and the deep learning server is “dsws”.</figcaption></figure><p>Once connected, open a project folder on the remote system. You’ll now see the remote machine in the VS Code sidebar and status bar.</p><blockquote>Note messages popping up in VS Code’s UI, you have to enter the remote OS, a keyfile, or your password.</blockquote><p>If you see a connection similar to here, you are connected to the remote machine via SSH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*i2sR84K-5KE2_J8Y_pR6Vw.png" /></figure><h4>📦 2.3 Open the Project Directory</h4><p>Now open the project directory in which you want to develop on the deep learning server. Therefore, open the Explorer, “Open Folder” and specify a directory on the remote machine. Then confirm with your password and that you are trusting the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*hz9mzm4VBTKxMAejiofZuw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*7OpXDtW_8dep3PleXm7YmA.png" /></figure><h3>🧪3. Connect VS Code to the Remote GPU-Jupyter Kernel</h3><p>Start by opening an existing Jupyter Notebook (.ipynb) in VS Code—or create a new one.</p><p>Then:</p><ol><li><strong>Run any cell</strong> using Shift + Enter.<br> A prompt will appear at the top asking how to connect to a Jupyter server.</li><li><strong>Select “Existing Jupyter Server”</strong> and then <strong>“Enter the URL of the running Jupyter Server”</strong>.</li><li><strong>Get the URL of your running Jupyter Server</strong> (including the token).<br> You can retrieve it directly from the SSH terminal inside VS Code:</li></ol><pre>docker exec -it &lt;container_name_or_id&gt; jupyter server list<br><br># Example output<br>http://your-remote-ip:8888/?token=abcd1234...</pre><p><strong>Paste this URL into the prompt in VS Code.</strong><br> It should include:</p><ul><li>Hostname or IP address (including http(s)://)</li><li>Port exposed by Docker</li><li>The access token</li></ul><p><strong>Choose the appropriate kernel</strong> (e.g., “Python 3”) from the available list.<br> You’re now connected to your remote GPU-powered Jupyter environment!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*csUuiSeTncGUoH_1YO9iKQ.png" /><figcaption>GPU-Jupyter is here available on the server “dsws” on port 22201.</figcaption></figure><p>We are connected both to the directory per SSH and to the GPU-accelerated Jupyter kernel. Now, we can run code remotely:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A51f1P9V5QWvZKU7Wt0UCA.png" /><figcaption>VS Code connected to a remote machine able to compute on a GPU.</figcaption></figure><p>✨ This also works for standard Python .py files — just ensure the right interpreter is selected in the VS Code status bar.</p><p>Here’s a clean and well-integrated version of that section, tailored for your blog article. It keeps your Docker-first philosophy, but offers the optional path for enhanced code inspection and linting in VS Code:</p><h4>🧠 Optional: Enable Code Inspection with Pylint using a local Python Virtual Environment</h4><p>While VS Code offers excellent support for running Jupyter Notebooks via remote kernels, <strong>code inspection (linting, pylint, etc.) does not yet work out-of-the-box with remote Jupyter kernels inside Docker containers</strong>.</p><p>To enable tools like Pylint to inspect your code correctly, you can create a lightweight virtual environment on the remote machine via SSH (even though it&#39;s outside the container). This setup doesn&#39;t affect your Docker-based runtime but helps with code editing in VS Code.</p><ol><li><strong>Install </strong><strong>virtualenv (if not already installed):<br></strong>sudo apt install python3-virtualenv</li><li><strong>Create and activate a virtual environment:<br></strong>virtualenv venv source venv/bin/activate</li><li><strong>Install your project’s dependencies:<br></strong>pip install -r path/to/requirements.txt</li><li><strong>Get the path to your virtual environment’s Python binary:<br></strong>which python # Example output: /home/username/project/venv/bin/python</li><li><strong>In VS Code</strong>, open the <strong>Command Palette</strong> (Ctrl+Shift+P) and run:<br>Python: Select Interpreter</li><li><strong>Manually paste the path</strong> to your virtual environment’s Python executable (e.g. /path/to/venv/bin/python).</li><li>Restart the linter:<br>Pylint: Restart Server</li><li>Optionally reload the window: Ctrl+Shift+P → Reload Window.</li></ol><blockquote><em>💡 If the PyLance linter shows false positives, you can disable or uninstall it for your workspace.</em></blockquote><p>⚠️ <strong>Note</strong>: Your actual code execution will still happen in the Docker container via the selected Jupyter kernel. This setup is only for improving the <strong>editor experience (code inspection and linting)</strong> while working on your code.</p><h3>📦 Part of the GPU-Jupyter Series</h3><ul><li><a href="https://cschranz.medium.com/set-up-your-own-gpu-based-jupyterlab-e0d45fcacf43">🐳 Set up Your own GPU-based Jupyter easily using Docker.</a></li><li><a href="https://cschranz.medium.com/connect-vs-code-to-your-remote-gpu-jupyter-instance-58b86a195d9e">🖥️ Connect VS Code to Your Remote GPU-Jupyter Instance — Step by Step for a Deep Learning IDE</a></li><li><a href="https://cschranz.medium.com/dockerized-gpu-jupyter-for-reproducible-research-for-ml-and-ai-a596362b164e">🧪 Reproducible Deep Learning Experiments with One Command: GPU-Jupyter | by Christoph Schranz | Medium</a></li></ul><p>Happy coding on your own GPU!😄</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58b86a195d9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Set up your own GPU-based Jupyterlab]]></title>
            <link>https://cschranz.medium.com/set-up-your-own-gpu-based-jupyterlab-e0d45fcacf43?source=rss-96c791a49712------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0d45fcacf43</guid>
            <category><![CDATA[jupyter-notebook]]></category>
            <category><![CDATA[nvidia-docker]]></category>
            <category><![CDATA[ubuntu-19]]></category>
            <category><![CDATA[cuda]]></category>
            <category><![CDATA[pytorch]]></category>
            <dc:creator><![CDATA[Christoph Schranz]]></dc:creator>
            <pubDate>Fri, 27 Dec 2019 16:46:01 GMT</pubDate>
            <atom:updated>2026-01-09T15:08:14.694Z</atom:updated>
            <content:encoded><![CDATA[<h3>Set up Your own GPU-based Jupyter easily using Docker</h3><p>In some small steps, you will be guided to set up Your own instance of a <a href="https://github.com/iot-salzburg/gpu-jupyter">GPU-leveraged Juypyterlab</a>, that provides you with all machine learning libraries you are familiar with. This will enable you to use the flexibility of <strong>Jupyterlab</strong> and run your code in <strong>Tensorflow</strong> and <strong>PyTorch</strong> with an accelerated performance on your <strong>NVIDIA GPU</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G228q5gT7RY2ZrXzy5U4bw.png" /><figcaption>Overview of the <a href="https://github.com/iot-salzburg/gpu-jupyter">GPU-Jupyter</a> UI.</figcaption></figure><p>The corresponding code repository is <a href="https://github.com/iot-salzburg/gpu-jupyter">iot-salzburg/GPU-Jupyter</a> and the images are provided on <a href="https://hub.docker.com/r/cschranz/gpu-jupyter">Dockerhub</a>. More about this later :)</p><h4><strong>Requirements:</strong></h4><p>1. A computer including an NVIDIA GPU (a desktop PC or server)</p><h4><strong>The installation consists of the following steps:</strong></h4><p>1. Setup of Ubuntu 24.04<br>2. Installation of NVIDIA drivers and CUDA<br>3. (Optional) Validation of the CUDA Installation on the host system<br>4. Install Docker<br>5. Install NVIDIA Container Toolkit<br>6. Deployment of GPU-Jupyter via Docker</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T4AB9Fk6oZyYMrkvSsv4ug.png" /><figcaption>Architecture of the GPU-Juypter image on a NVIDIA GPU with CUDA and Docker.</figcaption></figure><h3>Setup of Ubuntu</h3><p>This guide was tested for <strong>Ubuntu 18.04 LTS, 20.04 LTS, 22.04 LTS, and 24.04 LTS. </strong><a href="https://ubuntu.com/blog/ubuntu-19-10-delivers-kubernetes-at-the-edge-multi-cloud-infrastructure-economics-and-an-integrated-ai-ml-developer-experience">Canonical announced</a> that from version 19 on, they come with better support for Kubernetes and AI/ML developer experience. Both the Desktop and Server image can be used. Here we go with a minimal installation of the Desktop image which includes a browser and necessary packages. If you don’t have your own setup with an NVIDIA GPU, check out <a href="https://saturncloud.io/?utm_source=Medium+&amp;utm_medium=TDS&amp;utm_campaign=ChristophSchranz&amp;utm_term=GPUJupyter">Saturn Cloud</a> for a free environment.</p><h4><strong>Set a static IP via netplan</strong></h4><p>Jupyterlab has to be accessed remotely via its IP address from other nodes. The preferred way to do so is to adapt the <a href="https://netplan.io/">netplan </a>configuration. Therefore, upgrade and install basic packages and dependencies.</p><pre>sudo apt update &amp;&amp; sudo apt upgrade -y &amp;&amp; sudo apt autoremove -y<br>sudo apt-get install build-essential gcc g++ make binutils net-tools<br>sudo reboot</pre><p>Now configure <strong><em>etc/netplan/01-network-manager-all.yaml</em></strong> analog to this example, where the network device is called <strong><em>eno1</em>,</strong> the IP address <strong>192.168.48.48 </strong>is used and the additional DNS servers are <strong>192.168.48.2 </strong>and <strong>192.168.48.3</strong>. Make also sure that your network administrator registers the computer with the specified IP.</p><pre>sudo nano <em>etc/netplan/01-network-manager-all.yaml  # configure the static ip similar as shown below:</em></pre><pre># Let NetworkManager manage all devices on this system<br>network:<br>  version: 2<br>  renderer: NetworkManager<br>  ethernets:<br>    eno1:<br>      addresses: [192.168.48.48/24]<br>    routes: <br>      - to: default<br>        via: 192.168.48.1<br>      nameservers:<br>        addresses: [192.168.48.2,192.168.48.3,8.8.8.8,4.4.4.4]</pre><pre># create the configuration and apply in debug mode<br>sudo netplan generate<br>sudo netplan apply --debug</pre><p>Now it should be possible to ping your workstation.</p><h4><strong>Activate SSH</strong></h4><p>In order to access and maintain the server remotely, SSH has to be installed and enabled:</p><pre>sudo ufw allow 22<br>sudo apt update<br>sudo apt install openssh-server<br>sudo systemctl status ssh<br>sudo systemctl enable ssh</pre><p>It should now be possible to access the server node from other devices in the same network, e.g. via:</p><pre>ssh username@192.168.48.48</pre><blockquote>You also might want to share the public key such that you don’t need the password for ssh:</blockquote><pre>ssh-keygen  # don&#39;t override an existing key, select an empty password<br>sudo ssh-copy-id -i ~/.ssh/id_rsa.pub username@192.168.48.48 <br>ssh username@192.168.48.48</pre><h3>Installation of CUDA and NVIDIA drivers</h3><p><a href="https://developer.nvidia.com/cuda-zone">CUDA</a> is a driver package to access the NVIDIA GPU within programming languages. In case there already exists a CUDA version, first uninstall it:</p><pre># check if nvidia is already installed<br>apt list --installed | grep &#39;nvidia&#39;<br># if CUDA was installed with a *.run-file, uninstall it this way<br>sudo /usr/local/cuda-11.6/bin/cuda-uninstaller<br>sudo /usr/bin/nvidia-uninstall<br># otherwise, remove all existng nvidia and cuda installations</pre><p>Then select a version that is compatible with PyTorch and Tensorflow, you can check the versions for <a href="https://pytorch.org/get-started/locally/">PyTorch </a>and <a href="https://www.tensorflow.org/install/source#gpu">Tensorflow</a>. If not sure, stick to a version for which already pre-built <a href="https://github.com/iot-salzburg/gpu-jupyter/blob/master/extra/README-versions.md">GPU-Jupyter images exist</a>. Here, we install <a href="https://developer.nvidia.com/cuda-11.2.2-download-archive?target_os=Linux&amp;target_arch=x86_64&amp;target_distro=Ubuntu&amp;target_version=2004&amp;target_type=runfilelocal">CUDA 12.9.1</a>. <strong>A list of the available CUDA-drivers is </strong><a href="https://developer.nvidia.com/cuda-toolkit-archive"><strong>here</strong></a>. Click on “accept” and install all packages, so the NVIDIA-drivers with version 510.47.03 and CUDA with version 11.6.2.</p><h4>Add Keyring to allow automatic updates in the system</h4><pre>wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb<br>sudo dpkg -i cuda-keyring_1.1-1_all.deb<br>sudo apt-get update</pre><p>In case there are duplicates, create a backup-dir and rm duplicates in /etc/apt/sources.list.d/</p><pre>ls /etc/apt/sources.list.d/<br>mkdir apt_sources_bac<br>cp -r /etc/apt/sources.list.d/ apt_sources_bac/<br>rm /etc/apt/sources.list.d/[duplicate-package].list*</pre><h4>Install CUDA</h4><p>After that, a GPU driver is installed that allows a CUDA version supported by PyTorch and Tensorflow. Here, version 12.9.1 is installed</p><pre>sudo apt update<br>apt policy cuda  # check available versions of cuda<br>sudo apt install cuda-toolkit=12.9.1<br>apt policy nvidia-gds  # check available versions of nvidia-gds<br>sudo apt install nvidia-gds=12.9.1</pre><p>In some cases, it is required to manually install the NVIDIA drivers before cuda/cuda-toolkit. Each CUDA version requires a specific range of NVIDIA drivers, which are specified <a href="https://docs.nvidia.com/deploy/cuda-compatibility/minor-version-compatibility.html">here</a> with support dates of driver releases <a href="https://endoflife.date/nvidia">here</a>. When needed and the respective is found, run:</p><pre>sudo apt install nvidia-driver-580-open</pre><p>It is recommended to set the package versions of CUDA and NVIDIA drivers on hold, to prevent them from upgrades. Freeze them using the following command:</p><pre>sudo apt-mark hold cuda-toolkit<br>sudo apt-mark hold nvidia-gds</pre><h4><strong>CUDA post-install actions</strong></h4><p>After a reboot, this command now displays the utilization of the NVIDIA GPU and the CUDA drivers. Note this command shows the highest supported CUDA version and not the installed one.</p><pre>sudo reboot<br>nvidia-smi</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*62zYLKza6L26IAzSszfAYA.png" /><figcaption>Example output, hardware and driver versions are listed.</figcaption></figure><blockquote>Tipp: To monitor the memory and usage of the GPU over time, use Ubuntu’s <a href="https://manpages.ubuntu.com/manpages/trusty/man1/watch.1.html">watch</a>-command:</blockquote><pre>watch -n0 nvidia-smi</pre><blockquote>In case nvidia-smi has problems finding the appropriate CUDA paths, you may have to manually set them. Set the following paths and append both lines in your local ~/.bashrc or ~/.zshrc file, to set the path after each reboot. Note that `/usr/local/cuda/` is a symlink of `/usr/local/cuda-[version]/`.</blockquote><pre>export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}<br>export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}</pre><blockquote>Now, re-open your terminal before continuing to the next step or run:<br>source ~/.bashrc</blockquote><p>You also might want to do this installation to use tools like <em>nvcc </em>to show the actual installed CUDA version:</p><pre>sudo apt install nvidia-cuda-toolkit<br>nvcc --version</pre><h3>(Optional) Validation of the CUDA Installation on the host system</h3><blockquote>Note that we don’t install CudNN, because we are running the GPU-libaries within Docker. The Docker base-image that we will use, comes with CudNN. In case you want to run GPU-libraries in production on the host OS, we recommend to install <a href="https://developer.nvidia.com/cudnn">CUDA Deep Neural Network (cuDNN)</a>.</blockquote><p>This step requires the installation of Anaconda, which provides a well-maintained toolstack for statistical computing. The installation is described <a href="https://www.digitalocean.com/community/tutorials/how-to-install-the-anaconda-python-distribution-on-ubuntu-20-04-quickstart">here</a>, but if you are confident that everything works fine, you can skip this step. Otherwise, install Anaconda as described in the link and then create a virtual environment for the CUDA libraries:</p><pre>conda create --name cuda_env<br>conda activate cuda_env</pre><p>To deactivate the virtual environment, run: conda deactivate</p><p>Install <strong>PyTorch</strong> via these commands and specify the appropriate CUDA-Toolkit version: (see <a href="https://pytorch.org/get-started/locally/">this</a> for more info)</p><pre>conda activate cuda_env<br>conda install numpy pyyaml mkl mkl-include setuptools cmake cffi typing<br>conda install pytorch torchvision cudatoolkit=10.1 -c pytorch</pre><pre>python<br>&gt; # validate PyTorch:<br>&gt; from __future__ import print_function<br>&gt; import torch<br>&gt; x = torch.rand(5, 3)<br>&gt; print(x) </pre><p>The output should be a PyTorch tensor of the form:</p><pre>tensor([[0.3380, 0.3845, 0.3217],<br>        [0.8337, 0.9050, 0.2650],<br>        [0.2979, 0.7141, 0.9069],<br>        [0.1449, 0.1132, 0.1375],<br>        [0.4675, 0.3947, 0.1426]])</pre><p>Now, check if CUDA can be accessed via PyTorch</p><pre>conda activate cuda_env</pre><pre>python<br>&gt; import torch<br>&gt; torch.cuda.is_available()  # The output should be a boolean &quot;True&quot;<br>True<br>&gt; device = torch.device(&quot;cuda&quot;)          # a CUDA device object<br>&gt; x = torch.rand(10000, 10, device=device) # create tensor on GPU</pre><p>A similar test can be done via <strong>Tensorflow</strong>:</p><pre>conda activate cuda_env<br>pip install --upgrade tensorflow-gpu</pre><pre>python<br>&gt; from tensorflow.python.client import device_lib<br>&gt; device_lib.list_local_devices()</pre><p>The command should yield the built-in GPUs.</p><h3>Install Docker, Docker-compose and NVIDIA Docker</h3><p>Docker is an excellent tool to make an installation reproducible for others and to set up a complex environment such as ours with a single command. To install <a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04">Docker </a>and <a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04">Docker-compose</a>, please run the commands below or follow the linked compact guides from Digital Ocean. The preferred Ubuntu version can be chosen in the drop-down menu of the guides.</p><h4>Install Docker</h4><pre>sudo apt update<br>sudo apt install apt-transport-https ca-certificates curl software-properties-common<br>curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -<br>sudo add-apt-repository &quot;deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable&quot;<br>apt-cache policy docker-ce  # to check the installation candidate<br>sudo apt install docker-ce<br>sudo systemctl status docker  # check the systemctl status of the docker-service<br>docker  # help for docker<br>sudo docker run hello-world  # check if pulling and running works</pre><p>Executing the Docker Command Without sudo (required for docker-compose)</p><pre>sudo usermod -aG docker ${USER}<br>su - ${USER}<br>groups  # check if docker is listed<br>sudo usermod -aG docker ${USER}<br>docker run hello-world # check if it works without sudo</pre><h4>Install Docker-compose</h4><pre>mkdir -p ~/.docker/cli-plugins/<br>curl -SL https://github.com/docker/compose/releases/download/v2.3.3/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose<br>chmod +x ~/.docker/cli-plugins/docker-compose<br>docker compose version  # check the version</pre><h4><strong>Install NVIDIA Docker</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*0Ugi8kcY0MMi3fCkLJdslA.png" /><figcaption>NVIDIA Docker allows Docker Applications to use the host’s GPU.</figcaption></figure><p>In the default installation, Docker is not able to forward tasks to the GPU. To do so, <a href="https://github.com/NVIDIA/nvidia-docker">NVIDIA Container Toolkit</a> has to be installed:</p><pre>sudo apt-get update<br>sudo apt install nvidia-container-toolkit<br>sudo reboot</pre><p>Now, Docker should be able to access the GPU. In order to validate this step, the appropriate version of the Docker Image nvidia/cuda is pulled and the CUDA driver is tested:</p><pre>docker run --rm --gpus all nvidia/cuda:12.9.1-cudnn-runtime-ubuntu24.04 nvidia-smi</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z_-NtivXFY61A_Cm99foCA.png" /><figcaption>The output of the command “nvidia-smi” run inside a Docker container.</figcaption></figure><blockquote>In some cases it makes sense to define a <em>docker runtime</em>. Just set the parameter &quot;runtime=nvidia&quot; in<em> </em>the config file <em>/etc/docker/daemon.json,</em> which might was not initially created yet.</blockquote><pre>{<br>    &quot;default-runtime&quot;: &quot;nvidia&quot;,<br>    &quot;runtimes&quot;: {<br>        &quot;nvidia&quot;: {<br>            &quot;path&quot;: &quot;/usr/bin/nvidia-container-runtime&quot;,<br>            &quot;runtimeArgs&quot;: []<br>        }<br>    }<br>}</pre><p>Then test the static config: (the commands should yield the same result but without the docker parameter)</p><pre>sudo systemctl daemon-reload &amp;&amp; sudo systemctl restart docker<br>docker run --rm --gpus all nvidia/cuda:12.9.1-cudnn-runtime-ubuntu24.04 nvidia-smi</pre><p>If you have troubles here or are interested in more details, check out the official<a href="https://github.com/NVIDIA/nvidia-docker"> nvidia-cuda project site</a>.</p><h3>Deployment of GPU-Jupyter via Docker</h3><p>Now, we are ready to pull and run <a href="https://github.com/iot-salzburg/gpu-jupyter">GPU Jupyter</a> locally (checkout available tags on <a href="https://hub.docker.com/repository/docker/cschranz/gpu-jupyter/tags?page=1&amp;ordering=last_updated">Dockerhub</a>):</p><pre>cd your-working-directory<br>ll data  # this path will be mounted by default<br>docker run --gpus all -it -p 8848:8888 -v $(pwd)/data:/home/jovyan/work -e GRANT_SUDO=yes -e JUPYTER_ENABLE_LAB=yes --user root cschranz/gpu-jupyter:v1.10_cuda-12.9_ubuntu-24.04</pre><p>Find more information on how to configure <a href="https://github.com/iot-salzburg/gpu-jupyter">GPU-Jupyter on its GitHub repository</a>.</p><p>Building a local image will take some time and requires a high data volume. So make sure you aren’t in the hotspot of a mobile phone. Take a break instead, walk in the fresh air, or fetch a coffee and chat with your colleagues and friends. :)</p><p>After some time, <strong>GPU Jupyter </strong>will be available on <strong><em>localhost:8848</em></strong> in the Web browser. In case you are new to the Jupyter project, click <a href="https://www.youtube.com/watch?v=CwFq3YDU6_Y">here</a> for a nice summary. The <strong>default password</strong> is gpu-jupyter and should be updated as described in the last section. If the image is pulled, you have to specify for the first time the jupyter-token that you get from docker exec -it [container-name/ID] jupyter server list).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gZH3C_dRGAfNFSuicBgBRg.png" /><figcaption>Overview in GPU Jupyter, the GPU is available as well as a kernels for Julia, Python and R, ergo, JuPyth&amp;R or simply Jupyter.</figcaption></figure><p>This current installation of Jupyter you have now differs in one important point from many other installations. <strong>You have full access to your NVIDIA GPU and can accelerate your ML calculations!</strong></p><p>With these commands we can see if everything worked well:</p><pre>docker ps<br>docker logs -f [CONTAINER_ID]</pre><p>In order to stop the local deployment, run:</p><pre>docker rm -f [CONTAINER_ID]</pre><blockquote>In the demonstration code, you can measure the performance improvement in this installation. This shows a <strong>performance improvement of factor 50. </strong>Also, check if the GPU usage rises up close to 100%.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bd6XQTPmd0MvhOT8I6fsoQ.png" /><figcaption>Performance test for the calculation of a prediction matrix in numpy, PyTorch CPU and PyTorch GPU.</figcaption></figure><blockquote>I would like to thank <a href="https://github.com/parente">Peter Parente</a> who is the main contributor and maintainer of the <a href="https://github.com/jupyter/docker-stacks"><em>docker-stacks</em>,</a> which provide a great Data-Science toolstack that is used here on top of the basic<em> nividia/cuda</em> image.</blockquote><h3>The whole GPU-Jupyter Series:</h3><ul><li><a href="https://medium.com/p/e0d45fcacf43">Set up Your own GPU-based Jupyter easily using Docker</a>.</li><li><a href="https://cschranz.medium.com/connect-vs-code-to-your-remote-gpu-jupyter-instance-58b86a195d9e">Learn how to connect VS Code to your remote GPU-Jupyter instance</a> to incorporate the advantages of an IDE and the GPU-Jupyter.</li><li><a href="https://cschranz.medium.com/dockerized-gpu-jupyter-for-reproducible-research-for-ml-and-ai-a596362b164e">🧪 Reproducible Deep Learning Experiments with One Command: GPU-Jupyter | by Christoph Schranz | Medium</a></li></ul><p><strong>Enjoy running your own code on the GPU :)</strong></p><p>For a tailored solution that supports your infrastructure’s needs, please refer to the author of this blog article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0d45fcacf43" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>