Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/examples/torus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ targetNeuron(
/* Don't connect to self unless we wrap around torus */
assert(!(targetX == int(sourceX) && targetY == int(sourceY) && dist < PATCH_HEIGHT-1));

return std::make_pair<unsigned, double>(neuronIndex(targetPatch, targetX, targetY), dist);
return std::make_pair<unsigned, double>(neuronIndex(targetPatch, targetX, targetY), (double)dist);
}


Expand Down
33 changes: 32 additions & 1 deletion src/nemo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,45 @@ ADD_LIBRARY(nemo_base
TARGET_LINK_LIBRARIES(nemo_base ${LTDL_LIBRARY} ${Boost_LIBRARIES})
SET_TARGET_PROPERTIES(nemo_base PROPERTIES DEFINE_SYMBOL NEMO_BASE_EXPORTS)

ADD_LIBRARY(nemo_base_a STATIC
Axon.cpp
ConfigurationImpl.cpp
ConnectivityMatrix.cpp
FiringBuffer.cpp
fixedpoint.cpp
Network.cpp
NetworkImpl.cpp
Neuron.cpp
Neurons.cpp
NeuronType.cpp
Simulation.cpp
SimulationBackend.cpp
OutgoingDelays.cpp
Plugin.cpp
ReadableNetwork.cpp
RNG.cpp
runtime/RCM.cpp
StdpFunction.cpp
StdpProcess.cpp
)

TARGET_LINK_LIBRARIES(nemo_base_a ${LTDL_LIBRARY} ${Boost_LIBRARIES})
SET_TARGET_PROPERTIES(nemo_base_a PROPERTIES DEFINE_SYMBOL NEMO_BASE_EXPORTS)


ADD_LIBRARY(nemo nemo.cpp nemo_c.cpp Configuration.cpp)
SET_TARGET_PROPERTIES(nemo PROPERTIES DEFINE_SYMBOL NEMO_EXPORTS)
TARGET_LINK_LIBRARIES(nemo nemo_base ${BACKEND_LIBS})


INSTALL(TARGETS nemo nemo_base DESTINATION ${INSTALL_LIB_DIR})


ADD_LIBRARY(nemo_a STATIC nemo.cpp nemo_c.cpp Configuration.cpp)
SET_TARGET_PROPERTIES(nemo_a PROPERTIES DEFINE_SYMBOL NEMO_EXPORTS)
TARGET_LINK_LIBRARIES(nemo_a nemo_base_a ${BACKEND_LIBS})

INSTALL(TARGETS nemo_a nemo_base_a DESTINATION ${INSTALL_LIB_DIR})

INSTALL(FILES
exception.hpp
types.h
Expand Down
4 changes: 2 additions & 2 deletions src/nemo/ConnectivityMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ ConnectivityMatrix::accumulateStdp(const std::vector<uint64_t>& recentFiring)
const RSynapse* rdata_ptr = m_rcm->data(*wi);
fix_t* accumulator = m_rcm->accumulator(*wi);

for(unsigned s=0; s < m_rcm->WIDTH && remaining--; s++) {
for(int s=0; s < m_rcm->WIDTH && remaining--; s++) {
const RSynapse& rdata = rdata_ptr[s];
uint64_t preFiring = recentFiring[rdata.source] >> rdata.delay;
fix_t w_diff = m_stdp->weightChange(preFiring, rdata.source, target);
Expand Down Expand Up @@ -303,7 +303,7 @@ ConnectivityMatrix::applyStdp(float reward)
const uint32_t* forward = m_rcm->forward(*wi);
fix_t* accumulator = m_rcm->accumulator(*wi);

for(unsigned s=0; s < m_rcm->WIDTH && remaining--; s++) {
for(int s=0; s < m_rcm->WIDTH && remaining--; s++) {

const RSynapse& rsynapse = rdata_ptr[s];
fix_t* w_old = weight(rsynapse, forward[s]);
Expand Down
5 changes: 5 additions & 0 deletions src/nemo/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ SET_TARGET_PROPERTIES(nemo_cpu PROPERTIES DEFINE_SYMBOL NEMO_CPU_EXPORTS)
TARGET_LINK_LIBRARIES(nemo_cpu nemo_base ${Boost_LIBRARIES})
INSTALL(TARGETS nemo_cpu DESTINATION ${INSTALL_LIB_DIR})

ADD_LIBRARY(nemo_cpu_a STATIC Simulation.cpp Neurons.cpp)
SET_TARGET_PROPERTIES(nemo_cpu_a PROPERTIES DEFINE_SYMBOL NEMO_CPU_EXPORTS)
TARGET_LINK_LIBRARIES(nemo_cpu_a)
INSTALL(TARGETS nemo_cpu_a DESTINATION ${INSTALL_LIB_DIR})

ADD_SUBDIRECTORY(plugins)
30 changes: 15 additions & 15 deletions src/nemo/cpu/plugins/HH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ cpu_update_neurons(
const float* m0 = stateBase + b0 * stateHistoryStride + STATE_M * stateVarStride;
const float* h0 = stateBase + b0 * stateHistoryStride + STATE_H * stateVarStride;
const float* dir0 = stateBase + b0 * stateHistoryStride + STATE_DIR * stateVarStride;


/* Next state */
size_t b1 = (cycle+1) % historyLength;

float* v1 = stateBase + b1 * stateHistoryStride + STATE_V * stateVarStride;
float* n1 = stateBase + b1 * stateHistoryStride + STATE_N * stateVarStride;
float* m1 = stateBase + b1 * stateHistoryStride + STATE_M * stateVarStride;
float* h1 = stateBase + b1 * stateHistoryStride + STATE_H * stateVarStride;
float* n1 = stateBase + b1 * stateHistoryStride + STATE_N * stateVarStride;
float* m1 = stateBase + b1 * stateHistoryStride + STATE_M * stateVarStride;
float* h1 = stateBase + b1 * stateHistoryStride + STATE_H * stateVarStride;
float* dir1 = stateBase + b1 * stateHistoryStride + STATE_DIR * stateVarStride;

float dt = 0.001f; // Simulation time increment
float gNa = 120.0f;
float gK = 36.0f;
Expand All @@ -63,7 +63,7 @@ cpu_update_neurons(
float C = 1.0f;
float RevE = 0.0f;
float RevI = -70.0f;
int inc_max= (int)(1/dt);
unsigned int inc_max= (unsigned int)(1/dt);

for(unsigned int nn=start; nn < end; ++nn) {

Expand All @@ -73,11 +73,11 @@ cpu_update_neurons(
float h = h0[nn];
float dir = dir0[nn];


float Excit = currentEPSP[nn];
float Inhib = currentIPSP[nn];
float Exter = currentExternal[nn];

/* no need to clear current?PSP. */

//! \todo clear this outside kernel
Expand All @@ -88,7 +88,7 @@ cpu_update_neurons(

float I = (Excit*(RevE-v)) + (Inhib*((RevI-v)/-1)) + Exter;


float alphan = (0.1f-0.01f*(v+65.0f))/(exp(1.0f-0.1f*(v+65.0f))-1.0f);
float alpham = (2.5f-0.1f*(v+65.0f))/(exp(2.5f-0.1f*(v+65.0f))-1.0f);
float alphah = 0.07f*exp(-(v+65.0f)/20.0f);
Expand All @@ -108,16 +108,16 @@ cpu_update_neurons(
float newv = v + dt*(-Ik+I)/C;

float new_dir = (newv-v);
float change = dir<0 | newv<-45 ? 0 : new_dir;
float change = (dir<0 || newv<-45) ? 0 : new_dir;
dir = new_dir;


if(!fired[nn] && cycle >= 10)
fired[nn] = change < -0.000000001;

v=newv;


}

fired[nn] |= fstim[nn];
Expand All @@ -132,8 +132,8 @@ cpu_update_neurons(
n1[nn] = n;
m1[nn] = m;
h1[nn] = h;
dir1[nn] = dir;
dir1[nn] = dir;

}
}

Expand Down