Software Archive
Read-only legacy content
17060 Discussions

Unix Signal Handling (Xeon-phi)

Gaelle_U_
Beginner
271 Views

Hello,

I am porting a code to Xeon Phi (using manual offload) in C++ and I am trying to catch SIGINT signal to free correctly memory before stopping the program. This program also uses openMP tasks for asynchronous I/O.

My first goal is to ignore the SIGINT signal with the function sigaction and the macro SIG_IGN. Unfortunately, my program can still be stopped by a Ctrl C. I also tried to block the SIGINT signal (with pthread_sigmask) before the omp parallel region and catch this signal in the master thread only but without success.   

Is someone can help me to make this application to ignore Ctrl C?


Best regards.

 

0 Kudos
1 Reply
jimdempseyatthecove
Honored Contributor III
271 Views

In an offload program, if you terminate the host process, the corresponding MIC process is (eventually/shortly) terminated, thus returning the MIC process memory this assumes the MIC allocations were made to the MIC process's heap. This will not clean-up any temporary MIC RAM-based files.

It would be easy enough for you to test this yourself by running a test program containing an offload that allocates a large block of memory (on the MIC), then enters an infinite loop. While in loop, on host, start micsmc in separate console, and set display to show memory allocated in the MIC. When set, then Ctrl-C the application running the host program that is performing the offload. You should see the memory returned in micsmc.

Jim Dempsey

0 Kudos
Reply