Issue
I use manjaro and want to use vscode tool for debug my python program,but i use CUDA, so i usually use a command like this:
optirun ipython program.py arg1 arg2
when i try to debug the program optirun isn't called, so i don't have access to GPU, how can i call optirun before python (or ipython)?
I've tried to change settins.json and launch.json to add it to command but it doesn't work.
Thanks.
Solution
This is what I did and it worked.
- Make a bash script, name it anything, assume
script.sh
.
#!/bin/bash
optirun python "$@"
- In
.vscode/launch.json
set"pythonPath"
to./script.sh
.
Here is a examplelaunch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"linux": {
"pythonPath": "./script.sh"
},
}
]
}
- Now it should work as intended.
I also faced the same problem while debugging a OpenCL application in python. My Nvidia graphics card was managed by optirun. $@
passes all the command line arguments supplied by vscode to the python interpreter.
Answered By - risahbhc32
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.