//2 tests: max difference can be 5e-4, max std is 5e-5 int identicalBatchProbe::outputState(double timed){ int status = StatsProbe::outputState(timed); const PVLayerLoc * loc = getTargetLayer()->getLayerLoc(); //const pvdata_t * A = getTargetLayer()->getLayerData(); const pvdata_t * A = getTargetLayer()->getActivity(); int numExtNeurons = getTargetLayer()->getNumExtended(); for (int i = 0; i < numExtNeurons; i++){ pvdata_t checkVal = A[i]; for(int b = 0; b < loc->nbatch; b++){ const pvdata_t * ABatch = A + b * getTargetLayer()->getNumExtended(); float diff = fabs(checkVal - ABatch[i]); if(diff > 1e-4){ std::cout << "Difference at neuron " << i << ", batch 0: " << checkVal << " batch " << b << ": " << ABatch[i] << "\n"; } assert(diff <= 1e-4); } //if(fabs(A[i]) != 0){ // int xpos = kxPos(i, loc->nx+loc->halo.lt+loc->halo.rt, loc->ny+loc->halo.dn+loc->halo.up, loc->nf); // int ypos = kyPos(i, loc->nx+loc->halo.lt+loc->halo.rt, loc->ny+loc->halo.dn+loc->halo.up, loc->nf); // int fpos = featureIndex(i, loc->nx+loc->halo.lt+loc->halo.rt, loc->ny+loc->halo.dn+loc->halo.up, loc->nf); // std::cout << "[" << xpos << "," << ypos << "," << fpos << "] = " << std::fixed << A[i] << "\n"; //} ////For max difference roundoff errors //assert(fabs(A[i]) < 5e-4); } //For max std of 5e-5 //assert(sigma <= 5e-5); return status; }
int StochasticReleaseTestProbe::communicateInitInfo() { int status = StatsProbe::communicateInitInfo(); assert(getTargetLayer()); long int num_steps = getParent()->getFinalStep() - getParent()->getInitialStep(); pvalues = (double *) calloc(num_steps*getTargetLayer()->getLayerLoc()->nf, sizeof(double)); if (pvalues == NULL) { pvError().printf("StochasticReleaseTestProbe error: unable to allocate memory for pvalues: %s\n", strerror(errno)); } return status; }
int StochasticReleaseTestProbe::computePValues(long int step, int f) { int status = PV_SUCCESS; assert(step >=0 && step < INT_MAX); int nf = getTargetLayer()->getLayerLoc()->nf; assert(f >= 0 && f < nf); int idx = (step-1)*nf + f; pvwdata_t wgt = conn->get_wDataStart(0)[f*(nf+1)]; // weights should be one-to-one weights HyPerLayer * pre = conn->preSynapticLayer(); const pvdata_t * preactPtr = pre->getLayerData(); const PVLayerLoc * preLoc = pre->getLayerLoc(); const int numPreNeurons = pre->getNumNeurons(); bool found=false; pvdata_t preact = 0.0f; for (int n=f; n<numPreNeurons; n+=nf) { int nExt = kIndexExtended(n, preLoc->nx, preLoc->ny, preLoc->nf, preLoc->halo.lt, preLoc->halo.rt, preLoc->halo.dn, preLoc->halo.up); pvdata_t a = preactPtr[nExt]; if (a!=0.0f) { if (found) { assert(preact==a); } else { found = true; preact = a; } } } preact *= getParent()->getDeltaTime(); if (preact < 0.0f) preact = 0.0f; if (preact > 1.0f) preact = 1.0f; const PVLayerLoc * loc = getTargetLayer()->getLayerLoc(); const pvdata_t * activity = getTargetLayer()->getLayerData(); int nnzf = 0; const int numNeurons = getTargetLayer()->getNumNeurons(); for (int n=f; n<numNeurons; n+=nf) { int nExt = kIndexExtended(n, loc->nx, loc->ny, loc->nf, loc->halo.lt, loc->halo.rt, loc->halo.dn, loc->halo.up); assert(activity[nExt]==0 || activity[nExt]==wgt); if (activity[nExt]!=0) nnzf++; } HyPerLayer * l = getTargetLayer(); HyPerCol * hc = l->getParent(); MPI_Allreduce(MPI_IN_PLACE, &nnzf, 1, MPI_INT, MPI_SUM, hc->icCommunicator()->communicator()); if (hc->columnId()==0) { const int neuronsPerFeature = l->getNumGlobalNeurons()/nf; double mean = preact * neuronsPerFeature; double stddev = sqrt(neuronsPerFeature*preact*(1-preact)); double numdevs = (nnzf-mean)/stddev; pvalues[idx] = erfc(fabs(numdevs)/sqrt(2)); fprintf(outputstream->fp, " Feature %d, nnz=%5d, expectation=%7.1f, std.dev.=%5.1f, discrepancy of %f deviations, p-value %f\n", f, nnzf, mean, stddev, numdevs, pvalues[idx]); } assert(status==PV_SUCCESS); return status; }
int RescaleLayerTestProbe::communicateInitInfo() { int status = StatsProbe::communicateInitInfo(); assert(getTargetLayer()); RescaleLayer * targetRescaleLayer = dynamic_cast<RescaleLayer *>(getTargetLayer()); if (targetRescaleLayer==NULL) { if (getParent()->columnId()==0) { fprintf(stderr, "RescaleLayerTestProbe Error: targetLayer \"%s\" is not a RescaleLayer.\n", this->getTargetName()); } MPI_Barrier(getParent()->icCommunicator()->communicator()); exit(EXIT_FAILURE); } return status; }
int StochasticReleaseTestProbe::outputState(double timed) { // Set conn. Can't do that in initStochasticReleaseTestProbe because we need to search for a conn with the given post, and connections' postLayerName is not necessarily set. if (conn==NULL) { HyPerCol * hc = getTargetLayer()->getParent(); int numconns = hc->numberOfConnections(); for (int c=0; c<numconns; c++) { if (!strcmp(hc->getConnection(c)->getPostLayerName(),getTargetLayer()->getName())) { assert(conn==NULL); // Only one connection can go to this layer for this probe to work BaseConnection * baseConn = hc->getConnection(c); conn = dynamic_cast<HyPerConn *>(baseConn); } } assert(conn!=NULL); } assert(conn->numberOfAxonalArborLists()==1); assert(conn->xPatchSize()==1); assert(conn->yPatchSize()==1); assert(conn->getNumDataPatches()==conn->fPatchSize()); int status = StatsProbe::outputState(timed); assert(status==PV_SUCCESS); HyPerLayer * l = getTargetLayer(); HyPerCol * hc = l->getParent(); int nf = l->getLayerLoc()->nf; if (timed>0.0) { for (int f=0; f < nf; f++) { if (computePValues(hc->getCurrentStep(), f)!=PV_SUCCESS) status = PV_FAILURE; } assert(status == PV_SUCCESS); if (hc->columnId()==0 && hc->simulationTime()+hc->getDeltaTime()/2>=hc->getStopTime()) { // This is the last timestep // sort the p-values and apply Holm-Bonferroni method since there is one for each timestep and each feature. long int num_steps = hc->getFinalStep() - hc->getInitialStep(); long int N = num_steps * nf; qsort(pvalues, (size_t) N, sizeof(*pvalues), compar); while(N>0 && isnan(pvalues[N-1])) { N--; } for (long int k=0; k<N; k++) { if (pvalues[k]*(N-k)<0.05) { fprintf(stderr, "layer \"%s\" FAILED: p-value %ld out of %ld (ordered by size) with Holm-Bonferroni correction = %f\n", getTargetLayer()->getName(), k, N, pvalues[k]*(N-k)); status = PV_FAILURE; } } } } assert(status==PV_SUCCESS); return status; }
int LayerFunctionProbe::outputState(double timef) { for(int b = 0; b < getTargetLayer()->getParent()->getNBatch(); b++){ pvdata_t val = function->evaluate(timef, getTargetLayer(), b); #ifdef PV_USE_MPI if( getTargetLayer()->getParent()->icCommunicator()->commRank() != 0 ) return PV_SUCCESS; #endif // PV_USE_MPI if( function ) { return writeState(timef, getTargetLayer(), b, val); } else { fprintf(stderr, "LayerFunctionProbe \"%s\" for layer %s: function has not been set\n", getMessage(), getTargetLayer()->getName()); return PV_FAILURE; } } return PV_SUCCESS; } // end LayerFunctionProbe::outputState(float, HyPerLayer *)
/** * @time * @l */ int DatastoreDelayTestProbe::outputState(double timed) { HyPerLayer * l = getTargetLayer(); InterColComm * icComm = l->getParent()->icCommunicator(); const int rcvProc = 0; if( icComm->commRank() != rcvProc ) { return PV_SUCCESS; } int status = PV_SUCCESS; int numDelayLevels = l->getParent()->getLayer(0)->getNumDelayLevels(); pvdata_t correctValue = numDelayLevels*(numDelayLevels+1)/2; if( timed >= numDelayLevels+2 ) { pvdata_t * V = l->getV(); for( int k=0; k<l->getNumNeuronsAllBatches(); k++ ) { if( V[k] != correctValue ) { fprintf(outputstream->fp, "Layer \"%s\": timef = %f, neuron %d: value is %f instead of %d\n", l->getName(), timed, k, V[k], (int) correctValue); status = PV_FAILURE; } } if( status == PV_SUCCESS) { fprintf(outputstream->fp, "Layer \"%s\": timef = %f, all neurons have correct value %d\n", l->getName(), timed, (int) correctValue); } } assert(status == PV_SUCCESS); return PV_SUCCESS; }
//2 tests: max difference can be 5e-4, max std is 5e-5 int GPUSystemTestProbe::outputState(double timed){ int status = StatsProbe::outputState(timed); const PVLayerLoc * loc = getTargetLayer()->getLayerLoc(); int numExtNeurons = getTargetLayer()->getNumExtendedAllBatches(); const pvdata_t * A = getTargetLayer()->getLayerData(); float sumsq = 0; for (int i = 0; i < numExtNeurons; i++){ assert(fabs(A[i]) < 5e-4); } for(int b = 0; b < loc->nbatch; b++){ //For max std of 5e-5 assert(sigma[b] <= 5e-5); } return status; }
int ArborTestProbe::outputState(double timed) { int status = StatsProbe::outputState(timed); InterColComm * icComm = getTargetLayer()->getParent()->icCommunicator(); const int rcvProc = 0; if( icComm->commRank() != rcvProc ) { return 0; } for(int b = 0; b < getParent()->getNBatch(); b++){ if(timed==1.0f){ assert((avg[b]>0.2499)&&(avg[b]<0.2501)); } else if(timed==2.0f){ assert((avg[b]>0.4999)&&(avg[b]<0.5001)); } else if(timed==3.0f){ assert((avg[b]>0.7499)&&(avg[b]<0.7501)); } else if(timed>3.0f){ assert((fMin[b]>0.9999)&&(fMin[b]<1.001)); assert((fMax[b]>0.9999)&&(fMax[b]<1.001)); assert((avg[b]>0.9999)&&(avg[b]<1.001)); } } return status; }
int SUPointProbe::communicateInitInfo() { //Target layer set in LayerProbe communicateInitInfo int status = LayerProbe::communicateInitInfo(); const PVLayerLoc * loc = getTargetLayer()->getLayerLoc(); xLoc = ((loc->nxGlobal/2) - 1); yLoc = ((loc->nyGlobal/2) - 1); //fLoc changes based on which neuron is being tested, grab from movie layer. Set to 0 for now fLoc = 0; //Grab disparity movie layer to see which neuron we're testing HyPerLayer* h_layer = parent->getLayerFromName(disparityLayerName); if (h_layer==NULL) { if (parent->columnId()==0) { fprintf(stderr, "%s \"%s\" error: disparityLayerName \"%s\" is not a layer in the HyPerCol.\n", parent->parameters()->groupKeywordFromName(name), name, disparityLayerName); } } disparityLayer = dynamic_cast<Movie *>(h_layer); if (disparityLayer==NULL) { if (parent->columnId()==0) { fprintf(stderr, "%s \"%s\" error: disparityLayerName \"%s\" is not a MovieLayer.\n", parent->parameters()->groupKeywordFromName(name), name, disparityLayerName); } } return status; }
/** * @time * @l */ int MPITestProbe::outputState(double timed) { int status = StatsProbe::outputState(timed); InterColComm * icComm = getTargetLayer()->getParent()->icCommunicator(); const int rcvProc = 0; if( icComm->commRank() != rcvProc ) { return status; } double tol = 1e-4f; // if many to one connection, each neuron should receive its global x/y/f position // if one to many connection, the position of the nearest sending cell is received // assume sending layer has scale factor == 1 int xScaleLog2 = getTargetLayer()->getCLayer()->xScale; // determine min/max position of receiving layer const PVLayerLoc * loc = getTargetLayer()->getLayerLoc(); int nf = loc->nf; int nxGlobal = loc->nxGlobal; int nyGlobal = loc->nyGlobal; float min_global_xpos = xPosGlobal(0, xScaleLog2, nxGlobal, nyGlobal, nf); int kGlobal = nf * nxGlobal * nyGlobal - 1; float max_global_xpos = xPosGlobal(kGlobal, xScaleLog2, nxGlobal, nyGlobal, nf); if (xScaleLog2 < 0) { float xpos_shift = 0.5 - min_global_xpos; min_global_xpos = 0.5; max_global_xpos -= xpos_shift; } float ave_global_xpos = (min_global_xpos + max_global_xpos) / 2.0f; outputStream->printf("%s min_global_xpos==%f ave_global_xpos==%f max_global_xpos==%f", getMessage(), min_global_xpos, ave_global_xpos, max_global_xpos); output() << std::endl; for(int b = 0; b < parent->getNBatch(); b++){ if (timed > 3.0f) { assert((fMin[b]/min_global_xpos > (1 - tol)) && (fMin[b]/min_global_xpos < (1 + tol))); assert((fMax[b]/max_global_xpos > (1 - tol)) && (fMax[b]/max_global_xpos < (1 + tol))); assert((avg[b]/ave_global_xpos > (1 - tol)) && (avg[b]/ave_global_xpos < (1 + tol))); } } return status; }
int MatchingPursuitProbe::outputState(double timed) { int status = PV_SUCCESS; const PVLayerLoc * loc = getTargetLayer()->getLayerLoc(); if (timed>0.0) { for (int k=0; k<getTargetLayer()->getNumNeurons(); k++) { int kGlobal = globalIndexFromLocal(k, *loc); pvdata_t correctValue = nearbyint((double)kGlobal + timed)==256.0 ? (pvdata_t) kGlobal/255.0f : 0.0f; int kExtended = kIndexExtended(k, loc->nx, loc->ny, loc->nf, loc->halo.lt, loc->halo.rt, loc->halo.dn, loc->halo.up); pvdata_t observed = getTargetLayer()->getLayerData()[kExtended]; pvdata_t relerr = fabs(observed-correctValue)/correctValue; if (relerr>1e-7) { fprintf(stderr, "Time %f: Neuron %d (global index) has relative error %f (%f versus correct %f)\n", timed, kGlobal, relerr, observed, correctValue); status = PV_FAILURE; } } } assert(status==PV_SUCCESS); return status; }
void TextStreamProbe::featureNumberToCharacter(int code, char ** cbufidx, char * bufstart, int buflen) { assert(bufstart-*cbufidx<buflen); // Test array bounds int nf = getTargetLayer()->getLayerLoc()->nf; if (useCapitalization) { assert(nf==97); switch(code) { case 95: **cbufidx = '\n'; (*cbufidx)++; break; case 96: assert(bufstart-*cbufidx<buflen-1); **cbufidx = (char) -62; // UTF-8 for section sign (*cbufidx)++; **cbufidx = (char) -89; (*cbufidx)++; break; default: **cbufidx = code + 32; (*cbufidx)++; break; } } else { assert(nf==71); switch(code) { case 95: **cbufidx = '\n'; (*cbufidx)++; break; case 96: assert(bufstart-*cbufidx<buflen-1); **cbufidx = (char) -62; // UTF-8 for section sign (*cbufidx)++; **cbufidx = (char) -89; (*cbufidx)++; break; default: char outcode = code + (char) 32; if (outcode>=65 && outcode<=90) outcode += 32; **cbufidx = outcode; (*cbufidx)++; break; } } return; }
int PointProbe::communicateInitInfo() { int status = LayerProbe::communicateInitInfo(); assert(getTargetLayer()); const PVLayerLoc * loc = getTargetLayer()->getLayerLoc(); bool isRoot = getParent()->icCommunicator()->commRank()==0; if( (xLoc < 0 || xLoc > loc->nxGlobal) && isRoot ) { fprintf(stderr, "PointProbe on layer %s: xLoc coordinate %d is out of bounds (layer has %d neurons in the x-direction.\n", getTargetLayer()->getName(), xLoc, loc->nxGlobal); status = PV_FAILURE; } if( (yLoc < 0 || yLoc > loc->nyGlobal) && isRoot ) { fprintf(stderr, "PointProbe on layer %s: yLoc coordinate %d is out of bounds (layer has %d neurons in the y-direction.\n", getTargetLayer()->getName(), yLoc, loc->nyGlobal); status = PV_FAILURE; } if( (fLoc < 0 || fLoc > loc->nf) && isRoot ) { fprintf(stderr, "PointProbe on layer %s: fLoc coordinate %d is out of bounds (layer has %d features.\n", getTargetLayer()->getName(), fLoc, loc->nf); status = PV_FAILURE; } if( (batchLoc < 0 || batchLoc > loc->nbatch) && isRoot ) { fprintf(stderr, "PointProbe on layer %s: batchLoc coordinate %d is out of bounds (layer has %d batches.\n", getTargetLayer()->getName(), batchLoc, loc->nbatch); status = PV_FAILURE; } if( status != PV_SUCCESS ) abort(); return status; }
int BatchSweepTestProbe::outputState(double timed) { int status = StatsProbe::outputState(timed); InterColComm * icComm = getTargetLayer()->getParent()->icCommunicator(); const int rcvProc = 0; if( icComm->commRank() != rcvProc ) { return 0; } for(int b = 0; b < parent->getNBatch(); b++){ if (timed >= 3.0 ) { assert(fabs(expectedSum - sum[b])<1e-6); assert(fabs(expectedMin - fMin[b])<1e-6); assert(fabs(expectedMax - fMax[b])<1e-6); } } return status; }
int TextStreamProbe::communicateInitInfo() { int status = LayerProbe::communicateInitInfo(); int nf = getTargetLayer()->getLayerLoc()->nf; switch(nf) { case 97: useCapitalization = true; break; case 71: useCapitalization = false; break; default: fprintf(stderr, "TextStreamProbe error: layer \"%s\" must have either 97 or 71 features.\n", getTargetLayer()->getName()); exit(EXIT_FAILURE); break; } return status; }
int InitWeightTestProbe::outputState(double timed) { int status = StatsProbe::outputState(timed); InterColComm * icComm = getTargetLayer()->getParent()->icCommunicator(); const int rcvProc = 0; if( icComm->commRank() != rcvProc ) { return 0; } for(int b = 0; b < parent->getNBatch(); b++){ if(timed>2.0f){ assert((fMin[b]>-0.001)&&(fMin[b]<0.001)); assert((fMax[b]>-0.001)&&(fMax[b]<0.001)); assert((avg[b]>-0.001)&&(avg[b]<0.001)); } } return status; }
int CloneKernelConnTestProbe::outputState(double timed) { int status = StatsProbe::outputState(timed); InterColComm * icComm = getTargetLayer()->getParent()->icCommunicator(); const int rcvProc = 0; if( icComm->commRank() != rcvProc ) { return 0; } for(int b = 0; b < getParent()->getNBatch(); b++){ if(timed>2.0f){ assert(fabs(fMin[b]) < 1e-6); assert(fabs(fMax[b]) < 1e-6); assert(fabs(avg[b]) < 1e-6); } } return status; }
int LayerFunctionProbe::communicateInitInfo() { int status = StatsProbe::communicateInitInfo(); if (status == PV_SUCCESS && parentGenColProbeName != NULL) { if (parentGenColProbeName != NULL && parentGenColProbeName[0] != '\0') { ColProbe * colprobe = getParent()->getColProbeFromName(parentGenColProbeName); GenColProbe * gencolprobe = dynamic_cast<GenColProbe *>(colprobe); if (gencolprobe==NULL) { if (getParent()->columnId()==0) { fprintf(stderr, "%s \"%s\" error: parentGenColProbe \"%s\" is not a GenColProbe in the column.\n", getParent()->parameters()->groupKeywordFromName(getName()), getName(), parentGenColProbeName); } #ifdef PV_USE_MPI MPI_Barrier(getParent()->icCommunicator()->communicator()); #endif exit(EXIT_FAILURE); } status = gencolprobe->addLayerTerm((LayerFunctionProbe *) this, getTargetLayer(), coeff); } } return status; }
/** * @time * @l * @k * @kex * NOTES: * - Only the activity buffer covers the extended frame - this is the frame that * includes boundaries. * - The other dynamic variables (G_E, G_I, V, Vth) cover the "real" or "restricted" * frame. */ int PointLIFProbe::writeState(double timed) { if (parent->columnId()==0 && timed >= writeTime) { pvAssert(outputStream); writeTime += writeStep; PVLayerLoc const * loc = getTargetLayer()->getLayerLoc(); const int k = kIndex(xLoc, yLoc, fLoc, loc->nxGlobal, loc->nyGlobal, loc->nf); double * valuesBuffer = getValuesBuffer(); outputStream->printf("%s t=%.1f %d" "G_E=" CONDUCTANCE_PRINT_FORMAT " G_I=" CONDUCTANCE_PRINT_FORMAT " G_IB=" CONDUCTANCE_PRINT_FORMAT " V=" CONDUCTANCE_PRINT_FORMAT " Vth=" CONDUCTANCE_PRINT_FORMAT " a=%.1f", getMessage(), timed, k, valuesBuffer[0], valuesBuffer[1], valuesBuffer[2], valuesBuffer[3], valuesBuffer[4], valuesBuffer[5]); output() << std::endl; } return PV_SUCCESS; }
// implement LayerProbe interface // int GLDisplay::outputState(double timef) { return loadTexture(getTextureId(getTargetLayer()), getTargetLayer()); }
int RescaleLayerTestProbe::outputState(double timed) { int status = StatsProbe::outputState(timed); if (timed==getParent()->getStartTime()) { return PV_SUCCESS; } float tolerance = 2.0e-5f; InterColComm * icComm = getTargetLayer()->getParent()->icCommunicator(); bool isRoot = icComm->commRank() == 0; RescaleLayer * targetRescaleLayer = dynamic_cast<RescaleLayer *>(getTargetLayer()); assert(targetRescaleLayer); if (targetRescaleLayer->getRescaleMethod()==NULL) { fprintf(stderr, "RescaleLayerTestProbe \"%s\": RescaleLayer \"%s\" does not have rescaleMethod set. Exiting.\n", name, targetRescaleLayer->getName()); status = PV_FAILURE; } else if (!strcmp(targetRescaleLayer->getRescaleMethod(), "maxmin")) { if (!isRoot) { return PV_SUCCESS; } for(int b = 0; b < parent->getNBatch(); b++){ float targetMax = targetRescaleLayer->getTargetMax(); if (fabs(fMax[b]-targetMax)>tolerance) { fprintf(stderr, "RescaleLayerTestProbe \"%s\": RescaleLayer \"%s\" has max %f instead of target max %f\n", getName(), targetRescaleLayer->getName(), fMax[b], targetMax); status = PV_FAILURE; } float targetMin = targetRescaleLayer->getTargetMin(); if (fabs(fMin[b]-targetMin)>tolerance) { fprintf(stderr, "RescaleLayerTestProbe \"%s\": RescaleLayer \"%s\" has min %f instead of target min %f\n", getName(), targetRescaleLayer->getName(), fMin[b], targetMin); status = PV_FAILURE; } // Now, check whether rescaled activity and original V are colinear. PVLayerLoc const * rescaleLoc = targetRescaleLayer->getLayerLoc(); PVHalo const * rescaleHalo = &rescaleLoc->halo; int nk = rescaleLoc->nx * rescaleLoc->nf; int ny = rescaleLoc->ny; int rescaleStrideYExtended = (rescaleLoc->nx + rescaleHalo->lt + rescaleHalo->rt) * rescaleLoc->nf; int rescaleExtendedOffset = kIndexExtended(0, rescaleLoc->nx, rescaleLoc->ny, rescaleLoc->nf, rescaleHalo->lt, rescaleHalo->rt, rescaleHalo->dn, rescaleHalo->up); pvadata_t const * rescaledData = targetRescaleLayer->getLayerData() + b * targetRescaleLayer->getNumExtended() + rescaleExtendedOffset; PVLayerLoc const * origLoc = targetRescaleLayer->getOriginalLayer()->getLayerLoc(); PVHalo const * origHalo = &origLoc->halo; assert(nk == origLoc->nx * origLoc->nf); assert(ny == origLoc->ny); int origStrideYExtended = (origLoc->nx + origHalo->lt + origHalo->rt) * origLoc->nf; int origExtendedOffset = kIndexExtended(0, rescaleLoc->nx, rescaleLoc->ny, rescaleLoc->nf, rescaleHalo->lt, rescaleHalo->rt, rescaleHalo->dn, rescaleHalo->up); pvadata_t const * origData = targetRescaleLayer->getOriginalLayer()->getLayerData() + b * targetRescaleLayer->getOriginalLayer()->getNumExtended() + origExtendedOffset; bool iscolinear = colinear(nk, ny, origStrideYExtended, rescaleStrideYExtended, origData, rescaledData, tolerance, NULL, NULL, NULL); if (!iscolinear) { fprintf(stderr, "RescaleLayerTestProbe \"%s\": Rescale layer \"%s\" data is not a linear rescaling of original membrane potential.\n", getName(), targetRescaleLayer->getName()); status = PV_FAILURE; } } } //l2 norm with a patch size of 1 (default) should be the same as rescaling with meanstd with target mean 0 and std of 1/sqrt(patchsize) else if (!strcmp(targetRescaleLayer->getRescaleMethod(), "meanstd") || !strcmp(targetRescaleLayer->getRescaleMethod(), "l2")) { if (!isRoot) { return PV_SUCCESS; } for(int b = 0; b < parent->getNBatch(); b++){ float targetMean, targetStd; if(!strcmp(targetRescaleLayer->getRescaleMethod(), "meanstd")){ targetMean = targetRescaleLayer->getTargetMean(); targetStd = targetRescaleLayer->getTargetStd(); } else{ targetMean = 0; targetStd = 1/sqrt((float)targetRescaleLayer->getL2PatchSize()); } if (fabs(avg[b]-targetMean)>tolerance) { fprintf(stderr, "RescaleLayerTestProbe \"%s\": RescaleLayer \"%s\" has mean %f instead of target mean %f\n", getName(), targetRescaleLayer->getName(), (double)avg[b], targetMean); status = PV_FAILURE; } if (sigma[b]>tolerance && fabs(sigma[b]-targetStd)>tolerance) { fprintf(stderr, "RescaleLayerTestProbe \"%s\": RescaleLayer \"%s\" has std.dev. %f instead of target std.dev. %f\n", getName(), targetRescaleLayer->getName(), (double)sigma[b], targetStd); status = PV_FAILURE; } // Now, check whether rescaled activity and original V are colinear. PVLayerLoc const * rescaleLoc = targetRescaleLayer->getLayerLoc(); PVHalo const * rescaleHalo = &rescaleLoc->halo; int nk = rescaleLoc->nx * rescaleLoc->nf; int ny = rescaleLoc->ny; int rescaleStrideYExtended = (rescaleLoc->nx + rescaleHalo->lt + rescaleHalo->rt) * rescaleLoc->nf; int rescaleExtendedOffset = kIndexExtended(0, rescaleLoc->nx, rescaleLoc->ny, rescaleLoc->nf, rescaleHalo->lt, rescaleHalo->rt, rescaleHalo->dn, rescaleHalo->up); pvadata_t const * rescaledData = targetRescaleLayer->getLayerData() + b*targetRescaleLayer->getNumExtended() + rescaleExtendedOffset; PVLayerLoc const * origLoc = targetRescaleLayer->getOriginalLayer()->getLayerLoc(); PVHalo const * origHalo = &origLoc->halo; assert(nk == origLoc->nx * origLoc->nf); assert(ny == origLoc->ny); int origStrideYExtended = (origLoc->nx + origHalo->lt + origHalo->rt) * origLoc->nf; int origExtendedOffset = kIndexExtended(0, rescaleLoc->nx, rescaleLoc->ny, rescaleLoc->nf, rescaleHalo->lt, rescaleHalo->rt, rescaleHalo->dn, rescaleHalo->up); pvadata_t const * origData = targetRescaleLayer->getOriginalLayer()->getLayerData() + b*targetRescaleLayer->getOriginalLayer()->getNumExtended() + origExtendedOffset; bool iscolinear = colinear(nk, ny, origStrideYExtended, rescaleStrideYExtended, origData, rescaledData, tolerance, NULL, NULL, NULL); if (!iscolinear) { fprintf(stderr, "RescaleLayerTestProbe \"%s\": Rescale layer \"%s\" data is not a linear rescaling of original membrane potential.\n", getName(), targetRescaleLayer->getName()); status = PV_FAILURE; } } } else if (!strcmp(targetRescaleLayer->getRescaleMethod(), "pointmeanstd")) { PVLayerLoc const * loc = targetRescaleLayer->getLayerLoc(); int nf = loc->nf; if (nf<2) { return PV_SUCCESS; } PVHalo const * halo = &loc->halo; float targetMean = targetRescaleLayer->getTargetMean(); float targetStd = targetRescaleLayer->getTargetStd(); int numNeurons = targetRescaleLayer->getNumNeurons(); for(int b = 0; b < parent->getNBatch(); b++){ pvpotentialdata_t const * originalData = targetRescaleLayer->getV() + b*targetRescaleLayer->getNumNeurons(); pvadata_t const * rescaledData = targetRescaleLayer->getLayerData() + b*targetRescaleLayer->getNumExtended(); for (int k=0; k<numNeurons; k+=nf) { int kExtended = kIndexExtended(k, loc->nx, loc->ny, loc->nf, halo->lt, halo->rt, halo->dn, halo->up); double pointmean = 0.0; for (int f=0; f<nf; f++) { pointmean += rescaledData[kExtended+f]; } pointmean /= nf; double pointstd = 0.0; for (int f=0; f<nf; f++) { double d = rescaledData[kExtended+f]-pointmean; pointstd += d*d; } pointstd /= nf; pointstd = sqrt(pointstd); if (fabs(pointmean-targetMean)>tolerance) { fprintf(stderr, "RescaleLayerTestProbe \"%s\": RescaleLayer \"%s\", location in rank %d, starting at restricted neuron %d, has mean %f instead of target mean %f\n", getName(), targetRescaleLayer->getName(), getParent()->columnId(), k, pointmean, targetMean); status = PV_FAILURE; } if (pointstd>tolerance && fabs(pointstd-targetStd)>tolerance) { fprintf(stderr, "RescaleLayerTestProbe \"%s\": RescaleLayer \"%s\", location in rank %d, starting at restricted neuron %d, has std.dev. %f instead of target std.dev. %f\n", getName(), targetRescaleLayer->getName(), getParent()->columnId(), k, pointstd, targetStd); status = PV_FAILURE; } bool iscolinear = colinear(nf, 1, 0, 0, &originalData[k], &rescaledData[kExtended], tolerance, NULL, NULL, NULL); if (!iscolinear) { fprintf(stderr, "RescaleLayerTestProbe \"%s\": RescaleLayer \"%s\", location in rank %d, starting at restricted neuron %d, is not a linear rescaling.\n", getName(), targetRescaleLayer->getName(), parent->columnId(), k); status = PV_FAILURE; } } } } else if (!strcmp(targetRescaleLayer->getRescaleMethod(), "zerotonegative")) { int numNeurons = targetRescaleLayer->getNumNeurons(); assert(numNeurons == targetRescaleLayer->getOriginalLayer()->getNumNeurons()); PVLayerLoc const * rescaleLoc = targetRescaleLayer->getLayerLoc(); PVHalo const * rescaleHalo = &rescaleLoc->halo; int nf = rescaleLoc->nf; HyPerLayer * originalLayer = targetRescaleLayer->getOriginalLayer(); PVLayerLoc const * origLoc = originalLayer->getLayerLoc(); PVHalo const * origHalo = &origLoc->halo; assert(origLoc->nf == nf); for(int b = 0; b < parent->getNBatch(); b++){ pvadata_t const * rescaledData = targetRescaleLayer->getLayerData() + b * targetRescaleLayer->getNumExtended(); pvadata_t const * originalData = originalLayer->getLayerData() + b * originalLayer->getNumExtended(); for (int k=0; k<numNeurons; k++) { int rescale_kExtended = kIndexExtended(k, rescaleLoc->nx, rescaleLoc->ny, rescaleLoc->nf, rescaleHalo->lt, rescaleHalo->rt, rescaleHalo->dn, rescaleHalo->up); int orig_kExtended = kIndexExtended(k, origLoc->nx, origLoc->ny, origLoc->nf, origHalo->lt, origHalo->rt, origHalo->dn, origHalo->up); pvadata_t observedval = rescaledData[rescale_kExtended]; pvpotentialdata_t correctval = originalData[orig_kExtended] ? observedval : -1.0; if (observedval != correctval) { fprintf(stderr, "RescaleLayerTestProbe \"%s\": RescaleLayer \"%s\", rank %d, restricted neuron %d has value %f instead of expected %f\n.", this->getName(), targetRescaleLayer->getName(), parent->columnId(), k, observedval, correctval); status = PV_FAILURE; } } } } else { assert(0); // All allowable rescaleMethod values are handled above. } if (status == PV_FAILURE) { exit(EXIT_FAILURE); } return status; }
int PointLIFProbe::calcValues(double timevalue) { // TODO: Reduce duplicated code between PointProbe::calcValues and PointLIFProbe::calcValues. assert(this->getNumValues()==NUMBER_OF_VALUES); LIF * LIF_layer = dynamic_cast<LIF *>(getTargetLayer()); assert(LIF_layer != NULL); pvconductance_t const * G_E = LIF_layer->getConductance(CHANNEL_EXC) + batchLoc * LIF_layer->getNumNeurons(); pvconductance_t const * G_I = LIF_layer->getConductance(CHANNEL_INH) + batchLoc * LIF_layer->getNumNeurons(); pvconductance_t const * G_IB = LIF_layer->getConductance(CHANNEL_INHB) + batchLoc * LIF_layer->getNumNeurons(); pvdata_t const * V = getTargetLayer()->getV(); pvdata_t const * Vth = LIF_layer->getVth(); pvdata_t const * activity = getTargetLayer()->getLayerData(); assert(V && activity && G_E && G_I && G_IB && Vth); double * valuesBuffer = this->getValuesBuffer(); //We need to calculate which mpi process contains the target point, and send that info to the root process //Each process calculates local index const PVLayerLoc * loc = getTargetLayer()->getLayerLoc(); //Calculate local cords from global const int kx0 = loc->kx0; const int ky0 = loc->ky0; const int kb0 = loc->kb0; const int nx = loc->nx; const int ny = loc->ny; const int nf = loc->nf; const int nbatch = loc->nbatch; const int xLocLocal = xLoc - kx0; const int yLocLocal = yLoc - ky0; const int nbatchLocal = batchLoc - kb0; //if in bounds if( xLocLocal >= 0 && xLocLocal < nx && yLocLocal >= 0 && yLocLocal < ny && nbatchLocal >= 0 && nbatchLocal < nbatch){ const pvdata_t * V = getTargetLayer()->getV(); const pvdata_t * activity = getTargetLayer()->getLayerData(); //Send V and A to root const int k = kIndex(xLocLocal, yLocLocal, fLoc, nx, ny, nf); const int kbatch = k + nbatchLocal*getTargetLayer()->getNumNeurons(); valuesBuffer[0] = G_E[kbatch]; valuesBuffer[1] = G_I[kbatch]; valuesBuffer[2] = G_IB[kbatch]; valuesBuffer[3] = V[kbatch]; valuesBuffer[4] = Vth[kbatch]; const int kex = kIndexExtended(k, nx, ny, nf, loc->halo.lt, loc->halo.rt, loc->halo.dn, loc->halo.up); valuesBuffer[5] = activity[kex + nbatchLocal * getTargetLayer()->getNumExtended()]; //If not in root process, send to root process if(parent->columnId()!=0){ MPI_Send(valuesBuffer, NUMBER_OF_VALUES, MPI_DOUBLE, 0, 0, parent->icCommunicator()->communicator()); } } //Root process if(parent->columnId()==0){ //Calculate which rank target neuron is //TODO we need to calculate rank from batch as well int xRank = xLoc/nx; int yRank = yLoc/ny; int srcRank = rankFromRowAndColumn(yRank, xRank, parent->icCommunicator()->numCommRows(), parent->icCommunicator()->numCommColumns()); //If srcRank is not root process, MPI_Recv from that rank if(srcRank != 0){ MPI_Recv(valuesBuffer, NUMBER_OF_VALUES, MPI_DOUBLE, srcRank, 0, parent->icCommunicator()->communicator(), MPI_STATUS_IGNORE); } } return PV_SUCCESS; }
int PointProbe::calcValues(double timevalue) { assert(this->getNumValues()==2); double * valuesBuffer = this->getValuesBuffer(); //We need to calculate which mpi process contains the target point, and send that info to the root process //Each process calculates local index const PVLayerLoc * loc = getTargetLayer()->getLayerLoc(); //Calculate local cords from global const int kx0 = loc->kx0; const int ky0 = loc->ky0; const int kb0 = loc->kb0; const int nx = loc->nx; const int ny = loc->ny; const int nf = loc->nf; const int nbatch = loc->nbatch; const int xLocLocal = xLoc - kx0; const int yLocLocal = yLoc - ky0; const int nbatchLocal = batchLoc - kb0; //if in bounds if( xLocLocal >= 0 && xLocLocal < nx && yLocLocal >= 0 && yLocLocal < ny && nbatchLocal >= 0 && nbatchLocal < nbatch){ const pvdata_t * V = getTargetLayer()->getV(); const pvdata_t * activity = getTargetLayer()->getLayerData(); //Send V and A to root const int k = kIndex(xLocLocal, yLocLocal, fLoc, nx, ny, nf); if(V){ valuesBuffer[0] = V[k + nbatchLocal*getTargetLayer()->getNumNeurons()]; } else { valuesBuffer[0] = 0.0; } if(activity){ const int kex = kIndexExtended(k, nx, ny, nf, loc->halo.lt, loc->halo.rt, loc->halo.dn, loc->halo.up); valuesBuffer[1] = activity[kex + nbatchLocal * getTargetLayer()->getNumExtended()]; } else { valuesBuffer[1] = 0.0; } //If not in root process, send to root process if(parent->columnId()!=0){ MPI_Send(&valuesBuffer, 2, MPI_DOUBLE, 0, 0, parent->icCommunicator()->communicator()); } } //Root process if(parent->columnId()==0){ //Calculate which rank target neuron is //TODO we need to calculate rank from batch as well int xRank = xLoc/nx; int yRank = yLoc/ny; int srcRank = rankFromRowAndColumn(yRank, xRank, parent->icCommunicator()->numCommRows(), parent->icCommunicator()->numCommColumns()); //If srcRank is not root process, MPI_Recv from that rank if(srcRank != 0){ MPI_Recv(&valuesBuffer, 2, MPI_DOUBLE, srcRank, 0, parent->icCommunicator()->communicator(), MPI_STATUS_IGNORE); } } return PV_SUCCESS; }
double L2NormProbe::getValueInternal(double timevalue, int index) { if (index < 0 || index >= getParent()->getNBatch()) { return PV_FAILURE; } PVLayerLoc const * loc = getTargetLayer()->getLayerLoc(); int const nx = loc->nx; int const ny = loc->ny; int const nf = loc->nf; PVHalo const * halo = &loc->halo; int const lt = halo->lt; int const rt = halo->rt; int const dn = halo->dn; int const up = halo->up; double l2normsq = 0.0; pvadata_t const * aBuffer = getTargetLayer()->getLayerData() + index * getTargetLayer()->getNumExtended(); if (getMaskLayer()) { PVLayerLoc const * maskLoc = getMaskLayer()->getLayerLoc(); PVHalo const * maskHalo = &maskLoc->halo; pvadata_t const * maskLayerData = getMaskLayer()->getLayerData() + index*getMaskLayer()->getNumExtended(); // Is there a DataStore method to return the part of the layer data for a given batch index? int const maskLt = maskHalo->lt; int const maskRt = maskHalo->rt; int const maskDn = maskHalo->dn; int const maskUp = maskHalo->up; if (maskHasSingleFeature()) { assert(getTargetLayer()->getNumNeurons()==nx*ny*nf); int nxy = nx*ny; #ifdef PV_USE_OPENMP_THREADS #pragma omp parallel for reduction(+ : l2normsq) #endif // PV_USE_OPENMP_THREADS for (int kxy=0; kxy<nxy; kxy++) { int kexMask = kIndexExtended(kxy, nx, ny, 1, maskLt, maskRt, maskDn, maskUp); if (maskLayerData[kexMask]) { int featureBase = kxy*nf; for (int f=0; f<nf; f++) { int kex = kIndexExtended(featureBase++, nx, ny, nf, lt, rt, dn, up); pvadata_t val = aBuffer[kex]; l2normsq += val*val; } } } } else { #ifdef PV_USE_OPENMP_THREADS #pragma omp parallel for reduction(+ : l2normsq) #endif // PV_USE_OPENMP_THREADS for (int k=0; k<getTargetLayer()->getNumNeurons(); k++) { int kex = kIndexExtended(k, nx, ny, nf, lt, rt, dn, up); int kexMask = kIndexExtended(k, nx, ny, nf, maskLt, maskRt, maskDn, maskUp); // if (maskLayerData[kexMask]) { pvadata_t val = aBuffer[kex]; l2normsq += maskLayerData[kexMask] * val*val; // } } } } else { if (getTargetLayer()->getSparseFlag()) { DataStore * store = parent->icCommunicator()->publisherStore(getTargetLayer()->getLayerId()); int numActive = (int) store->numActiveBuffer(index)[0]; unsigned int const * activeList = store->activeIndicesBuffer(index); #ifdef PV_USE_OPENMP_THREADS #pragma omp parallel for reduction(+ : l2normsq) #endif // PV_USE_OPENMP_THREADS for (int k=0; k<numActive; k++) { int extIndex = activeList[k]; int inRestricted = !extendedIndexInBorderRegion(extIndex, nx, ny, nf, halo->lt, halo->rt, halo->dn, halo->up); pvadata_t val = inRestricted * fabsf(aBuffer[extIndex]); l2normsq += val*val; } } else { #ifdef PV_USE_OPENMP_THREADS #pragma omp parallel for reduction(+ : l2normsq) #endif // PV_USE_OPENMP_THREADS for (int k=0; k<getTargetLayer()->getNumNeurons(); k++) { int kex = kIndexExtended(k, nx, ny, nf, lt, rt, dn, up); pvadata_t val = aBuffer[kex]; l2normsq += val*val; } } } return l2normsq; }
double L0NormProbe::getValueInternal(double timevalue, int index) { if (index < 0 || index >= getParent()->getNBatch()) { return PV_FAILURE; } PVLayerLoc const * loc = getTargetLayer()->getLayerLoc(); int const nx = loc->nx; int const ny = loc->ny; int const nf = loc->nf; PVHalo const * halo = &loc->halo; int const lt = halo->lt; int const rt = halo->rt; int const dn = halo->dn; int const up = halo->up; int sum = 0; pvadata_t const * aBuffer = getTargetLayer()->getLayerData() + index * getTargetLayer()->getNumExtended(); if (getMaskLayer()) { PVLayerLoc const * maskLoc = getMaskLayer()->getLayerLoc(); PVHalo const * maskHalo = &maskLoc->halo; pvadata_t const * maskLayerData = getMaskLayer()->getLayerData() + index*getMaskLayer()->getNumExtended(); // Is there a DataStore method to return the part of the layer data for a given batch index? int const maskLt = maskHalo->lt; int const maskRt = maskHalo->rt; int const maskDn = maskHalo->dn; int const maskUp = maskHalo->up; if (maskHasSingleFeature()) { assert(getTargetLayer()->getNumNeurons()==nx*ny*nf); int nxy = nx*ny; #ifdef PV_USE_OPENMP_THREADS #pragma omp parallel for #endif // PV_USE_OPENMP_THREADS for (int kxy=0; kxy<nxy; kxy++) { int kexMask = kIndexExtended(kxy, nx, ny, 1, maskLt, maskRt, maskDn, maskUp); if (maskLayerData[kexMask]) { int featureBase = kxy*nf; for (int f=0; f<nf; f++) { int kex = kIndexExtended(featureBase++, nx, ny, nf, lt, rt, dn, up); pvadata_t val = aBuffer[kex]; sum += aBuffer[kex]>nnzThreshold || aBuffer[kex]<nnzThreshold; } } } } else { #ifdef PV_USE_OPENMP_THREADS #pragma omp parallel for #endif // PV_USE_OPENMP_THREADS for (int k=0; k<getTargetLayer()->getNumNeurons(); k++) { int kex = kIndexExtended(k, nx, ny, nf, lt, rt, dn, up); int kexMask = kIndexExtended(k, nx, ny, nf, maskLt, maskRt, maskDn, maskUp); if (maskLayerData[kexMask]) { pvadata_t val = aBuffer[kex]; sum += aBuffer[kex]>nnzThreshold || aBuffer[kex]<nnzThreshold; } } } } else { #ifdef PV_USE_OPENMP_THREADS #pragma omp parallel for #endif // PV_USE_OPENMP_THREADS for (int k=0; k<getTargetLayer()->getNumNeurons(); k++) { int kex = kIndexExtended(k, nx, ny, nf, lt, rt, dn, up); pvadata_t val = aBuffer[kex]; sum += aBuffer[kex]>nnzThreshold || aBuffer[kex]<nnzThreshold; } } return (double) sum; }
int TestNotAlwaysAllZerosProbe::outputState(double timed) { int status = StatsProbe::outputState(timed); if (status != PV_SUCCESS) { pvError().printf("!!Time %f: TestNotAlwaysAllZerosProbe::outputState failed for layer \"%s\"\n", timed, getTargetLayer()->getName()); } for(int b = 0; b < parent->getNBatch(); b++){ if (nnz[b] != 0) { nonzeroValueOccurred = true; } } return status; }
int TextStreamProbe::outputState(double timef) { if (timef<nextDisplayTime) return PV_SUCCESS; nextDisplayTime += displayPeriod; int status = PV_SUCCESS; assert(getTargetLayer()->getParent()->icCommunicator()->numCommColumns()==1); int num_rows = getTargetLayer()->getParent()->icCommunicator()->numCommRows(); const PVLayerLoc * loc = getTargetLayer()->getLayerLoc(); int nx = loc->nx; assert(nx==loc->nxGlobal); // num mpi cols is always 1 int ny = loc->ny; int nyGlobal = loc->nyGlobal; int nf = loc->nf; assert(nyGlobal==ny*num_rows); MPI_Comm mpi_comm = getTargetLayer()->getParent()->icCommunicator()->communicator(); pvdata_t * buf = (pvdata_t *) calloc(ny*nf*nx, sizeof(pvdata_t)); // Buffer holding the max feature value; int rootproc = 0; if (getTargetLayer()->getParent()->columnId()==rootproc) { char * cbuf = (char *) calloc(2*nx, sizeof(char)); // Translation of feature numbers into characters. 2x because nonprintable characters for (int proc=0; proc<num_rows; proc++) { if (proc==rootproc) { // Copy to layer data to buf. for (int y=0; y<ny; y++) { int kex = kIndexExtended(y*nx*nf, nx, ny, nf, loc->halo.lt, loc->halo.rt, loc->halo.dn, loc->halo.up); memcpy(&buf[y*nx*nf], &getTargetLayer()->getLayerData()[kex], nx*nf*sizeof(pvdata_t)); } } else { #ifdef PV_USE_MPI MPI_Recv(buf, ny*nx*nf, MPI_FLOAT, proc, 157, mpi_comm, MPI_STATUS_IGNORE); #endif } for (int y=0; y<ny; y++) { char * curcbuf = cbuf; for (int x=0; x<nx; x++) { pvdata_t fmax = -FLT_MAX; int floc = -1; for (int f=0; f<nf; f++) { if (buf[nf*(nx*y+x)+f]>fmax) { fmax=buf[nf*(nx*y+x)+f]; floc = f; } } assert(floc>=0 && floc < nf); // Now floc is the location of the maximum over f, and fmax is the value. featureNumberToCharacter(floc, &curcbuf, cbuf, 2*nx*ny); } assert(curcbuf-cbuf<2*nx*ny); *curcbuf = '\0'; int firstChar = (int)(unsigned char)cbuf[0]; if (firstChar == 10) { // line feed fprintf(outputstream->fp,"\n"); } else { fprintf(outputstream->fp, "%s ", cbuf); } } } //Flush outputstream fflush(outputstream->fp); //fprintf(outputstream->fp, "\n"); free(cbuf); cbuf = NULL; } else { for (int y=0; y<ny; y++) { int kex = kIndexExtended(y*nx*nf, nx, ny, nf, loc->halo.lt, loc->halo.rt, loc->halo.dn, loc->halo.up); memcpy(&buf[y*nx*nf], &getTargetLayer()->getLayerData()[kex], nx*nf*sizeof(pvdata_t)); } #ifdef PV_USE_MPI MPI_Send(buf, ny*nx*nf, MPI_FLOAT, rootproc, 157, mpi_comm); #endif } free(buf); buf=NULL; return status; }