void chpl_task_exit(void) { #ifdef CHAPEL_PROFILE profile_print(); #endif /* CHAPEL_PROFILE */ #ifdef QTHREAD_MULTINODE #else if (qthread_shep() == NO_SHEPHERD) { /* sometimes, tasking is told to shutdown even though it hasn't been * told to start yet */ if (chpl_qthread_done_initializing == 1) { qthread_syncvar_fill(&canexit); while (done_finalizing == 0) SPINLOCK_BODY(); } } else { qthread_syncvar_fill(&exit_ret); } #endif /* QTHREAD_MULTINODE */ }
// // Do exit processing that has to occur before the tasking layer is // shut down. "The "all" parameter is true for normal, collective // program termination, and false for that done by a single locale // due to error or a user program halt or exit. // // Note: Chapel's program termination is not yet fully thought out. // void chpl_comm_pre_task_exit(int all) { qthread_debug(CHAPEL_CALLS, "[%d] begin all=%d\n", chpl_localeID, all); if (all) { if (0 != chpl_localeID) { qthread_debug(CHAPEL_BEHAVIOR, "[%d] calling spr_unify()\n", chpl_localeID); int const rc = spr_unify(); assert(SPR_OK == rc); } else { qthread_debug(CHAPEL_BEHAVIOR, "[%d] initiating locale shutdown\n", chpl_localeID); } } #ifdef CHAPEL_PROFILE profile_print(); #endif /* CHAPEL_PROFILE */ qthread_debug(CHAPEL_BEHAVIOR, "[%d] locale shutting down\n", chpl_localeID); qthread_debug(CHAPEL_CALLS, "[%d] end all=%d\n", chpl_localeID, all); }
/*-------------------------------------------------------------------------*/ s32 poly_stage2_run(poly_stage2_t *data) { stage2_stat_t stats; curr_poly_t curr_poly; root_sieve_t root_sieve; assess_t assess; stage2_stat_init(&stats); curr_poly_init(&curr_poly); root_sieve_init(&root_sieve); assess_init(&assess, data->bound0, data->bound1, data->area, data->p_bound); optimize(&curr_poly, data, &root_sieve, &assess, &stats); #ifdef DO_PROFILE profile_done(&stats.profile); printf("\nTiming:"); printf("\nTotal "); profile_print(&stats.profile, PROF_ALL); printf("\n 1. Optimization "); profile_print(&stats.profile, PROF_INITIAL_OPTIMIZE); printf("\n Sieve all "); profile_print(&stats.profile, PROF_SIEVE_ALL); printf("\n Init sieve "); profile_print(&stats.profile, PROF_INIT_SIEVE); printf("\n Sieve "); profile_print(&stats.profile, PROF_SIEVE); printf("\n eval "); profile_print(&stats.profile, PROF_EVAL); printf("\n gmp/alpha1 "); profile_print(&stats.profile, PROF_ALPHA1); printf("\n polroots "); profile_print(&stats.profile, PROF_MURPHY_ROOTS); printf("\n 2. Optimization "); profile_print(&stats.profile, PROF_OPTIMIZE2); printf("\n 3. Optimization "); profile_print(&stats.profile, PROF_OPTIMIZE3); printf("\n murphy-e sum "); profile_print(&stats.profile, PROF_MURPHY_E); printf("\n"); #endif stage2_stat_free(&stats); curr_poly_free(&curr_poly); root_sieve_free(&root_sieve); assess_free(&assess); return 1; }