void Triggerconf::deleteAllModules () { // // removed all modules. have to iterate over and over again // if we removed an item because the nodes reflect live changes // and removing an element changes the child count // if (rootnode == NULL) return; resetError (); DOMNodeList* childs = rootnode->getChildNodes (); if (childs == NULL) return; bool removed; do { removed = false; for (unsigned int i=0; i<childs->getLength (); i++) { DOMNode* child = childs->item (i); if (child == NULL) continue; if (child->getNodeType () == DOMNode::ELEMENT_NODE || child->getNodeType () == DOMNode::TEXT_NODE) { rootnode->removeChild (child); removed = true; break; } } // for (unsigned int i=0; i<childs->getLength (); i++) } while (removed); assert (getModuleNames().size() == 0); }
static CALresult runIntegral(const AstronomyParameters* ap, const IntegralArea* ia, EvaluationState* es, const CLRequest* clr, MWCALInfo* ci, SeparationCALMem* cm) { CALresult err; SeparationCALNames cn; double t1, t2, dt, tAcc = 0.0; SeparationCALChunks chunks; memset(&cn, 0, sizeof(SeparationCALNames)); err = getModuleNames(ci, &cn, cm->numberStreams); if (err != CAL_RESULT_OK) { cal_warn("Failed to get module names", err); return err; } err = setKernelArguments(ci, cm, &cn); if (err != CAL_RESULT_OK) { destroyModuleNames(&cn); return err; } if (findCALChunks(ap, ci, clr, ia, &chunks) != CAL_RESULT_OK) return CAL_RESULT_ERROR; for (; es->nu_step < ia->nu_steps; es->nu_step++) { if (clr->enableCheckpointing && timeToCheckpointGPU(es, ia)) { err = checkpointCAL(cm, ia, es); if (err != CAL_RESULT_OK) break; } t1 = mwGetTimeMilli(); err = runNuStep(ci, cm, ia, &chunks, clr->pollingMode, es->nu_step); if (err != CAL_RESULT_OK) break; t2 = mwGetTimeMilli(); dt = t2 - t1; tAcc += dt; reportProgress(ap, ia, es, es->nu_step + 1, dt); } es->nu_step = 0; warn("Integration time = %f s, average per iteration = %f ms\n", 1.0e-3 * tAcc, tAcc / ia->nu_steps); destroyModuleNames(&cn); freeCALChunks(&chunks); if (err == CAL_RESULT_OK) { readResults(cm, ia, es); addTmpSums(es); /* Add final episode to running totals */ } return err; }