Ejemplo n.º 1
0
void TripletConnection::propagate_backward()
{
	if (stdp_active) { 
		SpikeContainer::const_iterator spikes_end = dst->get_spikes_immediate()->end();
		// loop over all spikes
		for (SpikeContainer::const_iterator spike = dst->get_spikes_immediate()->begin() ; // spike = post_spike
				spike != spikes_end ; 
				++spike ) {
			// Since we need the local id of the postsynaptic neuron that spiked 
			// multiple times, we translate it here:
			NeuronID translated_spike = dst->global2rank(*spike); 

			// loop over all presynaptic partners
			for (const NeuronID * c = bkw->get_row_begin(*spike) ; c != bkw->get_row_end(*spike) ; ++c ) {

				#ifdef CODE_ACTIVATE_PREFETCHING_INTRINSICS
				// prefetches next memory cells to reduce number of last-level cache misses
				_mm_prefetch((const char *)bkw_data[c-bkw_ind+2],  _MM_HINT_NTA);
				#endif

				// computes plasticity update
				AurynWeight * weight = bkw->get_data(c); 
				*weight += dw_post(*c,translated_spike);

				// clips too large weights
				if (*weight>get_max_weight()) *weight=get_max_weight();
			}
		}
	}
}
Ejemplo n.º 2
0
void TripletConnection::propagate_backward()
{
	if (stdp_active) {
		SpikeContainer::const_iterator spikes_end = dst->get_spikes_immediate()->end();
		// process spikes
		for (SpikeContainer::const_iterator spike = dst->get_spikes_immediate()->begin() ; // spike = post_spike
				spike != spikes_end ; ++spike ) {
			NeuronID translated_spike = dst->global2rank(*spike); // only to be used for post traces
			for (NeuronID * c = bkw->get_row_begin(*spike) ; c != bkw->get_row_end(*spike) ; ++c ) {
				_mm_prefetch(bkw_data[c-bkw_ind+1],  _MM_HINT_NTA); // tested this and this and NTA directly here gave the best performance on the SUN
				*bkw_data[c-bkw_ind] = *bkw_data[c-bkw_ind] + dw_post(*c,translated_spike);
				if (*bkw_data[c-bkw_ind]>get_max_weight()) *bkw_data[c-bkw_ind]=get_max_weight();
			}
		}
	}
}
Ejemplo n.º 3
0
inline void SymmetricSTDPConnection::propagate_backward()
{
	NeuronID * ind = bkw->get_row_begin(0); // first element of index array
	AurynWeight ** data = bkw->get_data_begin();
	SpikeContainer::const_iterator spikes_end = dst->get_spikes_immediate()->end();
	for (SpikeContainer::const_iterator spike = dst->get_spikes_immediate()->begin() ; // spike = post_spike
			spike != spikes_end ; ++spike ) {
		for (NeuronID * c = bkw->get_row_begin(*spike) ; c != bkw->get_row_end(*spike) ; ++c ) {

			#ifdef CODE_ACTIVATE_PREFETCHING_INTRINSICS
			_mm_prefetch((const char *)data[c-ind+2],  _MM_HINT_NTA);
			#endif
			
			*data[c-ind] += dw_post(*c);
			if (*data[c-ind] > get_max_weight()) {
				*data[c-ind] = get_max_weight();
			}
		}
	}
}