int stage3() { if(E%2 == 1) { P = (A*P)%n; E = (E-1)/2; return stage5(); } else { return stage4(); } }
int main(int argc, char *argv[]) { SphereArray *sphereArray = initSphereArray(para::xdim, para::ydim, para::zdim, para::radius, para::dist); rotate(sphereArray); timer.appendStart("binning"); BinSpherePairArray *pairArray = stage1To3(sphereArray, para::binSize); timer.appendEnd("binning"); timer.appendStart("sorting"); stage4(pairArray); timer.appendEnd("sorting"); timer.appendStart("data"); BinSphereDataArray *dataArray = stage5To6(pairArray); timer.appendEnd("data"); timer.appendStart("CD"); stage7(sphereArray, pairArray, dataArray, para::binSize); // gpu_stage7(sphereArray, pairArray, dataArray, para::binSize); timer.appendEnd("CD"); printf("number of spheres = %u, memory = %lf M\n", sphereArray->size, (sphereArray->size * sizeof(Sphere)) / 1024.0 / 1024.0); printf("number of bin-sphere pairs (array B) = %u, memory = %lf M\n", pairArray->size, (pairArray->size * sizeof(BinSpherePair)) / 1024.0 / 1024.0); printf("number of bin data (array C) = %u, memory = %lf M\n", dataArray->size, (dataArray->size * sizeof(BinSphereData)) / 1024.0 / 1024.0); uint cdSum = 0; for (int i = 0; i < dataArray->size; i++) { uint n = dataArray->objects[i].numOfObjects; cdSum += n * n; } printf("total number of pairs processed: %u\n", cdSum); printf("total time for binning: %lf\n", timer.getTotalTime("binning")); printf("total time for sorting: %lf\n", timer.getTotalTime("sorting")); printf("total time for rearranging bins: %lf\n", timer.getTotalTime("data")); printf("total time for CD: %lf\n", timer.getTotalTime("CD")); return 0; }
int main() { serial_init(); AI_init(); DAC_init(); Timer10Sec(); //p.16 //stage1(); //p.18 //stage2(); //p.16 & p.18 //stage3(); //p.25 stage4(); return 0; }
void MaintenanceMngr::slotToolCompleted(ProgressItem* tool) { // At each stage, relevant tool instance is set to zero to prevent redondant call to this slot // from ProgressManager. This will disable multiple triggering in this method. // There is no memory leak. Each tool instance are delete later by ProgressManager. if (tool == dynamic_cast<ProgressItem*>(d->newItemsFinder)) { d->newItemsFinder = 0; stage2(); } else if (tool == dynamic_cast<ProgressItem*>(d->thumbsGenerator)) { d->thumbsGenerator = 0; stage3(); } else if (tool == dynamic_cast<ProgressItem*>(d->fingerPrintsGenerator)) { d->fingerPrintsGenerator = 0; stage4(); } else if (tool == dynamic_cast<ProgressItem*>(d->duplicatesFinder)) { d->duplicatesFinder = 0; stage5(); } #ifdef HAVE_KFACE else if (tool == dynamic_cast<ProgressItem*>(d->faceDetector)) { d->faceDetector = 0; stage6(); } #endif /* HAVE_KFACE */ else if (tool == dynamic_cast<ProgressItem*>(d->imageQualitySorter)) { d->imageQualitySorter = 0; stage7(); } else if (tool == dynamic_cast<ProgressItem*>(d->metadataSynchronizer)) { d->metadataSynchronizer = 0; done(); } }
int main( int argc, char* argv[] ) { if ( !strcmp( argv[ 1 ], "stage1" ) ) { stage1( argv[ 2 ], atoi( argv[ 3 ] ), atoi( argv[ 4 ] ) ); } else if( !strcmp( argv[ 1 ], "stage2" ) ) { stage2( argv[ 2 ], argv[ 3 ] ); } else if( !strcmp( argv[ 1 ], "stage3" ) ) { stage3( argv[ 2 ], argv[ 3 ], argv[ 4 ] ); } else if( !strcmp( argv[ 1 ], "stage4" ) ) { stage4( argv[ 2 ], argv[ 3 ], argv[ 4 ] ); } else if( !strcmp( argv[ 1 ], "stage5" ) ) { stage5( argv[ 2 ], argv + 3, argc - 3 ); } return 0; }
bool execute() { schifra::utils::timer timer; timer.start(); bool result = stage1() && stage2() && stage3() && stage4() && stage5() && stage6() && stage7() && stage8() && stage9() && stage10() && stage11() && stage12(); timer.stop(); double time = timer.time(); print_codec_properties(); std::cout << "Blocks decoded: " << blocks_processed_ << "\tDecoding Failures: " << block_failures_ << "\tRate: " << ((blocks_processed_ * data_length) * 8.0) / (1048576.0 * time) << "Mbps" << std::endl; /* Note: The throughput rate is not only the throughput of reed solomon encoding and decoding, but also that of the steps needed to add simulated transmission errors to the reed solomon block such as the calculation of the positions and additions of errors and erasures to the reed solomon block, which normally in a true data transmission medium would not be taken into consideration. */ return result; }
xmlNode * do_calculations(pe_working_set_t * data_set, xmlNode * xml_input, crm_time_t * now) { GListPtr gIter = NULL; int rsc_log_level = LOG_INFO; /* pe_debug_on(); */ CRM_ASSERT(xml_input || is_set(data_set->flags, pe_flag_have_status)); if (is_set(data_set->flags, pe_flag_have_status) == FALSE) { set_working_set_defaults(data_set); data_set->input = xml_input; data_set->now = now; } else { crm_trace("Already have status - reusing"); } if (data_set->now == NULL) { data_set->now = crm_time_new(NULL); } crm_trace("Calculate cluster status"); stage0(data_set); if(is_not_set(data_set->flags, pe_flag_quick_location)) { gIter = data_set->resources; for (; gIter != NULL; gIter = gIter->next) { resource_t *rsc = (resource_t *) gIter->data; if (is_set(rsc->flags, pe_rsc_orphan) && rsc->role == RSC_ROLE_STOPPED) { continue; } rsc->fns->print(rsc, NULL, pe_print_log, &rsc_log_level); } } crm_trace("Applying placement constraints"); stage2(data_set); if(is_set(data_set->flags, pe_flag_quick_location)){ return NULL; } crm_trace("Create internal constraints"); stage3(data_set); crm_trace("Check actions"); stage4(data_set); crm_trace("Allocate resources"); stage5(data_set); crm_trace("Processing fencing and shutdown cases"); stage6(data_set); crm_trace("Applying ordering constraints"); stage7(data_set); crm_trace("Create transition graph"); stage8(data_set); crm_trace("=#=#=#=#= Summary =#=#=#=#="); crm_trace("\t========= Set %d (Un-runnable) =========", -1); if (get_crm_log_level() >= LOG_TRACE) { gIter = data_set->actions; for (; gIter != NULL; gIter = gIter->next) { action_t *action = (action_t *) gIter->data; if (is_set(action->flags, pe_action_optional) == FALSE && is_set(action->flags, pe_action_runnable) == FALSE && is_set(action->flags, pe_action_pseudo) == FALSE) { log_action(LOG_TRACE, "\t", action, TRUE); } } } return data_set->graph; }