void b3GpuPgsContactSolver::solveContactConstraintBatchSizes( const b3OpenCLArray<b3RigidBodyData>* bodyBuf, const b3OpenCLArray<b3InertiaData>* shapeBuf, b3OpenCLArray<b3GpuConstraint4>* constraint, void* additionalData, int n ,int maxNumBatches,int numIterations, const b3AlignedObjectArray<int>* batchSizes)//const b3OpenCLArray<int>* gpuBatchSizes) { B3_PROFILE("solveContactConstraintBatchSizes"); int numBatches = batchSizes->size()/B3_MAX_NUM_BATCHES; for(int iter=0; iter<numIterations; iter++) { for (int cellId=0;cellId<numBatches;cellId++) { int offset = 0; for (int ii=0;ii<B3_MAX_NUM_BATCHES;ii++) { int numInBatch = batchSizes->at(cellId*B3_MAX_NUM_BATCHES+ii); if (!numInBatch) break; { b3LauncherCL launcher( m_data->m_queue, m_data->m_solveSingleContactKernel,"m_solveSingleContactKernel" ); launcher.setBuffer(bodyBuf->getBufferCL() ); launcher.setBuffer(shapeBuf->getBufferCL() ); launcher.setBuffer( constraint->getBufferCL() ); launcher.setConst(cellId); launcher.setConst(offset); launcher.setConst(numInBatch); launcher.launch1D(numInBatch); offset+=numInBatch; } } } } for(int iter=0; iter<numIterations; iter++) { for (int cellId=0;cellId<numBatches;cellId++) { int offset = 0; for (int ii=0;ii<B3_MAX_NUM_BATCHES;ii++) { int numInBatch = batchSizes->at(cellId*B3_MAX_NUM_BATCHES+ii); if (!numInBatch) break; { b3LauncherCL launcher( m_data->m_queue, m_data->m_solveSingleFrictionKernel,"m_solveSingleFrictionKernel" ); launcher.setBuffer(bodyBuf->getBufferCL() ); launcher.setBuffer(shapeBuf->getBufferCL() ); launcher.setBuffer( constraint->getBufferCL() ); launcher.setConst(cellId); launcher.setConst(offset); launcher.setConst(numInBatch); launcher.launch1D(numInBatch); offset+=numInBatch; } } } } }
void b3BoundSearchCL::execute(b3OpenCLArray<b3SortData>& src, int nSrc, b3OpenCLArray<unsigned int>& dst, int nDst, Option option ) { b3Int4 constBuffer; constBuffer.x = nSrc; constBuffer.y = nDst; if( option == BOUND_LOWER ) { b3BufferInfoCL bInfo[] = { b3BufferInfoCL( src.getBufferCL(), true ), b3BufferInfoCL( dst.getBufferCL()) }; b3LauncherCL launcher( m_queue, m_lowerSortDataKernel ); launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(b3BufferInfoCL) ); launcher.setConst( nSrc ); launcher.setConst( nDst ); launcher.launch1D( nSrc, 64 ); } else if( option == BOUND_UPPER ) { b3BufferInfoCL bInfo[] = { b3BufferInfoCL( src.getBufferCL(), true ), b3BufferInfoCL( dst.getBufferCL() ) }; b3LauncherCL launcher(m_queue, m_upperSortDataKernel ); launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(b3BufferInfoCL) ); launcher.setConst( nSrc ); launcher.setConst( nDst ); launcher.launch1D( nSrc, 64 ); } else if( option == COUNT ) { b3Assert( m_lower ); b3Assert( m_upper ); b3Assert( m_lower->capacity() <= (int)nDst ); b3Assert( m_upper->capacity() <= (int)nDst ); int zero = 0; m_filler->execute( *m_lower, zero, nDst ); m_filler->execute( *m_upper, zero, nDst ); execute( src, nSrc, *m_lower, nDst, BOUND_LOWER ); execute( src, nSrc, *m_upper, nDst, BOUND_UPPER ); { b3BufferInfoCL bInfo[] = { b3BufferInfoCL( m_upper->getBufferCL(), true ), b3BufferInfoCL( m_lower->getBufferCL(), true ), b3BufferInfoCL( dst.getBufferCL() ) }; b3LauncherCL launcher( m_queue, m_subtractKernel ); launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(b3BufferInfoCL) ); launcher.setConst( nSrc ); launcher.setConst( nDst ); launcher.launch1D( nDst, 64 ); } } else { b3Assert( 0 ); } }
void OpenSLLayer::startStream() { dcblocker_.reset(); if (isStarted_) return; DEBUG("Start OpenSL audio layer"); std::vector<int32_t> hw_infos = Manager::instance().getClient()->getConfigurationManager()->getHardwareAudioFormat(); hardwareFormat_ = AudioFormat(hw_infos[0], 1); // Mono on Android hardwareBuffSize_ = hw_infos[1]; for(auto& buf : playbackBufferStack_) buf.resize(hardwareBuffSize_); for(auto& buf : recordBufferStack_) buf.resize(hardwareBuffSize_); hardwareFormatAvailable(hardwareFormat_); std::thread launcher([this](){ init(); startAudioPlayback(); startAudioCapture(); isStarted_ = true; }); launcher.detach(); }
VirusScanningResult CustomVirusScanner::Scan(const String &executablePath, int virusReturnCode, const String &sFilename) { LOG_DEBUG("Running custom virus scanner..."); String sPath = FileUtilities::GetFilePath(sFilename); String sCommandLine; if (executablePath.Find(_T("%FILE%")) >= 0) { sCommandLine = executablePath; sCommandLine.Replace(_T("%FILE%"), sFilename); } else sCommandLine.Format(_T("%s %s"), executablePath, sFilename); unsigned int exitCode = 0; ProcessLauncher launcher(sCommandLine, sPath); launcher.SetErrorLogTimeout(20000); if (!launcher.Launch(exitCode)) { return VirusScanningResult("CustomVirusScanner::Scan", "Unable to launch executable."); } String sDebugMessage = Formatter::Format("Scanner: {0}. Return code: {1}", sCommandLine, exitCode); LOG_DEBUG(sDebugMessage); if (exitCode == virusReturnCode) return VirusScanningResult(VirusScanningResult::VirusFound, "Unknown"); else return VirusScanningResult(VirusScanningResult::NoVirusFound, Formatter::Format("Return code: {0}", exitCode)); }
void Jpcsp::runJPCSP(Jpcsp::Mode mode,QString path,QWidget *parent) { if(path.length()<1) return; QString sOldPath = QDir::currentPath();//store old directory before change it to jpcsp one if(theSettings->s_jpcspPath.isNull() || theSettings->s_jpcspPath.length()==0) { //QMessageBox::critical(parent,tr("pspudb"),tr("JPCSP's path hasn't been set. Go to Configuration and set the path")); QMessageBox::critical(parent,"pspudb","JPCSP's path hasn't been set. Go to Configuration and set the path"); return; } QDir::setCurrent(theSettings->s_jpcspPath);//change it QProcess launcher(parent); QStringList arguments; arguments << "-Xmx1024m"; arguments << "-XX:MaxPermSize=128m"; arguments << "-XX:ReservedCodeCacheSize=64m"; arguments << "-Djava.library.path=lib/windows-x86"; arguments << "-jar"<< "bin/jpcsp.jar"; if(mode == Jpcsp::file) arguments << "-f" << path; if(mode == Jpcsp::UMD) arguments << "-u" << path; if(theSettings->m_ini.value("/jpcsp/autorun",true).toBool()) arguments << "-r"; //launcher.startDetached("C:\\Program Files (x86)\\Java\\jre6\\bin\\java.exe", arguments); if(theSettings->m_ini.value("/jpcsp/show_console",true).toBool()) launcher.startDetached("C:\\Windows\\System32\\javaw.exe", arguments); else launcher.startDetached("C:\\Windows\\System32\\javaw.exe", arguments); QDir::setCurrent( sOldPath );//restore old directory }
int main(int argc,char **argv) { if(!usage(argc,argv)) return EXIT_FAILURE; launcher(argc,argv); return EXIT_SUCCESS; }
VirusScanningResult ClamWinVirusScanner::Scan(const String &scannerExecutable, const String &databasePath, const String &sFilename) { LOG_DEBUG("Running ClamWin"); String sPath = FileUtilities::GetFilePath(sFilename); String sFileToScan = FileUtilities::GetFileNameFromFullPath(sFilename); String sTempDir = Utilities::GetWin32TempDirectory(); String sCommandLine; sCommandLine.Format(_T("%s --database=\"%s\" \"%s\" --tempdir=\"%s\""), scannerExecutable, databasePath, sFileToScan, sTempDir); unsigned int exitCode = 0; ProcessLauncher launcher(sCommandLine, sPath); launcher.SetErrorLogTimeout(20000); if (!launcher.Launch(exitCode)) { return VirusScanningResult("ClamWinVirusScanner::Scan", "Unable to launch executable."); } String sDebugMessage = Formatter::Format("ClamWin: {0}. Return code: {1}", sCommandLine, exitCode); LOG_DEBUG(sDebugMessage); if (exitCode == 1) return VirusScanningResult(VirusScanningResult::VirusFound, "Unknown"); else return VirusScanningResult(VirusScanningResult::NoVirusFound, Formatter::Format("Return code: {0}", exitCode)); }
int main(int argc, char* argv[]) { // create thread to run "thread manager" once //iCore::MsgThread m(QThread::LowestPriority, true); ESS_ASSERT(argc > 0); Utils::ExeName::Init(argv[0]); Utils::DelayInitHost::Inst().DoInit(); QCoreApplication a(argc, argv); AppExceptionHook hook; std::cout << "IPSIUS Project tests:\n"; Utils::ArgStringList strList(argc, argv); TestFw::StdOutput output; TestFw::TestVerification testVer(CSingleTestTimeout); TestFw::TestLauncher launcher(output); launcher.AddOutputter(testVer); RegisterAllTests(launcher); launcher.Run(strList); // Do final checks FinalChecks(); return 0; }
int main() { if (init_struc(&g_ptr) == FALSE) return (-1); if (launcher() == FALSE) return (-1); return (0); }
//--------------------------------------------------------------- std::shared_ptr<LinkedTask> Crawler::start (const std::string& url, const std::string& grepRegex, unsigned maxLinks, unsigned threadsNum) { //---------------------------------------------------------------- // These functors are set in a way that binds them to reference-counted // private implementation object that can be swapped. // Purpose: to be able to join the threads in a detached thread, // we don't need any delays in the main loop. //---------------------------------------------------------------- auto crawlerImpl = pv; //---------------------------------------------------------------- //---------------------------------------------------------------- std::shared_ptr<LinkedTask> mainTask; try { setMaxLinks(maxLinks); if (nullptr == pv->taskRoot || pv->taskRoot->grepVars.targetUrl != url || pv->taskRoot->grepVars.matchURLVector.empty() ) { //alloc toplevel node: mainTask = LinkedTask::createRootNode(); pv->currentLinksCount->store(0); mainTask->linksCounterPtr = (pv->currentLinksCount); mainTask->maxLinksCountPtr = (pv->maxLinksCount); } else { mainTask = pv->taskRoot; } GrepVars* g = &(mainTask->grepVars); g->targetUrl = url; g->grepExpr = grepRegex; //submit a root-task: //get the first page and then follow it's content's links in new threads. //It is to be done async. to avoid GUI lags etc. std::thread launcher( [crawlerImpl, threadsNum, mainTask]() { /*async start.*/ crawlerImpl->start(mainTask, threadsNum); } ); launcher.detach(); } catch(const std::exception& ex) { std::cerr << ex.what() << "\n"; if(pv->onException) { pv->onException(ex.what()); } return nullptr; } return mainTask; }
static inline TrkLauncherPtr createLauncher(trk::Launcher::Actions actions, const QString &serverName, bool serialFrame, int verbosity) { TrkLauncherPtr launcher(new trk::Launcher(actions)); launcher->setTrkServerName(serverName); launcher->setSerialFrame(serialFrame); launcher->setVerbose(verbosity); return launcher; }
static bool checkLauncher(double startTime, double timeout, uint64_t launchId, MpiOperatorContext* ctx) { boost::shared_ptr<MpiLauncher> launcher(ctx->getLauncher(launchId)); if (launcher && !launcher->isRunning()) { throw SYSTEM_EXCEPTION(SCIDB_SE_INTERNAL, SCIDB_LE_OPERATION_FAILED) << "MPI launcher process"; } checkForTimeout(startTime, timeout, launchId, ctx); return true; }
void testSolverKernel() { const char* solverKernelSource = solverKernelsCL; cl_int pErrNum=0; const char* additionalMacros = ""; cl_program solverProg= btOpenCLUtils::compileCLProgramFromString( g_cxMainContext, g_device, solverKernelSource, &pErrNum,additionalMacros, SOLVER_KERNEL_PATH); btAssert(solverProg); cl_kernel m_batchSolveKernel= btOpenCLUtils::compileCLKernelFromString( g_cxMainContext, g_device, solverKernelSource, "BatchSolveKernel", &pErrNum, solverProg,additionalMacros ); btAssert(m_batchSolveKernel); btLauncherCL launcher(g_cqCommandQue, m_batchSolveKernel); const char* fileName = "m_batchSolveKernel.bin"; FILE* f = fopen(fileName,"rb"); if (f) { int sizeInBytes=0; if (fseek(f, 0, SEEK_END) || (sizeInBytes = ftell(f)) == EOF || fseek(f, 0, SEEK_SET)) { printf("error, cannot get file size\n"); exit(0); } unsigned char* buf = (unsigned char*) malloc(sizeInBytes); fread(buf,sizeInBytes,1,f); int serializedBytes = launcher.deserializeArgs(buf, sizeInBytes,g_cxMainContext); int num = *(int*)&buf[serializedBytes]; launcher.launch1D( num); /*btOpenCLArray<int> pairCount(g_cxMainContext, g_cqCommandQue); int numElements = launcher.m_arrays[2]->size()/sizeof(int); pairCount.setFromOpenCLBuffer(launcher.m_arrays[2]->getBufferCL(),numElements); int count = pairCount.at(0); printf("overlapping pairs = %d\n",count); */ } else { printf("error: cannot find file %s\n",fileName); } clFinish(g_cqCommandQue); clReleaseKernel(m_batchSolveKernel); clReleaseProgram(solverProg); clFinish(g_cqCommandQue); }
int main(int argc, char** argv) { QStringList originalArgs; for (int i=0; i<argc; i++) originalArgs << argv[i]; QApplication app(argc, argv); FluidLauncher launcher(&originalArgs); return app.exec(); }
int Topology::deploy() { Launcher launcher(*this); nextAgentID = (agentID + 1) * fanOut - 2; // A formular to calculate the agentID of the first child int rc = launcher.launch(); if ((initID != -1) && ((gCtrlBlock->getMyRole() != CtrlBlock::BACK_AGENT))){ *(int *)gNotifier->getRetVal(initID) = rc; gNotifier->notify(initID); } return rc; }
int main(int argc, char *argv[]) { Launcher launcher("-Djava.class.path=src/ihmcroscontrol/bin"); launcher.startVM(); launcher.registerNativeMethod("us.ihmc.rosControl.launcher.TestJVMLaunchCallback", "callVoidFunctionWithString", "(Ljava/lang/String;)V", (void *)&callVoidFunctionWithString); launcher.registerNativeMethod("us.ihmc.rosControl.launcher.TestJVMLaunchCallback", "callIntFunctionWithBoolean", "(ZZ)I", (void *)&callIntFunctionWithBoolean); JavaMethod* ctor = launcher.getJavaMethod("us.ihmc.rosControl.launcher.TestJVMLaunchCallback", "<init>", "(I)V"); JavaMethod* method = launcher.getJavaMethod("us.ihmc.rosControl.launcher.TestJVMLaunchCallback", "execute", "(I)V"); JavaMethod* add = launcher.getJavaMethod("us.ihmc.rosControl.launcher.TestJVMLaunchCallback", "add", "()V"); if(ctor && method && add) { jobject obj = launcher.createObject(ctor, 42); timespec start; timespec end; for(int c = 0; c < 10; c++) { clock_gettime(CLOCK_MONOTONIC, &start); for(int i = 0; i < 100000; i++) { launcher.call(add, obj); } clock_gettime(CLOCK_MONOTONIC, &end); timespec elapsed = diff(start, end); std::cout << "Took " << elapsed.tv_sec << "s, " << elapsed.tv_nsec << "nsec for 100000 iterations" << std::endl; } launcher.call(method, obj, 124); } launcher.stopVM(); }
void btFillCL::execute(btOpenCLArray<unsigned int>& src, const unsigned int& value, int n, int offset) { btAssert( n>0 ); { btBufferInfoCL bInfo[] = { btBufferInfoCL( src.getBufferCL() ) }; btLauncherCL launcher( m_commandQueue, m_fillUnsignedIntKernel ); launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(btBufferInfoCL) ); launcher.setConst( n ); launcher.setConst(value); launcher.launch1D( n ); } }
///todo: add some acceleration structure (AABBs, tree etc) void b3GpuRaycast::castRays(const b3AlignedObjectArray<b3RayInfo>& rays, b3AlignedObjectArray<b3RayHit>& hitResults, int numBodies,const struct b3RigidBodyCL* bodies, int numCollidables, const struct b3Collidable* collidables, const struct b3GpuNarrowPhaseInternalData* narrowphaseData) { //castRaysHost(rays,hitResults,numBodies,bodies,numCollidables,collidables,narrowphaseData); B3_PROFILE("castRaysGPU"); b3OpenCLArray<b3RayInfo> gpuRays(m_data->m_context,m_data->m_q); b3OpenCLArray<b3RayHit> gpuHitResults(m_data->m_context,m_data->m_q); { B3_PROFILE("raycast copyFromHost"); gpuRays.copyFromHost(rays); gpuHitResults.resize(hitResults.size()); gpuHitResults.copyFromHost(hitResults); } //run kernel { B3_PROFILE("raycast launch1D"); b3LauncherCL launcher(m_data->m_q,m_data->m_raytraceKernel,"m_raytraceKernel"); int numRays = rays.size(); launcher.setConst(numRays); launcher.setBuffer(gpuRays.getBufferCL()); launcher.setBuffer(gpuHitResults.getBufferCL()); launcher.setConst(numBodies); launcher.setBuffer(narrowphaseData->m_bodyBufferGPU->getBufferCL()); launcher.setBuffer(narrowphaseData->m_collidablesGPU->getBufferCL()); launcher.setBuffer(narrowphaseData->m_convexFacesGPU->getBufferCL()); launcher.setBuffer(narrowphaseData->m_convexPolyhedraGPU->getBufferCL()); launcher.launch1D(numRays); clFinish(m_data->m_q); } //copy results { B3_PROFILE("raycast copyToHost"); gpuHitResults.copyToHost(hitResults); } }
int _main() { std::cout << "Launching tests" << std::endl; const std::string filename = "Test_" + Utilities::currentDateTime("%Y-%m-%d.%H-%M-%S") + ".log"; std::fstream file(filename.c_str(), std::fstream::out); RegressionTestLauncher launcher(file); bool bSucceeded = launcher.Launch(); std::cout << "Log captured in " << filename << std::endl; if (!bSucceeded) { std::cout << "Tests finished with errors. see output file " << filename << std::endl; } return (int)(!bSucceeded); }
void RunTestFW(const TestFw::StringList &sl) { // test framework TestFw::StdOutput output; TestFw::TestLauncher launcher(output); { TestFw::RegisterTestGroup(launcher); UtilsTests::ESSTests::RegisterTestGroup(launcher); iLog::RegisterTestGroup(launcher); // ... } launcher.Run(sl); }
static bool checkLauncher(uint32_t testDelay, uint64_t launchId, MpiOperatorContext* ctx) { std::shared_ptr<MpiLauncher> launcher(ctx->getLauncher(launchId)); if (isDebug()) { if (launcher) { // when running tests, slow down to give launcher a chance to exit ::sleep(testDelay); } } if (launcher && !launcher->isRunning()) { throw SYSTEM_EXCEPTION(SCIDB_SE_INTERNAL, SCIDB_LE_OPERATION_FAILED) << "MPI launcher process already terminated"; } return true; }
int Topology::addBE(Message *msg) { assert(msg); Packer packer(msg->getContentBuf()); char *host = packer.unpackStr(); int lev = packer.unpackInt(); int id = (int) msg->getGroup(); // find the first child agent with weight < fanOut int aID = INVLIDSUCCESSORID; map<int, int>::iterator it = weightMap.begin(); for (; it!=weightMap.end(); ++it) { int weight = (*it).second; if (!isFullTree(weight)) { aID = (*it).first; break; } } int rc = SCI_SUCCESS; if ((aID == INVLIDSUCCESSORID) && ((lev <= level) || (level == height))) { // if do not find Launcher launcher(*this); if (weightMap.size() == 0) { // if this agent does not have any child agents, launch a back end rc = launcher.launchBE(id, host); } else { // if this agent has child agent(s), launch an agent rc = launcher.launchAgent(id, host); } } else { if (aID == INVLIDSUCCESSORID) aID = weightMap.begin()->first; // otherwise delegate this command routingList->addBE(SCI_GROUP_ALL, aID, id); routingList->ucast(aID, msg); incWeight(aID); } if (rc == SCI_SUCCESS) { beMap[id] = host; } return rc; }
void b3Solver::convertToConstraints( const b3OpenCLArray<b3RigidBodyCL>* bodyBuf, const b3OpenCLArray<b3InertiaCL>* shapeBuf, b3OpenCLArray<b3Contact4>* contactsIn, b3OpenCLArray<b3GpuConstraint4>* contactCOut, void* additionalData, int nContacts, const ConstraintCfg& cfg ) { b3OpenCLArray<b3GpuConstraint4>* constraintNative =0; struct CB { int m_nContacts; float m_dt; float m_positionDrift; float m_positionConstraintCoeff; }; { B3_PROFILE("m_contactToConstraintKernel"); CB cdata; cdata.m_nContacts = nContacts; cdata.m_dt = cfg.m_dt; cdata.m_positionDrift = cfg.m_positionDrift; cdata.m_positionConstraintCoeff = cfg.m_positionConstraintCoeff; b3BufferInfoCL bInfo[] = { b3BufferInfoCL( contactsIn->getBufferCL() ), b3BufferInfoCL( bodyBuf->getBufferCL() ), b3BufferInfoCL( shapeBuf->getBufferCL()), b3BufferInfoCL( contactCOut->getBufferCL() ) }; b3LauncherCL launcher( m_queue, m_contactToConstraintKernel ); launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(b3BufferInfoCL) ); //launcher.setConst( cdata ); launcher.setConst(cdata.m_nContacts); launcher.setConst(cdata.m_dt); launcher.setConst(cdata.m_positionDrift); launcher.setConst(cdata.m_positionConstraintCoeff); launcher.launch1D( nContacts, 64 ); clFinish(m_queue); } contactCOut->resize(nContacts); }
void btFillCL::execute(btOpenCLArray<int>& src, const int& value, int n, int offset) { btAssert( n>0 ); btConstData constBuffer; { constBuffer.m_offset = offset; constBuffer.m_n = n; constBuffer.m_UnsignedData = btMakeUnsignedInt4( value,value,value,value ); } { btBufferInfoCL bInfo[] = { btBufferInfoCL( src.getBufferCL() ) }; btLauncherCL launcher( m_commandQueue, m_fillUnsignedIntKernel ); launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(btBufferInfoCL) ); launcher.setConst( constBuffer ); launcher.launch1D( n ); } }
void fileBrowserWidget::RunPSPE() { if(bootbinpath.length()<1) return; QString sOldPath = QDir::currentPath();//store old directory before change it to jpcsp one if(theSettings->s_pspePath.isNull() || theSettings->s_pspePath.length()==0) { QMessageBox::critical(this,tr("pspudb"),tr("PSPE4ALL's path hasn't been set. Go to Configuration and set the path")); return; } QDir::setCurrent(theSettings->s_pspePath);//change it QProcess launcher(this); QStringList arguments; arguments << "-file" << bootbinpath; launcher.startDetached("pspe4all.exe", arguments) ; QDir::setCurrent( sOldPath );//restore old directory }
void b3GpuRaycast::castRays(const b3AlignedObjectArray<b3RayInfo>& rays, b3AlignedObjectArray<b3RayHit>& hitResults, int numBodies,const struct b3RigidBodyCL* bodies, int numCollidables, const struct b3Collidable* collidables) { B3_PROFILE("castRaysGPU"); b3OpenCLArray<b3RayInfo> gpuRays(m_data->m_context,m_data->m_q); gpuRays.copyFromHost(rays); b3OpenCLArray<b3RayHit> gpuHitResults(m_data->m_context,m_data->m_q); gpuHitResults.resize(hitResults.size()); b3OpenCLArray<b3RigidBodyCL> gpuBodies(m_data->m_context,m_data->m_q); gpuBodies.resize(numBodies); gpuBodies.copyFromHostPointer(bodies,numBodies); b3OpenCLArray<b3Collidable> gpuCollidables(m_data->m_context,m_data->m_q); gpuCollidables.resize(numCollidables); gpuCollidables.copyFromHostPointer(collidables,numCollidables); //run kernel { B3_PROFILE("raycast launch1D"); b3LauncherCL launcher(m_data->m_q,m_data->m_raytraceKernel); int numRays = rays.size(); launcher.setConst(numRays); launcher.setBuffer(gpuRays.getBufferCL()); launcher.setBuffer(gpuHitResults.getBufferCL()); launcher.setConst(numBodies); launcher.setBuffer(gpuBodies.getBufferCL()); launcher.setBuffer(gpuCollidables.getBufferCL()); launcher.launch1D(numRays); clFinish(m_data->m_q); } //copy results gpuHitResults.copyToHost(hitResults); }
void Configuration::addLauncher(const QString &url) { if (url.isEmpty() || hasEntry(url)) { return; } Launcher launcher(KUrl(url), m_applet); const int row = (m_arrangementUi.currentEntriesListWidget->currentIndex().row() + 1); m_arrangementUi.currentEntriesListWidget->model()->insertRow(row); const QModelIndex index = m_arrangementUi.currentEntriesListWidget->model()->index(row, 0); m_arrangementUi.currentEntriesListWidget->model()->setData(index, launcher.title(), Qt::DisplayRole); m_arrangementUi.currentEntriesListWidget->model()->setData(index, launcher.icon(), Qt::DecorationRole); m_arrangementUi.currentEntriesListWidget->model()->setData(index, launcher.launcherUrl().pathOrUrl(), Qt::ToolTipRole); m_arrangementUi.currentEntriesListWidget->setCurrentRow(row); modify(); }
void MPIPhysical::postSingleExecute(shared_ptr<Query> query) { // On a non-participating launcher instance it is difficult // to determine when the launch is complete without a sync point. // postSingleExecute() is run after all instances report success of their execute() phase, // that is effectively a sync point. assert(query->getCoordinatorID() == COORDINATOR_INSTANCE); assert(_mustLaunch); assert(_ctx); const uint64_t lastIdInUse = _ctx->getLastLaunchIdInUse(); boost::shared_ptr<MpiLauncher> launcher(_ctx->getLauncher(lastIdInUse)); assert(launcher); if (launcher && launcher == _launcher) { LOG4CXX_DEBUG(logger, "MPIPhysical::postSingleExecute: destroying last launcher for launch = " << lastIdInUse); assert(lastIdInUse == _launchId); launcher->destroy(); _launcher.reset(); } _ctx.reset(); }
void btFillCL::execute(btOpenCLArray<btInt2> &src, const btInt2 &value, int n, int offset) { btAssert( n>0 ); btConstData constBuffer; { constBuffer.m_offset = offset; constBuffer.m_n = n; constBuffer.m_data = btMakeInt4( value.x, value.y, 0, 0 ); } { btBufferInfoCL bInfo[] = { btBufferInfoCL( src.getBufferCL() ) }; btLauncherCL launcher(m_commandQueue, m_fillKernelInt2); launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(btBufferInfoCL) ); launcher.setConst(n); launcher.setConst(value); launcher.setConst(offset); //( constBuffer ); launcher.launch1D( n ); } }
void b3Solver::batchContacts( b3OpenCLArray<b3Contact4>* contacts, int nContacts, b3OpenCLArray<unsigned int>* nNative, b3OpenCLArray<unsigned int>* offsetsNative, int staticIdx ) { int numWorkItems = 64*N_SPLIT*N_SPLIT; { B3_PROFILE("batch generation"); b3Int4 cdata; cdata.x = nContacts; cdata.y = 0; cdata.z = staticIdx; #ifdef BATCH_DEBUG SolverDebugInfo* debugInfo = new SolverDebugInfo[numWorkItems]; adl::b3OpenCLArray<SolverDebugInfo> gpuDebugInfo(data->m_device,numWorkItems); memset(debugInfo,0,sizeof(SolverDebugInfo)*numWorkItems); gpuDebugInfo.write(debugInfo,numWorkItems); #endif b3BufferInfoCL bInfo[] = { b3BufferInfoCL( contacts->getBufferCL() ), b3BufferInfoCL( m_contactBuffer2->getBufferCL()), b3BufferInfoCL( nNative->getBufferCL() ), b3BufferInfoCL( offsetsNative->getBufferCL() ), #ifdef BATCH_DEBUG , b3BufferInfoCL(&gpuDebugInfo) #endif }; { B3_PROFILE("batchingKernel"); //b3LauncherCL launcher( m_queue, m_batchingKernel); cl_kernel k = useNewBatchingKernel ? m_batchingKernelNew : m_batchingKernel; b3LauncherCL launcher( m_queue, k); if (!useNewBatchingKernel ) { launcher.setBuffer( contacts->getBufferCL() ); } launcher.setBuffer( m_contactBuffer2->getBufferCL() ); launcher.setBuffer( nNative->getBufferCL()); launcher.setBuffer( offsetsNative->getBufferCL()); //launcher.setConst( cdata ); launcher.setConst(staticIdx); launcher.launch1D( numWorkItems, 64 ); clFinish(m_queue); } #ifdef BATCH_DEBUG aaaa b3Contact4* hostContacts = new b3Contact4[nContacts]; m_contactBuffer->read(hostContacts,nContacts); clFinish(m_queue); gpuDebugInfo.read(debugInfo,numWorkItems); clFinish(m_queue); for (int i=0; i<numWorkItems; i++) { if (debugInfo[i].m_valInt1>0) { printf("catch\n"); } if (debugInfo[i].m_valInt2>0) { printf("catch22\n"); } if (debugInfo[i].m_valInt3>0) { printf("catch666\n"); } if (debugInfo[i].m_valInt4>0) { printf("catch777\n"); } } delete[] debugInfo; #endif //BATCH_DEBUG } // copy buffer to buffer //b3Assert(m_contactBuffer->size()==nContacts); //contacts->copyFromOpenCLArray( *m_contactBuffer); //clFinish(m_queue);//needed? }