int main(int argc, char *argv[]) { gaspi_rank_t rank, nc, i; TSUITE_INIT(argc, argv); ASSERT (gaspi_proc_init(GASPI_BLOCK)); ASSERT (gaspi_barrier(GASPI_GROUP_ALL, GASPI_BLOCK)); ASSERT (gaspi_proc_rank(&rank)); ASSERT (gaspi_proc_num(&nc)); if(rank == 0) { for(i = 1; i < nc; i++) { ASSERT(gaspi_proc_kill( i, GASPI_BLOCK)); } EXPECT_FAIL(gaspi_proc_kill( rank, GASPI_BLOCK)); } else { //hang ASSERT (gaspi_barrier(GASPI_GROUP_ALL, GASPI_BLOCK)); } ASSERT (gaspi_proc_term(GASPI_BLOCK)); return EXIT_SUCCESS; }
void signal_handler(int sig){ gaspi_rank_t num,i; //will only work after successful gaspi_proc_init ! gaspi_proc_num(&num); for(i=0;i<num;i++) gaspi_proc_kill(i,1000); exit(-1); }
void exit_safely(void) { gaspi_rank_t rank, nprocs, i; ASSERT (gaspi_proc_num(&nprocs)); ASSERT (gaspi_proc_rank(&rank)); if(rank == 0) { for( i = 1; i < nprocs; i++) ASSERT(gaspi_proc_kill(i, GASPI_BLOCK)); } ASSERT (gaspi_proc_term(GASPI_BLOCK)); }