OpenROAD-flow-scripts icon indicating copy to clipboard operation
OpenROAD-flow-scripts copied to clipboard

Improvement request - do not initialize GUI unless required

Open oharboe opened this issue 1 year ago • 5 comments

Subject

[Stage]: Other. Please describe below.

Describe the bug

The usecase here is to run "screen" to run flows while logged out. In this case the DISPLAY variable can be set to an invalid value and it would be a nice feature if OpenROAD didn't try to initialize the GUI if it isn't needed.

I only saw this recently, but I don't know if this because my environment changed, or because something changed in OpenROAD.

Regardless: the feature request is not to initialize GUI components unless needed so that headless builds are less susceptible to this quirk.

To reproduce, build anything, for example the default target:

export DISPLAY=nosuchthing
make

Results in error with stacktrace(the stack trace is perhaps a bit unnerving, but it is not a crash):

Design area 683 u^2 69% utilization.

[WARNING GUI-0076] could not connect to display nosuchthing
[INFO GUI-0075] Could not load the Qt platform plugin "xcb" in "" even though it was found.
[ERROR GUI-0077] This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

terminate called after throwing an instance of 'std::runtime_error'
  what():  GUI-0077
Signal 6 received
Stack trace:
 0# 0x000055E9EFDEB7FB in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
 1# 0x00007F9D66E42520 in /lib/x86_64-linux-gnu/libc.so.6
 2# pthread_kill in /lib/x86_64-linux-gnu/libc.so.6
 3# raise in /lib/x86_64-linux-gnu/libc.so.6
 4# abort in /lib/x86_64-linux-gnu/libc.so.6
 5# 0x00007F9D672A2BBE in /lib/x86_64-linux-gnu/libstdc++.so.6
 6# 0x00007F9D672AE24C in /lib/x86_64-linux-gnu/libstdc++.so.6
 7# 0x00007F9D672AD229 in /lib/x86_64-linux-gnu/libstdc++.so.6
 8# __gxx_personality_v0 in /lib/x86_64-linux-gnu/libstdc++.so.6
 9# 0x00007F9D6B252C64 in /lib/x86_64-linux-gnu/libgcc_s.so.1
10# _Unwind_Resume in /lib/x86_64-linux-gnu/libgcc_s.so.1
11# 0x00007F9D67C902F9 in /lib/x86_64-linux-gnu/libQt5Core.so.5
12# QMessageLogger::fatal(char const*, ...) const in /lib/x86_64-linux-gnu/libQt5Core.so.5
13# QGuiApplicationPrivate::createPlatformIntegration() in /lib/x86_64-linux-gnu/libQt5Gui.so.5
14# QGuiApplicationPrivate::createEventDispatcher() in /lib/x86_64-linux-gnu/libQt5Gui.so.5
15# QCoreApplicationPrivate::init() in /lib/x86_64-linux-gnu/libQt5Core.so.5
16# QGuiApplicationPrivate::init() in /lib/x86_64-linux-gnu/libQt5Gui.so.5
17# QApplicationPrivate::init() in /lib/x86_64-linux-gnu/libQt5Widgets.so.5
18# gui::startGui(int&, char**, Tcl_Interp*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
19# show(char const*, bool) in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
20# 0x000055E9F05AB838 in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
21# TclNRRunCallbacks in /lib/x86_64-linux-gnu/libtcl8.6.so
22# 0x00007F9D6B3F1028 in /lib/x86_64-linux-gnu/libtcl8.6.so
23# Tcl_EvalEx in /lib/x86_64-linux-gnu/libtcl8.6.so
24# Tcl_Eval in /lib/x86_64-linux-gnu/libtcl8.6.so
25# sta::sourceTclFile(char const*, bool, bool, Tcl_Interp*) in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
26# ord::tclAppInit(Tcl_Interp*) in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
27# Tcl_MainEx in /lib/x86_64-linux-gnu/libtcl8.6.so
28# main in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
29# 0x00007F9D66E29D90 in /lib/x86_64-linux-gnu/libc.so.6
30# __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
31# _start in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
Command terminated by signal 6
Elapsed time: 0:00.60[h:]min:sec. CPU time: user 0.46 sys 0.04 (85%). Peak memory: 133384KB.
make: *** [Makefile:683: logs/nangate45/gcd/base/6_report.log] Error 134

I have also seen an error and no stack trace:

==========================================================================
finish report_design_area
--------------------------------------------------------------------------
Design area 1776 u^2 13% utilization.

[WARNING GUI-0076] QXcbConnection: Could not connect to display localhost:10.0
[ERROR GUI-0077] Could not connect to any X display.
Error: final_report.tcl, 66 GUI-0077
Elapsed time: 0:04.27[h:]min:sec. CPU time: user 4.16 sys 0.08 (99%). Peak memory: 253244KB.

Expected Behavior

The normal flow should not require a screen.

Environment

latest master

To Reproduce

See above

Relevant log output

No response

Screenshots

No response

Additional Context

No response

oharboe avatar May 09 '23 05:05 oharboe

I tried "DISPLAY=NOTHING make" and I get:

[WARNING GUI-0076] QXcbConnection: Could not connect to display NOTHING
[ERROR GUI-0077] Could not connect to any X display.
Error: final_report.tcl, 66 GUI-0077

but no crash. The error itself is reasonable.

maliberty avatar May 11 '23 18:05 maliberty

I tried "DISPLAY=NOTHING make" and I get:

[WARNING GUI-0076] QXcbConnection: Could not connect to display NOTHING
[ERROR GUI-0077] Could not connect to any X display.
Error: final_report.tcl, 66 GUI-0077

but no crash. The error itself is reasonable.

I agree the error message is reasonable, but the build should not attempt to connect to a GUI.

The SEGFAULT is a separate minor concern, I'm sure easily fixed if it can be reproduced.

oharboe avatar May 12 '23 08:05 oharboe

rm -f logs/nangate45/gcd/base/6_report.log && DISPLAY=nothing make

Results in:

terminate called after throwing an instance of 'std::runtime_error'
  what():  GUI-0077
Signal 6 received
Stack trace:
 0# 0x000055D35D274F4B in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
 1# 0x00007FD445AD7520 in /lib/x86_64-linux-gnu/libc.so.6
 2# pthread_kill in /lib/x86_64-linux-gnu/libc.so.6
 3# raise in /lib/x86_64-linux-gnu/libc.so.6
 4# abort in /lib/x86_64-linux-gnu/libc.so.6
 5# 0x00007FD445E68BBE in /lib/x86_64-linux-gnu/libstdc++.so.6
 6# 0x00007FD445E7424C in /lib/x86_64-linux-gnu/libstdc++.so.6
 7# 0x00007FD445E73229 in /lib/x86_64-linux-gnu/libstdc++.so.6
 8# __gxx_personality_v0 in /lib/x86_64-linux-gnu/libstdc++.so.6
 9# 0x00007FD445CD3C64 in /lib/x86_64-linux-gnu/libgcc_s.so.1
10# _Unwind_Resume in /lib/x86_64-linux-gnu/libgcc_s.so.1
11# 0x00007FD44665A2F9 in /lib/x86_64-linux-gnu/libQt5Core.so.5
12# QMessageLogger::fatal(char const*, ...) const in /lib/x86_64-linux-gnu/libQt5Core.so.5
13# QGuiApplicationPrivate::createPlatformIntegration() in /lib/x86_64-linux-gnu/libQt5Gui.so.5
14# QGuiApplicationPrivate::createEventDispatcher() in /lib/x86_64-linux-gnu/libQt5Gui.so.5
15# QCoreApplicationPrivate::init() in /lib/x86_64-linux-gnu/libQt5Core.so.5
16# QGuiApplicationPrivate::init() in /lib/x86_64-linux-gnu/libQt5Gui.so.5
17# QApplicationPrivate::init() in /lib/x86_64-linux-gnu/libQt5Widgets.so.5
18# gui::startGui(int&, char**, Tcl_Interp*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
19# show(char const*, bool) in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
20# 0x000055D35DA33A18 in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
21# TclNRRunCallbacks in /lib/x86_64-linux-gnu/libtcl8.6.so
22# 0x00007FD449970028 in /lib/x86_64-linux-gnu/libtcl8.6.so
23# Tcl_EvalEx in /lib/x86_64-linux-gnu/libtcl8.6.so
24# Tcl_Eval in /lib/x86_64-linux-gnu/libtcl8.6.so
25# sta::sourceTclFile(char const*, bool, bool, Tcl_Interp*) in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
26# ord::tclAppInit(Tcl_Interp*) in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
27# Tcl_MainEx in /lib/x86_64-linux-gnu/libtcl8.6.so
28# main in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
29# 0x00007FD445ABED90 in /lib/x86_64-linux-gnu/libc.so.6
30# __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
31# _start in /home/oyvind/OpenROAD-flow-scripts/tools/install/OpenROAD/bin/openroad
Command terminated by signal 6
Elapsed time: 0:00.58[h:]min:sec. CPU time: user 0.47 sys 0.03 (87%). Peak memory: 134528KB.
make: *** [Makefile:683: logs/nangate45/gcd/base/6_report.log] Error 134

oharboe avatar May 12 '23 08:05 oharboe

Here the GUI is being initialized:

image

oharboe avatar May 12 '23 08:05 oharboe

If DISPLAY is set to an invalid value, then the build will fail with a runtime error and a stack trace.

The workaround is to run unset DISPLAY if the display is not valid.

It would appear that OpenROAD is trying to connect to the DISPLAY, even if it is not required for save_images.tcl to work.

Ideally, OpenROAD would not even initialize the unecessary GUI component when running save_images.tcl from the make flow.

oharboe avatar May 12 '23 08:05 oharboe

@maliberty Isn't this fixed now?

oharboe avatar Jul 14 '24 06:07 oharboe

Tried it. Fixed.

oharboe avatar Jul 21 '24 19:07 oharboe