1313#include " AllVertices.h"
1414#include " Connections.h"
1515#include " Global.h"
16-
16+ #ifdef VALIDATION_MODE
17+ #include " AllIFNeurons.h"
18+ #include " OperationManager.h"
19+ #endif
1720#ifdef PERFORMANCE_METRICS
1821float g_time;
1922cudaEvent_t start, stop;
@@ -144,8 +147,21 @@ void GPUModel::advance()
144147 AllVertices &neurons = layout_->getVertices ();
145148 AllEdges &synapses = connections_->getEdges ();
146149
150+ #ifdef VALIDATION_MODE
151+ int verts = Simulator::getInstance ().getTotalVertices ();
152+ std::vector<float > randNoise_h (verts);
153+ for (int i = verts - 1 ; i >= 0 ; i--) {
154+ randNoise_h[i] = (*noiseRNG)();
155+ }
156+ // static int testNumbers = 0;
157+ // for (int i = 0; i < verts; i++) {
158+ // outFile << "index: " << i << " " << randNoise_h[i] << endl;
159+ // }
160+ cudaMemcpy (randNoise_d, randNoise_h.data (), verts * sizeof (float ), cudaMemcpyHostToDevice);
161+ #else
147162 normalMTGPU (randNoise_d);
148-
163+ #endif
164+ // LOG4CPLUS_DEBUG(vertexLogger_, "Index: " << index << " Vm: " << Vm);
149165#ifdef PERFORMANCE_METRICS
150166 cudaLapTime (t_gpu_rndGeneration);
151167 cudaStartTimer ();
@@ -156,7 +172,41 @@ void GPUModel::advance()
156172 dynamic_cast <AllSpikingNeurons &>(neurons).advanceVertices (connections_->getEdges (),
157173 allVerticesDevice_, allEdgesDevice_,
158174 randNoise_d, synapseIndexMapDevice_);
175+ #ifdef VALIDATION_MODE
176+ // (AllIFNeuronsDeviceProperties *)allVerticesDevice,
177+ log4cplus::Logger vertexLogger_ = log4cplus::Logger::getInstance (LOG4CPLUS_TEXT (" vertex" ));
178+ std::vector<float > sp_h (verts);
179+ std::vector<float > vm_h (verts);
180+ std::vector<float > Inoise_h (verts);
181+ AllIFNeuronsDeviceProperties validationNeurons;
182+ HANDLE_ERROR (cudaMemcpy ((void *)&validationNeurons, allVerticesDevice_,
183+ sizeof (AllIFNeuronsDeviceProperties), cudaMemcpyDeviceToHost));
184+ HANDLE_ERROR (cudaMemcpy (sp_h.data (), validationNeurons.spValidation_ , verts * sizeof (float ),
185+ cudaMemcpyDeviceToHost));
186+ HANDLE_ERROR (cudaMemcpy (vm_h.data (), validationNeurons.Vm_ , verts * sizeof (float ),
187+ cudaMemcpyDeviceToHost));
188+ HANDLE_ERROR (cudaMemcpy (Inoise_h.data (), validationNeurons.Inoise_ , verts * sizeof (float ),
189+ cudaMemcpyDeviceToHost));
159190
191+ for (int i = verts - 1 ; i >= 0 ; i--) {
192+ LOG4CPLUS_DEBUG (vertexLogger_, endl
193+ << " Advance Index[" << i << " ] :: Noise = "
194+ << randNoise_h[i] << " \t Vm: " << vm_h[i] << endl
195+ << " \t sp = " << sp_h[i] << endl
196+ << " \t Inoise = " << Inoise_h[i] << endl);
197+ }
198+ #endif
199+ // LOG4CPLUS_DEBUG(vertexLogger_, "ADVANCE NEURON LIF[" << index << "] :: Noise = " << noise);
200+ // LOG4CPLUS_DEBUG(vertexLogger_, "Index: " << index << " Vm: " << Vm);
201+ // LOG4CPLUS_DEBUG(vertexLogger_, "NEURON[" << index << "] {" << endl
202+ // << "\tVm = " << Vm << endl
203+ // << "\tVthresh = " << Vthresh << endl
204+ // << "\tsummationPoint = " << summationPoint << endl
205+ // << "\tI0 = " << I0 << endl
206+ // << "\tInoise = " << Inoise << endl
207+ // << "\tC1 = " << C1 << endl
208+ // << "\tC2 = " << C2 << endl
209+ // << "}" << endl);
160210#ifdef PERFORMANCE_METRICS
161211 cudaLapTime (t_gpu_advanceNeurons);
162212 cudaStartTimer ();
0 commit comments