# Setting Up Your Deep Learning Environment on Atlantic.Net GPU Server

> URL: https://www.atlantic.net/gpu-server-hosting/setting-up-your-deep-learning-environment-on-atlantic-cloud-gpu-server/ | Published: 2024-12-09 | Updated: 2024-12-12 | Author: Hitesh Jethva

Deep learning has revolutionized industries like healthcare, finance, and gaming by enabling the creation of highly sophisticated models capable of performing complex tasks. These models, however, require immense computational power, and GPUs (Graphics Processing Units) play a critical role in accelerating this process. Atlantic.Net’s GPU dedicated servers offer a high-performance GPU infrastructure, making it an ideal platform for deep learning projects.

This guide will walk you through the entire process of setting up a deep learning environment on an Atlantic.Net GPU Server.

## Prerequisites

- An Ubuntu 22.04 GPU Server
- CUDA Toolkit and cuDNN Installed
- A root or sudo privileges

## Verify NVIDIA GPU

The first step in any GPU-accelerated setup is ensuring that your system detects the GPU. Atlantic.Net GPU server instances come pre-configured with GPU hardware, but verifying its availability is crucial.

```bash
lspci | grep -i nvidia
```

Output.

```bash
00:1e.0 3D controller: NVIDIA Corporation GP102 [Tesla P40] (rev a1)
```

If no GPU is detected, ensure that your server is configured with GPU support.

## Install Anaconda

Anaconda is a powerful tool for managing Python environments and packages, which is especially useful in deep learning projects where dependency management is critical.

Visit the official [**Anaconda Archives Directory**](https://repo.anaconda.com/archive/) to find the latest installer. For this guide, we’ll use a specific version.

```bash
wget https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh
```

Execute the downloaded script:

```bash
bash Anaconda3-2024.10-1-Linux-x86_64.sh
```

You will be asked the following:

- Accept the license agreement by typing yes.
- Confirm the installation directory (default is typically /home/your-username/anaconda3).
- Allow the installer to initialize Anaconda.

Reload your .bashrc file to enable Anaconda.

```bash
source ~/.bashrc
```

Confirm that Anaconda is correctly installed by checking its version.

```bash
conda --version
```

Output.

```bash
conda 24.9.2
```

## Set Up Your Deep Learning Environment

Creating an isolated environment for deep learning ensures that dependencies and libraries do not conflict with other projects.

Create a new conda environment.

```bash
conda create -n deep_learning python=3.9
```

Activate the environment.

```bash
conda activate deep_learning
```

Your terminal prompt should now include (deep_learning), indicating the environment is active.

## Install TensorFlow and PyTorch with GPU Support

Leveraging GPU acceleration with TensorFlow and PyTorch drastically improves the speed of training deep learning models.

Install TensorFlow using conda.

```bash
conda install -c conda-forge tensorflow
```

Install the NVIDIA CUDA Toolkit for the Anaconda environment.

```bash
conda install -c "nvidia/label/cuda-12.4.1" cuda
```

Install PyTorch and libraries.

```bash
pip install torch torchvision torchaudio --pre -f https://download.pytorch.org/whl/nightly/cu124/torch_nightly.html
```

This installs the nightly version of PyTorch optimized for CUDA 12.4.

Install additional libraries.

```bash
conda install numpy pandas matplotlib
```

These libraries are useful for:

- Data manipulation (numpy, pandas).
- Visualization (matplotlib).

## Test Your Installation

Now, you will need to ensures that TensorFlow, PyTorch, and GPU acceleration are working as expected.

Start Python using the following command.

```bash
python3
```

In the Python shell, import both tensorflow and torch library.

```bash
>>> import tensorflow as tf
>>> import torch
```

Check the TensorFlow version.

```bash
>>> print("TensorFlow version:", tf.__version__)
```

Output.

```bash
TensorFlow version: 2.17.0
```

Verify the PyTorch version.

```bash
>>> print("PyTorch version:", torch.__version__)
```

Output.

```bash
PyTorch version: 2.5.1+cu124
```

Press **CTRL+D** to exit from the Python shell.

Check if TensorFlow detects the GPU.

```bash
python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
```

Expected output:

```bash
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
```

## Conclusion

Congratulations! You have successfully set up a deep learning environment on an Atlantic.Net GPU server. With TensorFlow and PyTorch configured to leverage GPU acceleration, you can now train and deploy complex models efficiently.

[**Atlantic.Net GPU Server Hosting**](https://www.atlantic.net/gpu-server-hosting/) provides a robust platform for AI and deep learning, empowering you to focus on innovation without worrying about hardware limitations.
