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,19 +147,21 @@ void GPUModel::advance()
144147 AllVertices &neurons = layout_->getVertices ();
145148 AllEdges &synapses = connections_->getEdges ();
146149
147- // #ifdef VALIDATION_MODE
148- // int verts = Simulator::getInstance().getTotalVertices();
149- // std::vector<float> randNoise_h(verts);
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;
150157 // for (int i = 0; i < verts; i++) {
151- // randNoise_h[i] = noiseRNG->rand() ;
158+ // outFile << "index: " << i << " " << randNoise_h[i] << endl ;
152159 // }
153- // cudaMemcpy(randNoise_d, randNoise_h.data(), verts * sizeof(float), cudaMemcpyHostToDevice);
154- // #endif // VALIDATION_MODE
155-
156- // #else VALIDATION_MODE
160+ cudaMemcpy (randNoise_d, randNoise_h.data (), verts * sizeof (float ), cudaMemcpyHostToDevice);
161+ #else
157162 normalMTGPU (randNoise_d);
158- // #endif
159-
163+ #endif
164+ // LOG4CPLUS_DEBUG(vertexLogger_, "Index: " << index << " Vm: " << Vm);
160165#ifdef PERFORMANCE_METRICS
161166 cudaLapTime (t_gpu_rndGeneration);
162167 cudaStartTimer ();
@@ -167,7 +172,43 @@ void GPUModel::advance()
167172 dynamic_cast <AllSpikingNeurons &>(neurons).advanceVertices (connections_->getEdges (),
168173 allVerticesDevice_, allEdgesDevice_,
169174 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+ HANDLE_ERROR (cudaMemcpy (sp_h.data (), allVerticesDevice_->summationPoints_ , verts * sizeof (float ),
182+ cudaMemcpyDeviceToHost));
183+ HANDLE_ERROR (
184+ cudaMemcpy (sp_h.data (), randNoise_d, verts * sizeof (float ), cudaMemcpyDeviceToHost));
185+ HANDLE_ERROR (cudaMemcpy (vm_h.data (), ((AllIFNeuronsDeviceProperties *)(allVerticesDevice_))->Vm_ ,
186+ verts * sizeof (float ), cudaMemcpyDeviceToHost));
187+ HANDLE_ERROR (cudaMemcpy (Inoise_h.data (),
188+ ((AllIFNeuronsDeviceProperties *)(allVerticesDevice_))->Inoise_ ,
189+ verts * sizeof (float ), cudaMemcpyDeviceToHost));
190+ HANDLE_ERROR (cudaMemcpy (sp_h.data (), allVerticesDevice_->spValidation_ , verts * sizeof (float ),
191+ cudaMemcpyDeviceToHost));
170192
193+ for (int i = 0 ; i < verts; i++) {
194+ LOG4CPLUS_DEBUG (vertexLogger_, " CUDA advance Index[ "
195+ << i << " ] :: Noise = " << randNoise_h[i]
196+ << " \t Vm: " << vm_h[i] << endl
197+ << " \t sp = " << sp_h[i] << endl
198+ << " \t Inoise = " << Inoise_h[i] << endl);
199+ }
200+ #endif
201+ // LOG4CPLUS_DEBUG(vertexLogger_, "ADVANCE NEURON LIF[" << index << "] :: Noise = " << noise);
202+ // LOG4CPLUS_DEBUG(vertexLogger_, "Index: " << index << " Vm: " << Vm);
203+ // LOG4CPLUS_DEBUG(vertexLogger_, "NEURON[" << index << "] {" << endl
204+ // << "\tVm = " << Vm << endl
205+ // << "\tVthresh = " << Vthresh << endl
206+ // << "\tsummationPoint = " << summationPoint << endl
207+ // << "\tI0 = " << I0 << endl
208+ // << "\tInoise = " << Inoise << endl
209+ // << "\tC1 = " << C1 << endl
210+ // << "\tC2 = " << C2 << endl
211+ // << "}" << endl);
171212#ifdef PERFORMANCE_METRICS
172213 cudaLapTime (t_gpu_advanceNeurons);
173214 cudaStartTimer ();
0 commit comments