How To Deploy A Pod On RunPod And Verify It Is Working
Tags: beginners, programming, tutorial, python
Published: 2024-02-05 22:23:52

<h3>In this post I am going to show you how to select your template and setup your Pod accurately with the newest interface. Moreover, I am going to show you how to ensure the rented pod is working accurately.</h3>

<p>First register your RunPod account if you haven&#39;t yet.</p>

<p>You can use this link (help me to get credits so I can do more research and tutorials) : <a href="https://runpod.io/?ref=1aka98lq">https://runpod.io?ref=1aka98lq</a></p>

<p>&nbsp;</p>

<p>Then use this link to search for any template you want to use : <a href="https://www.runpod.io/console/explore">https://www.runpod.io/console/explore</a></p>

<p><img src="https://c10.patreonusercontent.com/4/patreon-media/p/post/97919576/0dce9d43d5264caa87ff9cf660307b24/eyJ3Ijo4MjB9/1.png?token-time=1708387200&amp;token-hash=T2Pf9qojv-P-N8d6iWFZrmr8OSa9sd0eA17WkvugAjM%3D" /></p>

<p>&nbsp;</p>

<p>After selected your template you will get to next page where you will see template explanation and Deploy GPU button</p>

<p><img src="https://c10.patreonusercontent.com/4/patreon-media/p/post/97919576/7fb09383aec84cb2aa6fb0b38573180d/eyJ3Ijo4MjB9/1.png?token-time=1708387200&amp;token-hash=rGpY2YFC0ip2n9O_cGKUstkc7rf0Z2m1fEx2STTYNGk%3D" /></p>

<p>&nbsp;</p>

<p>Next you can select Secure Cloud or Community Cloud. I prefer to use Community Cloud for majority of tasks</p>

<p><img src="https://c10.patreonusercontent.com/4/patreon-media/p/post/97919576/2f96f20e793e4b3f9e05d33220928751/eyJ3Ijo4MjB9/1.png?token-time=1708387200&amp;token-hash=TsGjJzIH5aaLqG9W5iEwpD4eoJBcTyO_mNOZaIlFsII%3D" /></p>

<p>&nbsp;</p>

<p>After you selected your GPU, you can Customize Deployment and also select On-Demand or Spot (bidding based) renting.</p>

<p><img src="https://c10.patreonusercontent.com/4/patreon-media/p/post/97919576/9e6422254f8740f7823427dd2d103b73/eyJ3Ijo4MjB9/1.png?token-time=1708387200&amp;token-hash=QCEE5FURMg1NilLz2B7Gp-KNdeO-PUKK2ClCAwvC9Jc%3D" /></p>

<p>&nbsp;</p>

<p>You can add new port to Customize Deployment to connect Gradio apps. By default Gradio apps starts at 7860 port so you can add 7861 port to connect that started Gradio app through proxy of RunPod.</p>

<p><img src="https://c10.patreonusercontent.com/4/patreon-media/p/post/97919576/cf623c9716a34d30ae4397ef26998488/eyJ3Ijo4MjB9/1.png?token-time=1708387200&amp;token-hash=4LD5dB9eDOoTKtcs8jzDah8k3oXql62-BqhW7zgDrh4%3D" /></p>

<p>&nbsp;</p>

<p>You can also increase your Volume Disk which is persistent and will remain until you delete your Pod. Your Container disk space is temporary and whatever you put there will be reset after you stop your pod.</p>

<p><img src="https://c10.patreonusercontent.com/4/patreon-media/p/post/97919576/bdaa6093dabd4f7781426bfe9e31ad73/eyJ3Ijo4MjB9/1.png?token-time=1708387200&amp;token-hash=49i0SNl-Ky8om5FcD5kyF2BqfTu8lvN3yr41bAVO5Jc%3D" /></p>

<p>&nbsp;</p>

<p>After everything is set, click continue, and then verify everything in last screen and click deploy.</p>

<p><img src="https://c10.patreonusercontent.com/4/patreon-media/p/post/97919576/f2825ad3c0f04b46a1672fd0c4a871ac/eyJ3Ijo4MjB9/1.png?token-time=1708387200&amp;token-hash=gYYrdalKBzIJX6pR0XR3gAzK4pxoSGorLLuezIttbjU%3D" /></p>

<p>&nbsp;</p>

<p>After click deploy, go to your Pods link : <a href="https://www.runpod.io/console/pods">https://www.runpod.io/console/pods</a></p>

<p>And there you will see your Pods.</p>

<p><img src="https://c10.patreonusercontent.com/4/patreon-media/p/post/97919576/537d16db18374a099e77040586273ec5/eyJ3Ijo4MjB9/1.png?token-time=1708387200&amp;token-hash=2O7bzM5Ifj3GeLC52xiWOBAuMkxl0uhrzlL4VRO2PMM%3D" /></p>

<p>&nbsp;</p>

<p>Then wait until connect button appear click it and connect to Jupyter lab interface.</p>

<p><img src="https://c10.patreonusercontent.com/4/patreon-media/p/post/97919576/83ac3c81656f4126ba3d75107034a47f/eyJ3Ijo4MjB9/1.png?token-time=1708387200&amp;token-hash=FIRhwF3kxYksr99jk4ikGoQCIrLZEIGf5DIxKUVfLVc%3D" /></p>

<p>&nbsp;</p>

<p>After you Jupyter Lab interface loaded, upload attached <a href="https://www.patreon.com/file?h=97919576&amp;i=17589331">verify.ipynb</a> into workspace, double click it and click play icon. Check the printed message. If you are not getting a message like shown below, Pod is broken. So delete it and move to another Pod.</p>

<p><img src="https://c10.patreonusercontent.com/4/patreon-media/p/post/97919576/83926ffa009f4f7d8d890a1f8b8eea94/eyJ3Ijo4MjB9/1.png?token-time=1708387200&amp;token-hash=w916TFe-Ph6PBQUVT0X3z6faZ7SZxBRm8DBoJs3qM-g%3D" /></p>

<p>&nbsp;</p>

<p>The code of ipynb notebook is as below</p>

```
import torch

# Check if CUDA (GPU) is available
if torch.cuda.is_available():
    # Get the number of available CUDA devices
    num_cuda_devices = torch.cuda.device_count()
    print(f"Number of CUDA devices available: {num_cuda_devices}")

    # Print information about each CUDA device
    for i in range(num_cuda_devices):
        device = torch.device(f'cuda:{i}')
        print(f"CUDA Device {i}: {torch.cuda.get_device_name(i)}")
        print(f"Device properties: {torch.cuda.get_device_properties(i)}")
        
    # Set a default device to the first CUDA device (GPU 0)
    torch.cuda.set_device(0)
    
    # Verify if CUDA is working by performing a simple operation on the GPU
    a = torch.tensor([1.0], device="cuda")
    b = torch.tensor([2.0], device="cuda")
    c = a + b
    print(f"Result of GPU computation: {c.item()}")
else:
    print("No CUDA devices available. Make sure you have a compatible GPU and PyTorch with CUDA support installed.")

```

<p>&nbsp;</p>

<p><a href="https://www.patreon.com/file?h=97919576&amp;i=17589331">verify.ipynb</a></p>