int assertAllZeroes(HyPerCol * hc, int argc, char * argv[]) { const char * targetLayerName = "comparison"; HyPerLayer * layer = hc->getLayerFromName(targetLayerName); assert(layer); LayerProbe * probe = NULL; int np = layer->getNumProbes(); for (int p=0; p<np; p++) { if (!strcmp(layer->getProbe(p)->getName(), "ComparisonTest")) { probe = layer->getProbe(p); break; } } RequireAllZeroActivityProbe * allzeroProbe = dynamic_cast<RequireAllZeroActivityProbe *>(probe); assert(allzeroProbe); if (allzeroProbe->getNonzeroFound()) { if (hc->columnId()==0) { double t = allzeroProbe->getNonzeroTime(); fprintf(stderr, "%s \"%s\" had at least one nonzero activity value, beginning at time %f\n", layer->getKeyword(), targetLayerName, t); } MPI_Barrier(hc->icCommunicator()->communicator()); exit(EXIT_FAILURE); } return PV_SUCCESS; }
int customexit(HyPerCol * hc, int argc, char * argv[]) { HyPerLayer * layer = hc->getLayerFromName("comparison"); assert(layer!=NULL); assert(layer->getNumProbes()>0); RequireAllZeroActivityProbe * probe = NULL; for (int k=0; k<layer->getNumProbes(); k++) { LayerProbe * p = layer->getProbe(k); probe = dynamic_cast<RequireAllZeroActivityProbe *>(p); if (probe != NULL) { break; } } assert(probe!=NULL); int status = PV_SUCCESS; if (probe->getNonzeroFound()) { if (hc->columnId()==0) { fprintf(stderr, "comparison layer had a nonzero activity at time %f\n", probe->getNonzeroTime()); status = PV_FAILURE; } } return status; }