2929void vpr_signal_handler (int signal);
3030void checkpoint ();
3131
32+ static inline void safe_write (const char * msg) {
33+ (void )!write (STDERR_FILENO, msg, strlen (msg));
34+ }
35+
3236#ifdef VPR_USE_SIGACTION
3337
3438void vpr_install_signal_handler () {
@@ -44,14 +48,14 @@ void vpr_install_signal_handler() {
4448
4549void vpr_signal_handler (int signal) {
4650 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 " );
4852 checkpoint ();
4953 std::quick_exit (INTERRUPTED_EXIT_CODE);
5054 } else if (signal == SIGHUP) {
51- VTR_LOG ( " Recieved SIGHUP: Attempting to checkpoint...\n " );
55+ safe_write ( " Received SIGHUP: Attempting to checkpoint...\n " );
5256 checkpoint ();
5357 } 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 " );
5559 checkpoint ();
5660 std::quick_exit (INTERRUPTED_EXIT_CODE);
5761 }
@@ -74,14 +78,12 @@ void checkpoint() {
7478 // Dump the current placement and routing state
7579 vtr::ScopedStartFinishTimer timer (" Checkpointing" );
7680
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 ());
8083
8184 bool is_flat = g_vpr_ctx.routing ().is_flat ;
8285 const Netlist<>& router_net_list = is_flat ? (const Netlist<>&)g_vpr_ctx.atom ().netlist () : (const Netlist<>&)g_vpr_ctx.clustering ().clb_nlist ;
8386
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);
8789}
0 commit comments