I have deployed an ssh tunnel to google collab using ngrok, and it works reasonably well. Problems arose when I wanted to get information about the video card and the version of CUDA on it. Since I received an error stating that all CUDA devices are busy or missing.
import paramiko
host = '2.tcp.ngrok.io'
user = 'root'
secret = 'I will not say'
port = 11568
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname=host, username=user, password=secret, port=port)
stdin, stdout, stderr = client.exec_command(f'nvidia-smi')
stdout_text = stdout.read().decode('utf-8')
stderr_text = stderr.read().decode('utf-8')
print(f'Output: {stdout_text}\nError: {stderr_text}')
client.close()
I got Failed to initialize NVML: Driver/library version mismatch
But in google collab i got normal result without any error.
Fri Dec 3 21:03:10 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 495.44 Driver Version: 460.32.03 CUDA Version: 11.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 Tesla K80 Off | 00000000:00:04.0 Off | 0 |
| N/A 71C P0 75W / 149W | 0MiB / 11441MiB | 12% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
I tried to use os.environ["CUDA_VISIBLE_DEVICES"] = '0'
But it gave no results...