29
29
void vpr_signal_handler (int signal);
30
30
void checkpoint ();
31
31
32
+ static inline void safe_write (const char * msg) {
33
+ (void )!write (STDERR_FILENO, msg, strlen (msg));
34
+ }
35
+
32
36
#ifdef VPR_USE_SIGACTION
33
37
34
38
void vpr_install_signal_handler () {
@@ -44,14 +48,14 @@ void vpr_install_signal_handler() {
44
48
45
49
void vpr_signal_handler (int signal) {
46
50
if (signal == SIGINT) {
47
- VTR_LOG ( " Recieved SIGINT: Attempting to checkpoint then exit...\n " );
51
+ safe_write ( " Received SIGINT: Attempting to checkpoint then exit...\n " );
48
52
checkpoint ();
49
53
std::quick_exit (INTERRUPTED_EXIT_CODE);
50
54
} else if (signal == SIGHUP) {
51
- VTR_LOG ( " Recieved SIGHUP: Attempting to checkpoint...\n " );
55
+ safe_write ( " Received SIGHUP: Attempting to checkpoint...\n " );
52
56
checkpoint ();
53
57
} else if (signal == SIGTERM) {
54
- VTR_LOG ( " Recieved SIGTERM: Attempting to checkpoint then exit...\n " );
58
+ safe_write ( " Received SIGTERM: Attempting to checkpoint then exit...\n " );
55
59
checkpoint ();
56
60
std::quick_exit (INTERRUPTED_EXIT_CODE);
57
61
}
@@ -74,14 +78,12 @@ void checkpoint() {
74
78
// Dump the current placement and routing state
75
79
vtr::ScopedStartFinishTimer timer (" Checkpointing" );
76
80
77
- std::string placer_checkpoint_file = " placer_checkpoint.place" ;
78
- VTR_LOG (" Attempting to checkpoint current placement to file: %s\n " , placer_checkpoint_file.c_str ());
79
- print_place (nullptr , nullptr , placer_checkpoint_file.c_str (), g_vpr_ctx.placement ().block_locs ());
81
+ safe_write (" Attempting to checkpoint current placement to file: placer_checkpoint.place\n " );
82
+ print_place (nullptr , nullptr , " placer_checkpoint.place" , g_vpr_ctx.placement ().block_locs ());
80
83
81
84
bool is_flat = g_vpr_ctx.routing ().is_flat ;
82
85
const Netlist<>& router_net_list = is_flat ? (const Netlist<>&)g_vpr_ctx.atom ().netlist () : (const Netlist<>&)g_vpr_ctx.clustering ().clb_nlist ;
83
86
84
- std::string router_checkpoint_file = " router_checkpoint.route" ;
85
- VTR_LOG (" Attempting to checkpoint current routing to file: %s\n " , router_checkpoint_file.c_str ());
86
- print_route (router_net_list, nullptr , router_checkpoint_file.c_str (), is_flat);
87
+ safe_write (" Attempting to checkpoint current routing to file: router_checkpoint.route\n " );
88
+ print_route (router_net_list, nullptr , " router_checkpoint.route" , is_flat);
87
89
}
0 commit comments