glm::vec4 ParallelReduction::reduce(RenderContext* pRenderCtx, Texture::SharedPtr pInput) { const FullScreenPass* pProgram = mpFirstIterProg.get(); for(size_t i = 0; i < mpTmpResultFbo.size(); i++) { runProgram(pRenderCtx, pInput, pProgram, mpTmpResultFbo[i], pVars, mpPointSampler); pProgram = mpRestIterProg.get(); pInput = mpTmpResultFbo[i]->getColorTexture(0); } runProgram(pRenderCtx, pInput, pProgram, mpResultFbo[mCurFbo], pVars, mpPointSampler); // Read back the results mCurFbo = (mCurFbo + 1) % mpResultFbo.size(); uint32_t bytesToRead = 0; glm::vec4 result(0); switch(mReductionType) { case Type::MinMax: bytesToRead = sizeof(glm::vec2); break; default: should_not_get_here(); } auto texData = pRenderCtx->readTextureSubresource(mpResultFbo[mCurFbo]->getColorTexture(0).get(), 0); result = *(vec4*)texData.data(); return result; }
void StateMachineHelper::processProgramEnd() { // check if cycle is repeatable or has defined end cycle - end cycle has higher priority // run new cycle after end // save state to repeat last program if (state.repeatLastCycle(_runningCycleId)) { _repeatCycleId = _runningCycleId; } if (_runningCycleId == 1 && (_programState > 0 && _programState < 4)) { _runningCycleId = _programState + 1; } else { // save running cycle id _runningCycleId = state.getEndCycleId(_runningCycleId); } if (_runningCycleId == -1) { _runningCycleId = _repeatCycleId; } if (_runningCycleId == -1) { stopPrivate(); // no programs specified after end; stop everything } else { runProgram(_runningCycleId); } }
void Deconvoluter::gapAverage(std::string inputMap, std::string inputWang, std::string inputMolUnit) { std::ostringstream gapScript; std::string ncsDefs = FileParser::getKey("NCS_DEFINITIONS_FILE", std::string("")); gapScript << "TITLE \"Cyclically average map\"" << std::endl; gapScript << "STAT UNKNOWN\n! First of all read in map...\n\nASSI MAP1 MAPI\nRMAP " << inputMap << "\n{ read in cryst a.u. of map }" << std::endl; gapScript << "{ read in wang env }\nass env1 mapi\nrzip " << inputWang << std::endl; gapScript << "{ read in mol unit env }\nass env2 mapi\nrzip " << inputMolUnit << std::endl; gapScript << "{ read in operators }\n\n@" << ncsDefs << std::endl; gapScript << "{ now av map1 into map2 expanded to cover virion }\n\nycsy\n\nass map1 mapi\nass off envi\nass env2 envo\nass map3 mapo\naver" << std::endl; gapScript << scriptCentreOnVirion() << "\ngo\ngo\n" << std::endl; gapScript << "{ now flatten asym unit using wang env }\nass map1 mapi\nass env1 envi\nass off mapo\nass off envo \nflat \ngo\n\n{ then fold averaged density down into asym unit }\n{ using expaned env as a filter }\n\nass map3 mapi\nass map1 mapo\nass env2 envi\nass off envo\nfold\n\n{ delete map2, env2...for space }\ndmap map2\ndmap env2\ndmap map3\n\n{ then need to expand to fill cell for SFALL }\n\nass map1 mapi\nass map4 mapo\ncmap\n" << std::endl; gapScript << "upda" << std::endl; for (int i = 0; i < 3; i++) { gapScript << "0 " << gridding[i] << " " << gridding[i] << std::endl; } gapScript << "rese 2 1 3 go" << std::endl; gapScript << "ass map4 mapi\nsgrp map4 1\nlmap inte 6 6 6 \n\ngo\n\nass map4 mapi\nwbin " << tempAveMapName << "\n\n\nstop\n" << std::endl; std::string invocation = "gap"; runProgram(invocation, gapScript.str(), "Gap Density Averaging"); }
void Deconvoluter::fastFourierTransform(std::string inputName, std::string tempFftMapName, bool calcAmps) { std::ostringstream fftScript; double highRes = FileParser::getKey("HIGH_RESOLUTION", 0.0); double lowRes = FileParser::getKey("LOW_RESOLUTION", 0.0); std::string fObsLab = FileParser::getKey("LABIN_AMPLITUDES", std::string("F")); std::string fCalcLab = FileParser::getKey("LABOUT_CALC_AMPLITUDES", std::string("FC")); std::string sig1Lab = FileParser::getKey("LABIN_SIGMAS", std::string("SIGF")); std::string phiLab = FileParser::getKey("LABIN_PHASES", std::string("PHIC")); std::string f1Lab = calcAmps ? fCalcLab : fObsLab; fftScript << "TITLE new 2fo-fc map" << std::endl; if (lowRes > 0 && highRes > 0) { fftScript << "RESOLUTION " << lowRes << " " << highRes << std::endl; } fftScript << "SCAL F1 2.0 0.0" << std::endl << "SCAL F2 1.0 0.0" << std::endl; fftScript << "GRID " << gridding[0] << " " << gridding[1] << " " << gridding[2] << std::endl; fftScript << "SYMM " << spaceGroup << std::endl; fftScript << "FFTSYMMETRY 1" << std::endl; fftScript << "XYZLIM 0 " << gridding[0] << " 0 " << gridding[1] << " 0 " << gridding[2] << std::endl; fftScript << "LABIN F1=" << f1Lab << " SIG1=" << sig1Lab << " PHI=" << phiLab << std::endl; std::string invocation = "fft HKLIN " + inputName + " " + " MAPOUT " + tempFftMapName; runProgram(invocation, fftScript.str(), "Fast Fourier Transform"); }
void mainMenu() { int option; do { option = 0; cout << "United Cause Relief Agency daily Donations Reports Menu" << endl; cout << "=======================================================" << endl << endl; cout << " 1: All by Company Name " << endl << endl; cout << " 2: All by Donor, Ascending " << endl << endl; cout << " 3: All by Donor, Descending " << endl << endl; cout << " 4: All by Category, Ascending " << endl << endl; cout << " 5: All by Gift ID, Ascending " << endl << endl; cout << " 6: One Donor only by Value, Descending " << endl << endl; cout << " 0: Exit the program " << endl << endl; cout << "Please select a report you wish to be run from menu above (1-5): "; cin >> option; cout << endl; runProgram(option); } while (option != 0); }
/* main * * do some main stuff. */ int main( int argc, char ** argv ) { basic_program * bp; basic_line * bl; printf( "0\n" ); /* set up our program space */ bp = newProgram(); if( !bp ) { errorReport( kErrorMalloc, 1 ); return 0; } /* display version info */ cmd_info( bp, NULL ); bl = consumeString( bp, program[0] ); bl = consumeString( bp, program[1] ); bl = consumeString( bp, program[2] ); bl = consumeString( bp, program[3] ); bl = consumeString( bp, program[4] ); /* and run the program, if we should... */ printf( "Running program\n" ); runProgram( bp, 0 ); while( run_poll( bp ) ); /* just show access of variables */ printf( "Variable 'a' is %ld\n", getVariableNumber( bp->variables, "a" )); deleteProgram( bp ); return 0; }
void handleInterrupt21(int ax, int bx, int cx, int dx) { switch(ax) { case 0: printString(bx); break; case 1: readString(bx); break; case 2: readSector(bx, cx); break; case 3: readFile(bx, cx, dx); break; case 4: runProgram(bx, cx); break; case 5: stop(); break; case 12: clearScreen(bx, cx); break; case 13: writeInt(bx); break; case 14: readInt(bx); break; case 15: error(bx); break; } }
TEST_F(SubExecutionTest, testCancelExecution) { m_nodeReader.setNode(0, CMD_DELAY_1000_R1); m_nodeReader.setNode(1, CMD_EXEC_CNT_1_R1); m_nodeReader.setNode(2, CMD_DELAY_15000_R1); m_nodeReader.setNode(3, CMD_EXEC_CNT_1_R1); m_main.init(0, 4, m_nodeReader, m_nodeExecuter); m_main.start(nullptr); ASSERT_EQ(0, m_commandCountExecutions1.getExecutinoCount()); runProgram(1005); ASSERT_EQ(1, m_commandCountExecutions1.getExecutinoCount()); m_main.stop(); runProgram(20000); ASSERT_EQ(1, m_commandCountExecutions1.getExecutinoCount()); };
int main(int argc, char ** argv) { buildSetting buildSettings(argc, argv); int success = Builder::build(buildSettings); if (success == 0) { runProgram(buildSettings.get_runAfter(), buildSettings.get_outputFilename()); } return success; }
int main(){ //char memory[] = {15, 17, -1, 17, -1, -1, 16 ,1 ,-1, 16, 3, -1, 15, 15 ,0, 0, -1, 72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33, 10, 0};; char* memory; std::cout << "running program...\n"; memory = parser(); runProgram(memory); return 0; }
int main ( int argc, char ** argv ) { FILE * mainSVM = fopen ( argv[1], "r"); instruction * chain = parseFile ( mainSVM ); interpreteer * runner = initializeInterpreteer ( chain ); printf("%d", runProgram ( runner )); return 0; }
void handleInterrupt21(int ax, int bx, int cx, int dx) { if (ax == 0) { /* printString */ printString(bx); } else if (ax == 1) { if (cx == 0) { readStringAndReturnSize(bx); } else { *((int*)cx) = readStringAndReturnSize(bx); } } else if (ax == 2) { readSector(bx, cx); } else if (ax == 3) { readFile(bx, cx, ROOT_SECTOR); } else if (ax == 4) { runProgram(bx, ROOT_SECTOR); } else if (ax == 5) { terminate(); } else if (ax == 6) { writeSector(bx, cx); } else if (ax == 7) { deleteFile(bx, ROOT_SECTOR); } else if (ax == 8) { writeFile(bx, cx, dx, ROOT_SECTOR); } else if (ax == 9) { scanDirectory(bx, cx, dx); } else if (ax == 10) { killProcess(bx); } else if (ax == 11) { shellWait(runProgram(bx, ROOT_SECTOR)); } else if (ax == 12) { clear(); } else if (ax == 13) { printProcTable(); } else { char errorMsg[8]; errorMsg[0] = 'E'; errorMsg[1] = 'r'; errorMsg[2] = 'r'; errorMsg[3] = 'o'; errorMsg[4] = 'r'; errorMsg[5] = '!'; errorMsg[6] = '!'; errorMsg[7] = '\0'; printString(errorMsg); } }
void Deconvoluter::sort_mtz(std::string tempMtz, std::string tempSortedMtz) { std::ostringstream sort_mtz_script; sort_mtz_script << "H K L" << std::endl << "END" << std::endl; std::string invocation = "sortmtz HKLIN " + tempMtz + " HKLOUT " + tempSortedMtz; runProgram(invocation, sort_mtz_script.str(), "Sort MTZ"); }
bool QueueLocal::submit(Job *job) { m_jobs.push_back(job); job->setStatus(Job::QUEUED); emit(jobAdded(job)); if (m_currentJob == m_jobs.size() - 1) runProgram(m_jobs.size() - 1); return true; }
ToRun::ToRun() { commands = vector<WireCommand>(); for (int i = 0; i < 676; i++){ wireValues[i] = -1; } getInput(); runProgram(); }
int main(){ printf("**Aplicatia agenda telefonica**"); int ret; do{ menu(); ret = runProgram(OPTION); }while(ret == 1); return 0; }
int main(void) { FILE *in = fopen("input.txt", "r"); int result; interpreterInit(); parserInit(in); parseInput(); linkProgram(); result = runProgram(); printf("Calculation result: %d", result); return 0; }
/** * Runs the collection scripts and stores result in memory */ void Report::collectData() { std::string runAs; // Check our effective username if( getUser() == "root" ) { runAs = runProgram( location + "scripts/loggedin.sh", "r"); } // Local ip setLocalIp( runProgram(location + "scripts/getlocalip.sh", "r") ); // Wifi hotspots setWifi( runProgram(location + "scripts/nearbywifi.sh", "r") ); // Traceroute setTraceroute( runProgram(location + "scripts/traceroute.sh", "r") ); // Webcam setWebcam(runProgram(location + "scripts/webcam.sh " + runAs, "r")); // Screenshot setScreenshot(runProgram(location + "scripts/screenshot.sh " + runAs, "r")); }
void gameInGame() { if (testButton(PSP_CTRL_SQUARE,2)) { if (game.state == GAME) game.state = GAME_FUNC_SETTING; else if (game.state == GAME_FUNC_SETTING) game.state = GAME; } else if (testButton(PSP_CTRL_START,1)) runProgram(); controlUI(); isLevelDone(); }
int main (int argc, char *argv[]) { if (argc != 3){ printf("Type ./Program N(square matrix width) kernelfile.cl \n"); exit(1); } int N = atoi(argv[1]); // row runProgram(N, argv[2]); return 0; }
PRL_RESULT CDspHaClusterHelper::runHaman(const QStringList & args, QProcess & proc) { QStringList lstArgs(args); QFileInfo fi(HAMAN_BIN); if (!fi.exists()) return PRL_ERR_SUCCESS; lstArgs.prepend("-i"); lstArgs.prepend("-q"); return runProgram(fi.filePath(), lstArgs, proc); }
void Deconvoluter::map_to_sf(std::string averageMap, std::string tempMtz) { std::ostringstream map_to_sfScript; double highRes = FileParser::getKey("HIGH_RESOLUTION", 0.0); double lowRes = FileParser::getKey("LOW_RESOLUTION", 0.0); map_to_sfScript << "TITL back transform unit cell" << std::endl; map_to_sfScript << "RESO " << lowRes << " " << highRes << std::endl; map_to_sfScript << "end" << std::endl; std::string invocation = "map_to_sf MAPIN " + averageMap + " HKLOUT " + tempMtz; runProgram(invocation, map_to_sfScript.str(), "Map to Structure Factor"); }
void Deconvoluter::gapEnvelope(std::string inputMap) { double generousDiameter = FileParser::getKey("VIRION_GENEROUS_DIAMETER", 340.0); double outerDiameter = FileParser::getKey("VIRION_OUTER_DIAMETER", 300.0); double innerDiameter = FileParser::getKey("VIRION_INNER_DIAMETER", 220.0); double sqrtDiameter = generousDiameter / 1.41421; std::cout << "Using generous diameter of " << generousDiameter << " Å, inner diameter of " << innerDiameter << ", outer diameter of " << outerDiameter << " Å." << std::endl; std::ostringstream envScript; envScript << "#noecho\nSTAT UNKNOWN\nTITLE \"Envelope determination\"{ read in asymmetric unit }\nass map1 mapi\nrmap " << inputMap << std::endl; envScript << "assi map1 mapi\nassi map2 mapo\ncmap " << std::endl; envScript << scriptCentreOnVirion() << std::endl; envScript << "\n{now use planes to cut away the other virions from our chosen one}" << std::endl; envScript << "\nncsy\nass map2 mapi\nass env1 envm\nncsy\nMENV GO\n0" << std::endl; envScript << "plane " << generousDiameter << " 0.0 0.0 0.0 0.0 0.0 1" << std::endl; envScript << "plane 0.0 " << generousDiameter << " 0.0 0.0 0.0 0.0 1" << std::endl; envScript << "plane 0.0 0.0 " << generousDiameter << " 0.0 0.0 0.0 1" << std::endl; envScript << "plane " << -generousDiameter << " 0.0 0.0 0.0 0.0 0.0 1" << std::endl; envScript << "plane 0.0 " << -generousDiameter << " 0.0 0.0 0.0 0.0 1" << std::endl; envScript << "plane 0.0 0.0 " << -generousDiameter << " 0.0 0.0 0.0 1" << std::endl; envScript << "plane " << sqrtDiameter << " " << sqrtDiameter << " " << sqrtDiameter << " 0.0 0.0 0.0 1" << std::endl; envScript << "plane " << -sqrtDiameter << " " << -sqrtDiameter << " " << -sqrtDiameter << " 0.0 0.0 0.0 1" << std::endl; envScript << "plane " << sqrtDiameter << " " << sqrtDiameter << " " << -sqrtDiameter << " 0.0 0.0 0.0 1" << std::endl; envScript << "plane " << -sqrtDiameter << " " << -sqrtDiameter << " " << sqrtDiameter << " 0.0 0.0 0.0 1" << std::endl; envScript << "plane " << -sqrtDiameter << " " << sqrtDiameter << " " << sqrtDiameter << " 0.0 0.0 0.0 1" << std::endl; envScript << "plane " << sqrtDiameter << " " << -sqrtDiameter << " " << -sqrtDiameter << " 0.0 0.0 0.0 1" << std::endl; envScript << "plane " << sqrtDiameter << " " << -sqrtDiameter << " " << sqrtDiameter << " 0.0 0.0 0.0 1" << std::endl; envScript << "plane " << -sqrtDiameter << " " << sqrtDiameter << " " << -sqrtDiameter << " 0.0 0.0 0.0 1" << std::endl; envScript << "go\n\n{now make mask that defines our virion as an inner sphere and outer sphere}" << std::endl; envScript << "assi env1 mapi\nassi env1 envm\nncsy\nmenv usei go" << std::endl; envScript << "sphere 0.0 0.0 0.0 " << outerDiameter / 2 << " 0 1" << std::endl; envScript << "sphere 0.0 0.0 0.0 " << innerDiameter / 2 << " 0 0\ngo" << std::endl; envScript << "ass env1 mapi\nlmas inte 10 10 10 go\n\n{now set density outside env1 in map2 to 0}\n\nncsy\n\nass map2 mapi\nass env1 envi\nflat\nflot 0\ngo\nass map2 mapi\nlmas inte 10 10 10 go\n{now make map2 the W.E.}\nncsy\n{Sig cut it}\nass off envi\nass map2 mapi\nscut .2 5 go\n\nass map2 mapi\nlmas inte 10 10 10 go\n\nncsy\n\n{convolute it}\nass map2 mapi\nconv bfac 200 go\nncsy\n\nass map2 mapi\nlmas inte 10 10 10 go\n\n{histogram it}\nass map2 mapi\nass env2 envo\nhist .75\n\nass env2 mapi\nlmas inte 10 10 10 go\n\nncsy\nass env2 mapi\ntidy go\nass env2 mapi\ntidy go\nass env2 mapi\nlmas inte 10 10 10 go\n\n{now write out mol unit for 1/4 virion}\n\nass env2 mapi\nwzip " << molUnitName << "\n\n{now create wang env in asymmetric unit}\n\nycsy\nass map5 mapo\n\nass env2 mapi\nass off envo\nass env2 envi\n\nfold\nupda\n0 180 360\n0 180 360\n0 180 360\ngo\n\n{lms the final env}\nass map5 mapi\nlmas inte 10 10 10 go\n\nass map5 mapi\nwzip " << wangEnvName << "\n\nstop" << std::endl; std::string invocation = "gap"; runProgram(invocation, envScript.str(), "Gap Envelope Generation"); }
int main(int argc, char *argv[]) { int i = 0; fp = fopen("program.txt", "r"); table= (struct pageTableElement*)malloc(sizeof(struct pageTableElement)*(400/PAGESIZE)); for(; i < 100; i++) { table[i].valid = 0; } runProgram(); return 0; }
// interrupt service routine to manage interrupt vector table void handleInterrupt21(int ax, int bx, int cx, int dx){ if (ax==0){ printString(bx); } else if (ax==1){ readString(bx); } else if (ax==2){ readSector(bx,cx); } else if (ax==3){ readFile(bx,cx,dx); } else if (ax==4){ runProgram(bx,cx); } else if (ax==5){ stop(); } else if (ax==6){ writeSector(bx,cx); } else if (ax==7) { deleteFile(bx); } else if (ax==8){ writeFile(bx,cx,dx); } else if (ax==11){ interrupt(25,0,0,0,0); } else if (ax==12){ clearScreen(bx,cx); } else if (ax==13){ writeInt(bx); } else if (ax==14){ ReadInt(bx); } else if (ax==15){ error(bx); } else if (ax==66){ printChar(bx); } else { printString("Incorrect service call\0"); } }
void LaunchyWidget::launchItem(CatItem& item) { int ops = MSG_CONTROL_LAUNCHITEM; if (item.id != HASH_LAUNCHY && item.id != HASH_LAUNCHYFILE) { ops = plugins.execute(&inputData, &item); if (ops > 1) { switch (ops) { case MSG_CONTROL_EXIT: close(); break; case MSG_CONTROL_OPTIONS: showOptionsDialog(); break; case MSG_CONTROL_REBUILD: buildCatalog(); break; case MSG_CONTROL_RELOADSKIN: reloadSkin(); break; default: break; } } } if (ops == MSG_CONTROL_LAUNCHITEM) { QString args = ""; if (inputData.count() > 1) for(int i = 1; i < inputData.count(); ++i) args += inputData[i].getText() + " "; /* UPDATE #ifdef Q_WS_X11 if (!platform->Execute(item.fullPath, args)) runProgram(item.fullPath, args); #else */ runProgram(item.fullPath, args); //#endif } catalog->incrementUsage(item); history.addItem(inputData); }
void QueueLocal::jobFinished() { QObject *theSender = QObject::sender(); if (theSender) { qDebug() << "The job was successfully finished:" << theSender->property("JOB_ID"); int id = theSender->property("JOB_ID").toInt(); m_jobs[id]->setStatus(Job::COMPLETE); emit(jobStateChanged(0)); // Submit the next job if there is one ++m_currentJob; if (m_currentJob < m_jobs.size()) runProgram(m_currentJob); } }
int main(int argc, char ** argv) { // Program starts here. Graphics g; if (g.init()) return 1; g.createFrameBuffer(VS_FRAMEBUFFER, FS_FRAMEBUFFER); runProgram(g); g.deleteFrameBuffer(); g.endit(); return 0; }
void Deconvoluter::cad(std::string tempSortedMtz, std::string tempMtz) { double highRes = FileParser::getKey("HIGH_RESOLUTION", 0.0); double lowRes = FileParser::getKey("LOW_RESOLUTION", 0.0); std::ostringstream cad_script; cad_script << "TITL back transform unit cell" << std::endl; cad_script << "LABIN FILE_NUM 1 ALL" << std::endl; cad_script << "RESOLUTION OVERALL " << lowRes << " " << highRes << std::endl; cad_script << "SYMMETRY " << spaceGroup << std::endl; cad_script << "end" << std::endl; std::string invocation = "cad HKLIN1 " + tempSortedMtz + " HKLOUT " + tempMtz; runProgram(invocation, cad_script.str(), "Cad"); }
int main(int argc,char *argv[]) { int width = atoi(argv[1]); int height = atoi(argv[2]); int number = atoi(argv[3]); char **mine = createBoard(width, height); setMines(mine, width, height, number); char **status = createBoard(width, height); numberFill(mine, width, height); setStatus(status, width, height); printBoard(status, width, height); runProgram(mine, status, width, height); return 0; }