Загрузите Облако NVIDA GPU (NGC)
контейнер .
Создать / home / bob / foobar.py в Visual Studio
Код с докером кода VS
Расширение
import ptvsd
import time
ptvsd.enable_attach(address = ('0.0.0.0', 5678))
ptvsd.wait_for_attach()
time.sleep(2)
print("all righty then")
Установить точку останова на последней строке.
Отладка | Добавить конфигурацию
Докер: присоединение к узлу
В launch.json добавить в «конфигурации»
{
"name": "Python Attach (Remote Debug ptsvd default)",
"type": "python",
"request": "attach",
"pathMappings": [
{
"localRoot": "/home/bob", // You may also manually specify the directory containing your source code.
"remoteRoot": "/home/bob" // Linux example; adjust as necessary for your OS and situation.
}
],
"port": 5678, // Set to the remote port.
"host": "0.0.0.0" // Set to your remote host's public IP address.
},
Открыть окно терминала:
$ docker load -i foo.tar
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nvidia/cuda 9.0-base 9dcd7cd95db6 2 weeks ago 135MB
nvcr.io/nvidia/cuda latest 506c995952d1 7 weeks ago 2.74GB
$ docker run -p 5678:5678 latest
root@deadbeef: python -m pip install --user --upgrade ptvsd
root@deadbeef: python foobar.py
Запустите отладчик с конфигурацией «Python Attach (Remote Debug ptsvd по умолчанию)». Останавливается в точке останова.