/* ** main program: ** initialise, timestep loop, finalise */ int main(int argc, char* argv[]) { char* paramfile; /* name of the input parameter file */ char* obstaclefile; /* name of a the input obstacle file */ t_param params; /* struct to hold parameter values */ t_speed* cells = NULL; /* grid containing fluid densities */ t_speed* tmp_cells = NULL; /* scratch space */ int* obstacles = NULL; /* grid indicating which cells are blocked */ float* av_vels = NULL; /* a record of the av. velocity computed for each timestep */ int ii; /* generic counter */ struct timeval timstr; /* structure to hold elapsed time */ struct rusage ru; /* structure to hold CPU time--system and user */ double tic,toc; /* floating point numbers to calculate elapsed wallclock time */ double usrtim; /* floating point number to record elapsed user CPU time */ double systim; /* floating point number to record elapsed system CPU time */ /* parse the command line */ if(argc != 3) { usage(argv[0]); } else{ paramfile = argv[1]; obstaclefile = argv[2]; } /* initialise our data structures and load values from file */ initialise(paramfile, obstaclefile, ¶ms, &cells, &tmp_cells, &obstacles, &av_vels); /* iterate for maxIters timesteps */ gettimeofday(&timstr,NULL); tic=timstr.tv_sec+(timstr.tv_usec/1000000.0); for (ii=0;ii<params.maxIters;ii++) { timestep(params,cells,tmp_cells,obstacles); av_vels[ii] = av_velocity(params,cells,obstacles); #ifdef DEBUG printf("==timestep: %d==\n",ii); printf("av velocity: %.12E\n", av_vels[ii]); printf("tot density: %.12E\n",total_density(params,cells)); #endif } gettimeofday(&timstr,NULL); toc=timstr.tv_sec+(timstr.tv_usec/1000000.0); getrusage(RUSAGE_SELF, &ru); timstr=ru.ru_utime; usrtim=timstr.tv_sec+(timstr.tv_usec/1000000.0); timstr=ru.ru_stime; systim=timstr.tv_sec+(timstr.tv_usec/1000000.0); /* write final values and free memory */ printf("==done==\n"); printf("Reynolds number:\t\t%.12E\n",calc_reynolds(params,cells,obstacles)); printf("Elapsed time:\t\t\t%.6lf (s)\n", toc-tic); printf("Elapsed user CPU time:\t\t%.6lf (s)\n", usrtim); printf("Elapsed system CPU time:\t%.6lf (s)\n", systim); write_values(params,cells,obstacles,av_vels); finalise(¶ms, &cells, &tmp_cells, &obstacles, &av_vels); return EXIT_SUCCESS; }
/* ** main program: ** initialise, timestep loop, finalise */ int main(int argc, char* argv[]) { char * final_state_file = NULL; char * av_vels_file = NULL; char * param_file = NULL; accel_area_t accel_area; param_t params; /* struct to hold parameter values */ speed_t* cells = NULL; /* grid containing fluid densities */ speed_t* tmp_cells = NULL; /* scratch space */ int* obstacles = NULL; /* grid indicating which cells are blocked */ double* av_vels = NULL; /* a record of the av. velocity computed for each timestep */ int ii; /* generic counter */ struct timeval timstr; /* structure to hold elapsed time */ struct rusage ru; /* structure to hold CPU time--system and user */ double tic,toc; /* floating point numbers to calculate elapsed wallclock time */ double usrtim; /* floating point number to record elapsed user CPU time */ double systim; /* floating point number to record elapsed system CPU time */ parse_args(argc, argv, &final_state_file, &av_vels_file, ¶m_file); initialise(param_file, &accel_area, ¶ms, &cells, &tmp_cells, &obstacles, &av_vels); /* iterate for max_iters timesteps */ gettimeofday(&timstr,NULL); tic=timstr.tv_sec+(timstr.tv_usec/1000000.0); for (ii = 0; ii < params.max_iters; ii++) { timestep(params, accel_area, cells, tmp_cells, obstacles); av_vels[ii] = av_velocity(params, cells, obstacles); #ifdef DEBUG printf("==timestep: %d==\n", ii); printf("av velocity: %.12E\n", av_vels[ii]); printf("tot density: %.12E\n", total_density(params, cells)); #endif } gettimeofday(&timstr,NULL); toc=timstr.tv_sec+(timstr.tv_usec/1000000.0); getrusage(RUSAGE_SELF, &ru); timstr=ru.ru_utime; usrtim=timstr.tv_sec+(timstr.tv_usec/1000000.0); timstr=ru.ru_stime; systim=timstr.tv_sec+(timstr.tv_usec/1000000.0); printf("==done==\n"); printf("Reynolds number:\t\t%.12E\n", calc_reynolds(params,cells,obstacles)); printf("Elapsed time:\t\t\t%.6f (s)\n", toc-tic); printf("Elapsed user CPU time:\t\t%.6f (s)\n", usrtim); printf("Elapsed system CPU time:\t%.6f (s)\n", systim); write_values(final_state_file, av_vels_file, params, cells, obstacles, av_vels); finalise(&cells, &tmp_cells, &obstacles, &av_vels); return EXIT_SUCCESS; }
inline void* malloc(GVMT_StackItem* sp, GVMT_Frame fp, size_t size) { char *result = (char*)gvmt_gc_free_pointer; size_t asize = align(size); gvmt_gc_free_pointer += asize; if (gvmt_gc_free_pointer >= gvmt_gc_limit_pointer) { if (!GC::finalization_queue.empty() && in_malloc==0) { ++in_malloc; GVMT_Object obj = (GVMT_Object)GC::finalization_queue.back(); GC::finalization_queue.pop_back(); if (GC::finalization_queue.empty()) gvmt_gc_limit_pointer = (GVMT_StackItem*)cheney::top_of_space; finalise(sp, fp, obj); --in_malloc; } if (((char*)gvmt_gc_free_pointer) >= cheney::top_of_space) { cheney::flip(); gvmt_gc_free_pointer = (GVMT_StackItem*)cheney::free; if (GC::finalization_queue.empty()) gvmt_gc_limit_pointer = (GVMT_StackItem*)cheney::top_of_space; else gvmt_gc_limit_pointer = (GVMT_StackItem*)gvmt_gc_free_pointer; if (((char*)gvmt_gc_free_pointer) + asize >= cheney::top_of_space) { user_gc_out_of_memory(); } result = (char*)gvmt_gc_free_pointer; gvmt_gc_free_pointer = (GVMT_StackItem*)(result + asize); } } return result; }
int main (int argc, char** argv) { int i; pthread_t threads[NUM_THREADS]; thread_args targs[NUM_THREADS]; void *status; initialise(); for ( i = 0; i < 29; i++ ) enqueue(i); for ( i = 0; i < NUM_THREADS; i++) { targs[i].id = i; targs[i].tot_threads = NUM_THREADS; pthread_create(&threads[i], NULL, thread_work, (void *) &targs[i]); } for ( i = 0; i < NUM_THREADS; i++) pthread_join(threads[i], &status); finalise(); }
TerminalWidget::TerminalWidget(QWidget *parent) : SamaelDockWidget(parent, QStringLiteral("TerminalWidget"), QStringLiteral("Terminal")) { this->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); // configure the text edit m_Terminal = new Terminal(m_ContentWidget); m_Terminal->setFont(QFont("Courier",9)); m_Terminal->setLineWrapMode(QPlainTextEdit::NoWrap); m_Terminal->setMaximumBlockCount(100); // background & text color auto p = m_Terminal->palette(); p.setColor(QPalette::Base,QColor(qRgb(28,32,36))); p.setColor(QPalette::Text,QColor(qRgb(186,200,198))); m_Terminal->setPalette(p); // configure the text highlighter m_Highlighter = new SamaelHighlighter(m_Terminal->document()); m_Highlighter->setContext(SamaelHighlighter::CONTEXT_TERMINAL); // script system? anyone? the entry point is over here! connect(m_Terminal, SIGNAL(command(QString)), this, SLOT(result(QString))); // configure the layout of this widget m_Layout = new QVBoxLayout(m_ContentWidget); m_Layout->setContentsMargins(0,0,0,0); m_Layout->addWidget(m_Terminal); finalise(m_Layout); QLOG_INFO() << "TerminalWidget - Ready!"; }
int main(int argc, char **argv) { // Start Paraver tracing #ifdef PARAVERTRACE Extrae_init(); #endif init(argc, argv); omp_init_lock(&lock); /* GENERATE NEW REFERENCE TIME */ reference("reference time 2", &referatom); /* TEST ATOMIC */ benchmark("ATOMIC", &testatom); #ifdef PARAVERTRACE Extrae_fini(); #endif finalise(); return EXIT_SUCCESS; }
int main(int argc, char **argv) { // Start Paraver tracing #ifdef PARAVERTRACE Extrae_init(); #endif init(argc, argv); omp_init_lock(&lock); /* GENERATE REFERENCE TIME */ reference("reference time 1", &refer); /* TEST LOCK/UNLOCK */ benchmark("LOCK/UNLOCK", &testlock); #ifdef PARAVERTRACE Extrae_fini(); #endif finalise(); return EXIT_SUCCESS; }
void RamFileSystemDeserialise::load() { while (_input) { deserialise_entry(); } finalise(); }
// Close output files void finish() { if (!finished) { finalise(); } float ratio = computeCounter/(float)memoryCounter; std::cout << "[Finished kernel] Compute (" << computeCounter << ") memory (" << memoryCounter << ") ratio: " << ratio << "\n"; //abort(); // End Ocelot. The exit(1) function does not seem to work. }
void zmq::session_t::process_term () { // Here we are pugging into the own_t's termination mechanism. // The goal is to postpone the termination till all the pending messages // are sent to the peer. term_processed = true; finalise (); }
void run_finalise(Chunk* chunk, Settings* settings) { START_PROFILING(settings->kernel_profile); finalise( chunk->x, chunk->y, settings->halo_depth, chunk->energy, chunk->density, chunk->u); STOP_PROFILING(settings->kernel_profile, __func__); }
void zmq::zmq_init_t::flush () { // Check if there's anything to flush. if (!received) return; // If initialisation is done, pass the engine to the session and // destroy the init object. finalise (); }
bool NavPath::planInstant() { setProcessTick(false); visitNext(); S32 store = mMaxIterations; mMaxIterations = INT_MAX; while(update()); mMaxIterations = store; return finalise(); }
void zmq::session_t::terminated (writer_t *pipe_) { zmq_assert (out_pipe == pipe_); out_pipe = NULL; if (finalised) { unregister_term_ack (); return; } finalise (); }
double Cluster::add_to_cluster(Node* new_read, Model_factory *mf, int read_index) { finalise(); stringstream ss; ss << "#" << read_index << "#"; Node* new_root = new Node(); new_root->set_name(ss.str()); new_root->add_left_child(root); new_root->add_right_child(new_read); new_root->set_nhx_tid(root->get_nhx_tid()); new_read->set_nhx_tid(root->get_nhx_tid()); root->set_distance_to_parent(0.001); new_root->align_sequences_this_node(mf, true, false); double read_identity = calc_identity(new_root, new_read); bool cluster_success = read_identity > id_threshold; new_root->has_left_child(false); new_root->has_right_child(false); if(cluster_success) { // clustering was successful, so add the read to list of members // and replace the old root with the new one if(fast_cluster) { delete root; } else { prev_root = root; } root = new_root; cluster_members.push_back(read_index); } else { // not added to cluster, so ignore old root and read and // delete the failed new root delete new_root; } return read_identity; }
bool zmq::zmq_init_t::read (::zmq_msg_t *msg_) { // If the identity was already sent, do nothing. if (sent) return false; // Send the identity. int rc = zmq_msg_init_size (msg_, options.identity.size ()); zmq_assert (rc == 0); memcpy (zmq_msg_data (msg_), options.identity.c_str (), options.identity.size ()); sent = true; // If initialisation is done, pass the engine to the session and // destroy the init object. finalise (); return true; }
int main(int argc, char **argv) { init(argc, argv); /* GENERATE REFERENCE TIME */ reference("reference time", &refer); /* TEST DYNAMIC,n */ cksz = 1; while (cksz <= itersperthr) { sprintf(testName, "DYNAMIC %d", cksz); benchmark(testName, &testdynamicn); cksz *= 2; } finalise(); return EXIT_SUCCESS; }
int main(int argc, char **argv) { init(argc, argv); #ifdef OMPVER3 /* GENERATE REFERENCE TIME */ reference("reference time 1", &refer); #ifndef DISABLE_NESTED_TASKS_TESTS /* TEST NESTED TASK GENERATION */ benchmark("NESTED TASK", &testNestedTaskGeneration); #endif #endif // OMPVER3 finalise(); return EXIT_SUCCESS; }
int main(int argc, char **argv) { init(argc, argv); #ifdef OMPVER3 /* GENERATE REFERENCE TIME */ reference("reference time 1", &refer); /* TEST CONDITIONAL TASK GENERATION */ #ifndef DISABLE_CONDITIONAL_TASK_TEST benchmark("CONDITIONAL TASK", &testConditionalTaskGeneration); #endif // DISABLE_CONDITIONAL_TASK_TEST #endif // OMPVER3 finalise(); return EXIT_SUCCESS; }
CompleteWiz::CompleteWiz(ProcessDF* df,QWidget* parent) :QWizard(parent) { for(int i=0; i<7; i++) Operate.push_back(true); addPage(new NoiseFillPage(df)); addPage(new PeakFilterPage); addPage(new QAssurancePage(df)); addPage(new NormPage(df)); addPage(new ImputationPage); addPage(new TransfPage(df)); addPage(new ScalPage); QPushButton *but = new QPushButton("Skip"); setButton(QWizard::CustomButton1,but); setOption(QWizard::HaveCustomButton1); DF=df; connect(this,SIGNAL(accepted()),this,SLOT(finalise())); connect(but,SIGNAL(clicked(bool)),this,SLOT(skip())); connect(button(QWizard::NextButton),SIGNAL(clicked(bool)),this,SLOT(NextBut())); }
// Ocelot event callback void event(const trace::TraceEvent & event) { // Get a flat thread/block ID/dimension unsigned bid = event.blockId.x*event.gridDim.y*event.gridDim.z + event.blockId.y*event.gridDim.z + event.blockId.z; unsigned bdim = event.blockDim.x*event.blockDim.y*event.blockDim.z; // Initialise the trace if (!initialised) { addrFile << "blocksize: " << event.blockDim.x << " " << event.blockDim.y << " " << event.blockDim.z << std::endl; initialised = true; } // Finalise the trace if (bid == MAX_THREADS/bdim && !finished) { finalise(); } // Only process the first MAX_THREADS threads if (bid < MAX_THREADS/bdim) { // Found a global load if ((event.instruction->addressSpace == ir::PTXInstruction::Global && event.instruction->opcode == ir::PTXInstruction::Ld) || (event.instruction->opcode == ir::PTXInstruction::Tex )) { if (! last_load.empty) { unsigned tid; for (tid = 0; tid < bdim; tid++) { unsigned gid = bid * bdim + tid; if (last_load.valid[gid]) { addrFile << gid << " " << last_load.addresses[gid] << " " << last_load.sizes[gid] << " " << last_load.pc << " " << 0 <<'\n'; last_load.valid[gid] = false; } } last_load.empty = true; } // Loop over a thread block's threads unsigned memory_address_counter = 0; for (unsigned i = 0; i < bdim; i++) { unsigned gid = bid * bdim + i; unsigned long address; unsigned size; if (event.active[i]) { address = event.memory_addresses[memory_address_counter++]; ir::PTXOperand::DataType datatype = event.instruction->type; unsigned vector = event.instruction->vec; size = vector * ir::PTXOperand::bytes(datatype); } else { address = 0; size = 0; } //modified: add PC value info unsigned pc_counter = event.instruction->pc; //Store the info in last_load but not output them now last_load.empty = false; last_load.valid[gid] = true; last_load.pc = pc_counter; last_load.addresses[gid] = address; last_load.sizes[gid] = size; last_load.target = event.instruction->d.toString(); } } // else if it is not a global load instruction else { if (! last_load.empty) { if (last_load.target == event.instruction->a.toString() || last_load.target == event.instruction->b.toString() || last_load.target == event.instruction->c.toString()) { unsigned tid; for (tid = 0; tid < bdim; tid++) { unsigned gid = bid * bdim + tid; if (last_load.valid[gid]) { addrFile << gid << " " << last_load.addresses[gid] << " " << last_load.sizes[gid] << " " << last_load.pc << " " << 1 <<'\n'; last_load.valid[gid] = false; } } last_load.empty = true; } } } } // Count 'compute' and 'memory' instructions to get the 'computational intensity' if (event.instruction->addressSpace == ir::PTXInstruction::Global) { ir::PTXOperand::DataType datatype = event.instruction->type; unsigned size = ir::PTXOperand::bytes(datatype); memoryCounter += size; } else { computeCounter++; } }
void ARRAY_CREATOR::Invoke() { const int numItems = getNumberOfItemsToArray(); // bail out if no items if( numItems == 0 ) return; BOARD_COMMIT commit( &m_parent ); MODULE* const module = getModule(); const bool isModuleEditor = module != NULL; const bool enableArrayNumbering = isModuleEditor; const wxPoint rotPoint = getRotationCentre(); DIALOG_CREATE_ARRAY dialog( &m_parent, enableArrayNumbering, rotPoint ); int ret = dialog.ShowModal(); DIALOG_CREATE_ARRAY::ARRAY_OPTIONS* const array_opts = dialog.GetArrayOptions(); if( ret != wxID_OK || array_opts == NULL ) return; for ( int i = 0; i < numItems; ++i ) { BOARD_ITEM* item = getNthItemToArray( i ); if( item->Type() == PCB_PAD_T && !isModuleEditor ) { // If it is not the module editor, then duplicate the parent module instead item = static_cast<MODULE*>( item )->GetParent(); } // The first item in list is the original item. We do not modify it for( int ptN = 1; ptN < array_opts->GetArraySize(); ptN++ ) { BOARD_ITEM* new_item; if( isModuleEditor ) { // increment pad numbers if do any renumbering // (we will number again later according to the numbering scheme if set) new_item = module->Duplicate( item, array_opts->ShouldNumberItems() ); } else { // PCB items keep the same numbering new_item = getBoard()->Duplicate( item ); // @TODO: we should merge zones. This is a bit tricky, because // the undo command needs saving old area, if it is merged. } if( new_item ) { array_opts->TransformItem( ptN, new_item, rotPoint ); prePushAction( new_item ); commit.Add( new_item ); postPushAction( new_item ); } // attempt to renumber items if the array parameters define // a complete numbering scheme to number by (as opposed to // implicit numbering by incrementing the items during creation if( new_item && array_opts->NumberingStartIsSpecified() ) { // Renumber pads. Only new pad number renumbering has meaning, // in the footprint editor. if( new_item->Type() == PCB_PAD_T ) { const wxString padName = array_opts->GetItemNumber( ptN ); static_cast<D_PAD*>( new_item )->SetPadName( padName ); } } } } commit.Push( _( "Create an array" ) ); finalise(); }
//------------------------------------------------------------------------------------- SpaceViewers::~SpaceViewers() { finalise(); }
int main(int argc, char **argv) { char testName[32]; /* Initialise storage for test results & parse input arguements. */ init(argc, argv); /* Ensure device is awake. */ wul(); /* Level 0 Tests - Speeds and Feeds */ sprintf(testName, "ContigH2D"); benchmark(testName, &contig_htod); sprintf(testName, "ContigD2H"); benchmark(testName, &contig_dtoh); sprintf(testName, "SlicedD2H"); benchmark(testName, &sliced_dtoh); sprintf(testName, "SlicedH2D"); benchmark(testName, &sliced_htod); sprintf(testName, "Kernels_If"); benchmark(testName, &kernels_if); sprintf(testName, "Parallel_If"); benchmark(testName, ¶llel_if); sprintf(testName, "Parallel_private"); benchmark(testName, ¶llel_private); sprintf(testName, "Parallel_1stprivate"); benchmark(testName, ¶llel_firstprivate); sprintf(testName, "Kernels_combined"); benchmark(testName, &kernels_combined); sprintf(testName, "Parallel_combined"); benchmark(testName, ¶llel_combined); sprintf(testName, "Update_Host"); benchmark(testName, &update); sprintf(testName, "Kernels_Invocation"); benchmark(testName, &kernels_invoc); sprintf(testName, "Parallel_Invocation"); benchmark(testName, ¶llel_invoc); sprintf(testName, "Parallel_Reduction"); benchmark(testName, ¶llel_reduction); sprintf(testName, "Kernels_Reduction"); benchmark(testName, &kernels_reduction); /* Level 1 Tests - BLAS-esque kernels */ sprintf(testName, "2MM"); benchmark(testName, &twomm); sprintf(testName, "3MM"); benchmark(testName, &threemm); sprintf(testName, "ATAX"); benchmark(testName, &atax); sprintf(testName, "BICG"); benchmark(testName, &bicg); sprintf(testName, "MVT"); benchmark(testName, &mvt); sprintf(testName, "SYRK"); benchmark(testName, &syrk); sprintf(testName, "COV"); benchmark(testName, &covariance); sprintf(testName, "COR"); benchmark(testName, &correlation); sprintf(testName, "SYR2K"); benchmark(testName, &syr2k); sprintf(testName, "GESUMMV"); benchmark(testName, &gesummv); sprintf(testName, "GEMM"); benchmark(testName, &gemm); sprintf(testName, "2DCONV"); benchmark(testName, &twodconv); sprintf(testName, "3DCONV"); benchmark(testName, &threedconv); /* Level 2 Tests - small applications */ sprintf(testName, "27S"); benchmark(testName, &stencil); sprintf(testName, "LE2D"); benchmark(testName, &le_main); sprintf(testName, "HIMENO"); benchmark(testName, &himeno_main); /* Print results & free results storage */ finalise(); return EXIT_SUCCESS; }
//------------------------------------------------------------------------------------- Navigation::~Navigation() { finalise(); }
void BoundTextBox::focusOutEvent(QFocusEvent *event) { QLineEdit::focusOutEvent(event); finalise(); }
void BoundTextBox::keyPressEvent(QKeyEvent *event) { QLineEdit::keyPressEvent(event); if (event->key() == Qt::Key_Return) finalise(); }
//------------------------------------------------------------------------------------- ScriptDefModule::~ScriptDefModule() { finalise(); }
~CallbackMgr() { finalise(); }
FileSystemAssetBrowserModel::~FileSystemAssetBrowserModel() { finalise(); }