Intro
In the world of tech enthusiasts and gaming aficionados, your high-powered gaming PC is more than just a platform for immersive gaming experiences. What if we told you that your gaming rig could also double as a robust Jupyter Notebook server, seamlessly blending the worlds of gaming and data science? In this blog, we’ll guide you through the exciting process of repurposing your gaming powerhouse into a Jupyter Notebook server, unlocking a new realm of possibilities for computational exploration.
Whether you’re a seasoned data scientist, a programming hobbyist, or someone eager to make the most of their hardware investments, this guide will show you how to harness the potential of your gaming PC for both gaming and data-driven pursuits. Say goodbye to the notion that your gaming rig is only for entertainment – let’s embark on a journey to transform it into a versatile machine that combines the best of both worlds. Get ready to game and code like never before!
We’ll cover systems with a Nvidia gpu here, that’s what I have access to. Apologies AMD users.
Tensorflow
Before we begin, ensure that you have the following:
- An Ubuntu machine (tested on Ubuntu 20.04 or later)
- An NVIDIA GPU with CUDA support (check compatibility here)
- A basic understanding of the Linux command line
Step 1: Install NVIDIA GPU Drivers:
Firstly, make sure you have the latest NVIDIA GPU drivers installed on your system. Open a terminal and run:
sudo ubuntu-drivers autoinstall
Reboot your system after the installation completes. If you find that the version of the given driver is not working, you can setup your driver manually (official link).
Step 2: Install CUDA Toolkit:
You can setup CUDA manually, or via the tensorflow
toolkit. The manual path is a bit more complex, and I wouldn’t recommend it. It’s added here for informational purposes.
Step 2.1: Via the Tensorflow wrapper
Run the following:
pip install tensorflow[and-cuda]
Step 2.2: Manual installation
TensorFlow relies on the CUDA toolkit for GPU acceleration. Download and install the CUDA toolkit using the following commands:
sudo dpkg -i cuda-repo-<distro>_ <version>_amd64.deb sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/<distro>/x86_64/7fa2af80.pub sudo apt-get update sudo apt-get install cuda
Replace <distro>
and <version>
with your distribution and CUDA version, respectively. You can find the appropriate links and details here.
Step 2.2.1: Install cuDNN Library:
TensorFlow also requires the cuDNN library for deep neural network acceleration. Download the cuDNN library from the NVIDIA website and follow the installation instructions found here.
Step 2.2.2: Install TensorFlow:
Now that the prerequisites are in place, you can install TensorFlow. Create a virtual environment (optional but recommended) and install TensorFlow using pip:
pip install tensorflow
Step 3: Verify Installation
To confirm that TensorFlow is using your CPU, open a Python shell and run the following code:
python3 -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
You should see a tensor returned as an output.
To confirm the GPU setup:
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
You should be able to see an entry at the bottom of the output with your GPU name/model.
Step 4: Setting-up Jupyter server
Once that’s done, use pip to install Jupyter by running the command:
pip install jupyter
With Jupyter installed, you can launch the server with this command in your terminal:
jupyter notebook
This will initiate the server, and you’ll be provided with a URL, usually http://localhost:8888/. Open this URL in your web browser, and voila! You’ll find yourself in the Jupyter Notebook interface, ready to create, edit, and run code cells. For added security, consider configuring a password for your Jupyter server using:
jupyter notebook password
To expose the jupyter instance to your network (be smart about this), add the following parameters when starting the notebook server:
jupyter notebook --ip {YOUR_PC_IP} --port 8888
You can now hook-in PyCharm, or any other IDE to run your notebooks on your gaming PC.
Conclusion:
Congratulations! You’ve successfully set up TensorFlow/Jupyter Notebook on your Ubuntu machine! Now you’re ready to delve into the exciting world of deep learning. Happy coding!
For more detailed information, refer to the official TensorFlow documentation here.
More guides can be found here