#include #include #include "success_or_die.h" int main(int argc, char** argv) { SUCCESS_OR_DIE( gaspi_proc_init(GASPI_BLOCK) ); gaspi_rank_t iProc; gaspi_rank_t nProc; SUCCESS_OR_DIE( gaspi_proc_rank(&iProc) ); SUCCESS_OR_DIE( gaspi_proc_num(&nProc) ); uint32_t send = 1; uint32_t receive = 0; if(iProc == 1) exit(1); // Barrier is needed to trigger a timeout. otherwise gaspi_allreduce would stuck forever auto test = gaspi_barrier(GASPI_GROUP_ALL, 500); test = gaspi_allreduce(&send, &receive, 1, GASPI_OP_SUM, GASPI_TYPE_UINT, GASPI_GROUP_ALL, GASPI_BLOCK); std::cout << iProc << " = " << receive << std::endl; if(test == GASPI_ERR_ACTIVE_COLL) { if(iProc == 0) { gaspi_state_vector_t state = (gaspi_state_vector_t) (new gaspi_state_t[nProc]); gaspi_state_vec_get( state ); for ( int i= 0; i < nProc; ++i ) { std::cout << i << " -> " << (state[i] == GASPI_STATE_HEALTHY ? "healthy" : "dead") << std::endl; } delete[] state; } } gaspi_barrier (GASPI_GROUP_ALL, 500); SUCCESS_OR_DIE( gaspi_proc_term(GASPI_BLOCK) ); return EXIT_SUCCESS; }