Skip to content

Commit 0354ca7

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master' into Multi-CGRA
2 parents 6e81f10 + ff5b3a3 commit 0354ca7

6 files changed

+98
-29
lines changed

README.md

+1-21
Original file line numberDiff line numberDiff line change
@@ -68,28 +68,8 @@ Execution
6868
```
6969

7070

71-
Mac user common issues
71+
Mac user [debugging and troubleshooting steps doc](/debug/DEBUGGING.md)
7272
--------------------------------------------------------
73-
> xauth command not found (XQuartz is missing on mac)
74-
```sh
75-
# install XQuartz
76-
brew install --cask xquartz
77-
# open XQuartz
78-
open -a XQuartz
79-
```
80-
> _tkinter.TclError: couldn't connect to display "10.0.0.204:xx (Display not setup correctly)
81-
```sh
82-
# try enable all access
83-
xhost+
84-
# check display is valid or not
85-
echo $DISPLAY
86-
# if above command shows nothing, it means display is not set properly by XQuartz. Try manually assign a display number, for example 0
87-
export DISPLAY=:0
88-
xhost +
89-
# modify run_mac_docker.sh line 8
90-
DISP_NUM=0
91-
92-
```
9373

9474
Installation
9575
--------------------------------------------------------

debug/DEBUGGING.md

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Mac remote debugging instructions
2+
3+
4+
Developer shall be able to debug this repository's source code via VsCode installed in host machine. Below are some troubleshoot tips.
5+
6+
7+
## debugging steps
8+
9+
10+
1. Install [Docker extension](https://code.visualstudio.com/docs/devcontainers/containers) from microsoft in VsCode
11+
12+
![](docker_extension.png)
13+
14+
2. Start the docker container inside VsCode
15+
16+
3. Open the python file and start debugging via clicking Run/Debug button
17+
18+
19+
## common issues
20+
21+
22+
#### 1. ```xauth command not found```
23+
24+
MacOS is missing XQuartz dependency
25+
26+
```
27+
# install XQuartz
28+
brew install --cask xquartz
29+
# open XQuartz
30+
open -a XQuartz
31+
```
32+
33+
#### 2. ```_tkinter.TclError: couldn't connect to display 10.0.0.204:xxx (Display not setup correctly)```
34+
35+
This can be happening for multiple reasons, including cross device display permission is not granted, display is not automatically being setup in MacOS. Try below steps:
36+
37+
> Enable all access on host machine
38+
```
39+
xhost +
40+
```
41+
42+
> Confirm display in host machine
43+
44+
```
45+
echo $DISPLAY
46+
```
47+
48+
> If display is empty or invalid, set a random display number in host machine
49+
50+
```
51+
export DISPLAY=:0
52+
```
53+
54+
> And modify the scripts to assign 0 as DISP_NUM (run_mac_docker.sh line 8)
55+
56+
```
57+
DISP_NUM=0
58+
```
59+
60+
61+
#### 3. in VsCode terminal, an error of ```Display xx.xx.xx.xx is not found```
62+
63+
This is because VsCode's ssh terminal does not share the same enviorment variable with the docker container, can be resolved via manually setting the display ip and port number (same as the one from docker container)
64+
65+
run ```export DISPLAY=xxx.xxx.xxx.xxx``` in the VsCode terminal
66+
67+
68+
#### 4. When setting break points and debug, an error of ```ImportError: can not import name 'Literal' from 'typing'```
69+
70+
71+
This is because the container is running python 3.7 for the programme, however the VsCode ssh plugin is running its own python debug tool (debugpy) for python 3.8 enviorment. Can be resolved via force to install a lower version of debugpy.
72+
73+
> install a lower version of debugpy
74+
75+
```pip install debugpy==1.6.6```
76+
77+
> force remove the vscode's debugpy
78+
79+
```rm -rf /root/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy```
80+
81+
>system link the old debugpy to replace VsCode's
82+
83+
```ln -s /WORK_REPO/venv/lib/python3.7/site-packages/debugpy /root/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy```
84+
85+
86+
## Happy debugging!
87+
88+
![](debugging.png)

debug/debugging.png

177 KB
Loading

debug/docker_extension.png

84.8 KB
Loading

launch.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
customtkinter.set_default_color_theme("dark-blue")
99

1010
master = customtkinter.CTk()
11-
image_path = './theme/'
11+
script_dir = os.path.dirname(os.path.abspath(__file__))
12+
image_path = os.path.join(script_dir, "theme")
1213
theme_selector_dark_image = customtkinter.CTkImage(Image.open(os.path.join(image_path, "dark_theme.png")), size=(500, 410))
1314
theme_selector_light_image = customtkinter.CTkImage(Image.open(os.path.join(image_path, "light_theme.png")), size=(500, 410))
1415
theme_selector_classic_image = customtkinter.CTkImage(Image.open(os.path.join(image_path, "classic_theme.png")), size=(500, 410))

mode_dark_light.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,7 @@ def clickTerminateMapping():
15171517
def clickMapDFG():
15181518
global mappingProc
15191519
mappingProc = None
1520-
heuristic = mappingAlgoCheckVar.get() == 1
1520+
heuristic = mappingAlgoCheckVar.get() == 0
15211521

15221522
os.system("mkdir kernel")
15231523
os.chdir("kernel")
@@ -2583,12 +2583,12 @@ def create_kernel_pannel(master):
25832583
font=customtkinter.CTkFont(size=FRAME_LABEL_FONT_SIZE,
25842584
weight="bold"))
25852585
mappingOptionLabel.grid(row=0, column=0, columnspan=2)
2586-
heuristicRatiobutton = customtkinter.CTkRadioButton(mappingAlgoPannel, text="Heuristic", variable=mappingAlgoCheckVar, value=0)
2587-
widgets["heuristicRatiobutton"] = heuristicRatiobutton
2588-
heuristicRatiobutton.grid(row=1, column=0, pady=(0, 5), sticky="nsew")
2589-
exhaustiveRatiobutton = customtkinter.CTkRadioButton(mappingAlgoPannel, text="Exhaustive", variable=mappingAlgoCheckVar, value=1)
2590-
widgets["exhaustiveRatiobutton"] = exhaustiveRatiobutton
2591-
exhaustiveRatiobutton.grid(row=1, column=1, pady=(0, 5), sticky="nsew")
2586+
heuristicRadioButton = customtkinter.CTkRadioButton(mappingAlgoPannel, text="Heuristic", variable=mappingAlgoCheckVar, value=0)
2587+
widgets["heuristicRadioButton"] = heuristicRadioButton
2588+
heuristicRadioButton.grid(row=1, column=0, pady=(0, 5), sticky="nsew")
2589+
exhaustiveRadioButton = customtkinter.CTkRadioButton(mappingAlgoPannel, text="Exhaustive", variable=mappingAlgoCheckVar, value=1)
2590+
widgets["exhaustiveRadioButton"] = exhaustiveRadioButton
2591+
exhaustiveRadioButton.grid(row=1, column=1, pady=(0, 5), sticky="nsew")
25922592

25932593
tarCgraIdLabel = customtkinter.CTkLabel(kernelPannel, text=" Target CGRA id: ")
25942594
tarCgraIdLabel.grid(row=8, column=2)

0 commit comments

Comments
 (0)