Closed jhielson closed 2 years ago
Hello @jhielson ,
The change to enable CoreNEURON
through NetPyNE
is now merged.
You can enable CoreNEURON
and GPU execution using the following options in your cfg.py
file:
cfg.coreneuron = True
cfg.gpu = True
You can find an example in https://github.com/Neurosim-lab/netpyne/blob/development/examples/M1detailed/cfg.py. Let us know if you have any issue with this
Dear @iomaganaris,
Thanks for your update. I am not sure if it is working in my computer yet. First, I cloned the development branch of the netpyne repository and installed it in my computer.
$pip install -e .
Then, I added those lines to my code as presented in the example file.
def buildSimConfig(self):
# Simulation options
simConfig = specs.SimConfig()
simConfig.duration = self.t_sim
simConfig.dt = 2
simConfig.coreneuron = True #<<<<<<<<<<<<<
simConfig.gpu = True #<<<<<<<<<<<<<
...
As a result, my simulation runs fine without any error message. But the run time and real-time ratio has not been affected. I was expecting an improvement on that. What do you think?
Hello @jhielson ,
My guess about this is issue that you didn't use a NEURON installation with CoreNEURON enabled.
To be able to run CoreNEURON on GPU transparently with NEURON you have to install NEURON with CoreNEURON from source using these instructions.
After installing NEURON using these instructions for a GPU enabled build you will be able to compile your mod files with <install_directory>/bin/nrnivmodl -coreneuron <modfile_directory>
.
Then this command will generate a x86_64
folder if you're using a system with an x86_64
architecture processor. Otherwise this folder will have the processor architecture name.
Inside this folder there will be a special
executable that is linked with the CoreNEURON libraries needed to run the simulation on GPU.
You may launch NetPyNE now using the following command:
cd <the_folder_where_your_init.py_file_for_netpyne_exists>
mpirun -n <num_procs> ./x86_64/special -mpi -python init.py
After the model building stage of your simulation you should see some extra logs coming from the CoreNEURON simulation that informs you about how many GPUs and threads/ranks you used for the simulation as well as the simulation runtime that contributes to the real-time ratio. Please let us know whether this was the issue and you manage to run your simulation using the above instructions. Thank you.
Hi Ioannis,
I apologise for the delayed response. My mon was hospitalised this weekend and I have been giving her some support. I will follow your instructions later next week. I appreciate your help.
Best regards, Jhielson Montino Pimentel
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Ioannis Magkanaris @.***> Sent: Monday, 6 December 2021, 07:38 To: Neurosim-lab/netpyne Cc: MONTINO PIMENTEL Jhielson; Mention Subject: Re: [Neurosim-lab/netpyne] [documentation] Activating the coreNeuron package in a NetPyNE example (#611)
This email was sent to you by someone outside the University. You should only click on links or attachments if you are certain that the email is genuine and the content is safe.
Hello @jhielsonhttps://github.com/jhielson ,
My guess about this is issue that you didn't use a NEURON installation with CoreNEURON enabled.
To be able to run CoreNEURON on GPU transparently with NEURON you have to install NEURON with CoreNEURON from source using these instructionshttps://github.com/BlueBrain/CoreNeuron#installation.
After installing NEURON using these instructions for a GPU enabled build you will be able to compile your mod files with
cd
After the model building stage of your simulation you should see some extra logs coming from the CoreNEURON simulation that informs you about how many GPUs and threads/ranks you used for the simulation as well as the simulation runtime that contributes to the real-time ratio. Please let us know whether this was the issue and you manage to run your simulation using the above instructions. Thank you.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Neurosim-lab/netpyne/issues/611#issuecomment-986650362, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAQ66KBS3WOTUOUQDCLXVDDUPSHB5ANCNFSM47OLO7RQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.
Hello Jhielson,
I'm sorry to hear that and I wish a speedy recovery. Take your time and let me know if you need any help whenever you work on this.
Kind regards, Ioannis
Dear @iomaganaris,
Thank you for your support. It seems that the coreneuron package is working fine now. I can compile the mod files in my project folder and it generates the /x86_64 folder with a special executable file on it. However, after running my simulation via mpirun command, I get the following error:
$mpirun -n 4 ./x86_64/special -mpi -python cerebellumCells.py
numprocs=4
NEURON -- VERSION 8.0a-590-ge40208d8+ master (e40208d8+) 2021-06-18
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2021
See http://neuron.yale.edu/neuron/credits
Additional mechanisms from files
"spikeout.mod" "stdp.mod" "SynExp2NMDA.mod"
Start time: 2022-01-24 12:53:01.201457
Creating network of 109 cell populations on 4 hosts...
Number of cells on node 1: 27
Number of cells on node 2: 27
Number of cells on node 3: 27
Number of cells on node 0: 28
Done; cell creation time = 0.03 s.
Making connections...
Number of connections on node 1: 176
Number of connections on node 0: 176
Number of connections on node 3: 176
Number of connections on node 2: 176
Done; cell connection time = 0.13 s.
Adding stims...
Number of stims on node 2: 23
Number of stims on node 1: 23
Number of stims on node 0: 24
Number of stims on node 3: 23
Done; cell stims creation time = 0.01 s.
Recording 27 traces of 1 types on node 1
Recording 27 traces of 1 types on node 2
Recording 27 traces of 1 types on node 3
Recording 28 traces of 1 types on node 0
0 ./x86_64/special: usable mindelay is 0 (or less than dt for fixed step method)
0 near line 0
0 tstop=1000.0
^
0 finitialize(-65)
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode -1.
NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
Have you seen this error message before?
usable mindelay is 0 (or less than dt for fixed step method)
Best regards, Jhielson M. Pimentel
Dear @iomaganaris,
After reducing the 'dt' to 0.025ms, the simulation was executed without errors. However, I am not sure if the performance of the simulation was optimized.
You can find the output of my simulation below:
numprocs=4
NEURON -- VERSION 8.0a-590-ge40208d8+ master (e40208d8+) 2021-06-18
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2021
See http://neuron.yale.edu/neuron/credits
Additional mechanisms from files
"spikeout.mod" "stdp.mod" "SynExp2NMDA.mod"
Start time: 2022-01-26 15:10:55.549057
Creating network of 109 cell populations on 4 hosts...
Number of cells on node 1: 27
Number of cells on node 2: 27
Number of cells on node 3: 27
Number of cells on node 0: 28
Done; cell creation time = 0.03 s.
Making connections...
Number of connections on node 0: 176
Number of connections on node 2: 176
Number of connections on node 1: 176
Number of connections on node 3: 176
Done; cell connection time = 0.14 s.
Adding stims...
Number of stims on node 3: 23
Number of stims on node 0: 24
Number of stims on node 2: 23
Number of stims on node 1: 23
Done; cell stims creation time = 0.01 s.
Recording 27 traces of 1 types on node 2
Recording 27 traces of 1 types on node 1
Recording 27 traces of 1 types on node 3
Recording 28 traces of 1 types on node 0
Running with interval func ...
Gathering data...
Done; gather time = 0.04 s.
Analyzing...
Cells: 109
Connections: 704 (6.46 per cell)
Spikes: 0 (0.00 Hz)
Simulated time: 10.0 s; 4 workers
Run time: 1643209855.76 s
... ...
Analyzing...
Cells: 109
Connections: 704 (6.46 per cell)
Spikes: 0 (0.00 Hz)
Simulated time: 1.0 s; 4 workers
Run time: 1643210117.02 s
Done; run time = 2.98 s; real-time ratio: 0.34.
The real-time ratio was not good. I can use up to 6 workers but the difference is not much. How can know that the GPU is being really being used?
Dear @jhielson,
I'm glad you fixed your first issue and I'm sorry for my late reply.
I think that the issue in your run is that CoreNEURON
was not enabled because it seems like you call https://github.com/suny-downstate-medical-center/netpyne/blob/88a565ceceffae75f86c839256e90adaa4584301/netpyne/sim/run.py#L175 from NetPyNE
which doesn't have CoreNEURON
support at the moment.
We'll have to take a look into that and come back to you.
Thanks, @iomaganaris. Indeed, I have been using the "runSimWithIntervalFunc" function in my code. Actually, that one is quite important since it allows me to interact with my model during simulation.
Dear @iomaganaris,
I hope you are doing well. I have decided to incorporate an Izhikevich model into my code but it seems this model (izhi2007b.mod) is incompatible with CoreNEURON. Do you know how to solve this issue?
This is the output of my compilation (issues with izhi2007b.mod and stdp.mod):
Mod files: "./izhi2007b.mod" "./spikeout.mod" "./stdp.mod" "./SynExp2NMDA.mod"
COBJS=''
[INFO] Running: make -j4 -f /usr/share/coreneuron/nrnivmodl_core_makefile ROOT=/usr MODS_PATH=x86_64/corenrn/mod2c BUILD_TYPE=STATIC
Default NMODL flags:
Translating x86_64/corenrn/mod2c/stdp.mod into x86_64/corenrn/mod2c//stdp.cpp
Translating x86_64/corenrn/mod2c/izhi2007b.mod into x86_64/corenrn/mod2c//izhi2007b.cpp
Notice: Use of POINTER is not thread safe.
Notice: VERBATIM blocks are not thread safe
cvode_emit=0 cvode_not_allowed=0
Error : x86_64/corenrn/mod2c/izhi2007b.mod is not thread safe and incompatible with CoreNEURON
See details at https://neuron.yale.edu/neuron/docs/multithread-parallelizationcvode_emit=0 cvode_not_allowed=0
Error : x86_64/corenrn/mod2c/stdp.mod is not thread safe and incompatible with CoreNEURON
See details at https://neuron.yale.edu/neuron/docs/multithread-parallelizationAborted (core dumped)
/usr/share/coreneuron/nrnivmodl_core_makefile:225: recipe for target 'x86_64/corenrn/mod2c/izhi2007b.cpp' failed
make: *** [x86_64/corenrn/mod2c/izhi2007b.cpp] Error 134
make: *** Deleting file 'x86_64/corenrn/mod2c/izhi2007b.cpp'
make: *** Waiting for unfinished jobs....
Aborted (core dumped)
/usr/share/coreneuron/nrnivmodl_core_makefile:225: recipe for target 'x86_64/corenrn/mod2c/stdp.cpp' failed
make: *** [x86_64/corenrn/mod2c/stdp.cpp] Error 134
make: *** Deleting file 'x86_64/corenrn/mod2c/stdp.cpp'
Hello @jhielson ,
Could you please share which mod
files exactly are you using? I guess you're referring to the izhi2007b.mod
from https://senselab.med.yale.edu/ModelDB/ShowModel?model=39948?
Thank you!
Hi @iomaganaris,
Exactly, that one. The other one is the 'STDP.mod' but I might not use it in my code.
stdp.mod
COMMENT
STDP + RL weight adjuster mechanism
Original STDP code adapted from:
http://senselab.med.yale.edu/modeldb/showmodel.asp?model=64261&file=\bfstdp\stdwa_songabbott.mod
Adapted to implement a "nearest-neighbor spike-interaction" model (see
Scholarpedia article on STDP) that just looks at the last-seen pre- and
post-synaptic spikes, and implementing a reinforcement learning algorithm based
on (Chadderdon et al., 2012):
http://www.plosone.org/article/info%3Adoi%2F10.1371%2Fjournal.pone.0047251
Example Python usage:
from neuron import h
## Create cells
dummy = h.Section() # Create a dummy section to put the point processes in
ncells = 2
cells = []
for c in range(ncells): cells.append(h.IntFire4(0,sec=dummy)) # Create the cells
## Create synapses
threshold = 10 # Set voltage threshold
delay = 1 # Set connection delay
singlesyn = h.NetCon(cells[0],cells[1], threshold, delay, 0.5) # Create a connection between the cells
stdpmech = h.STDP(0,sec=dummy) # Create the STDP mechanism
presyn = h.NetCon(cells[0],stdpmech, threshold, delay, 1) # Feed presynaptic spikes to the STDP mechanism -- must have weight >0
pstsyn = h.NetCon(cells[1],stdpmech, threshold, delay, -1) # Feed postsynaptic spikes to the STDP mechanism -- must have weight <0
h.setpointer(singlesyn._ref_weight[0],'synweight',stdpmech) # Point the STDP mechanism to the connection weight
Version: 2013oct24 by cliffk
ENDCOMMENT
NEURON {
POINT_PROCESS STDP : Definition of mechanism
POINTER synweight : Pointer to the weight (in a NetCon object) to be adjusted.
RANGE tauhebb, tauanti : LTP/LTD decay time constants (in ms) for the Hebbian (pre-before-post-synaptic spikes), and anti-Hebbian (post-before-pre-synaptic) cases.
RANGE hebbwt, antiwt : Maximal adjustment (can be positive or negative) for Hebbian and anti-Hebbian cases (i.e., as inter-spike interval approaches zero). This should be set positive for LTP and negative for LTD.
RANGE RLwindhebb, RLwindanti : Maximum interval between pre- and post-synaptic events for an starting an eligibility trace. There are separate ones for the Hebbian and anti-Hebbian events.
RANGE useRLexp : Use exponentially decaying eligibility traces? If 0, then the eligibility traces are binary, turning on at the beginning and completely off after time has passed corresponding to RLlen.
RANGE RLlenhebb, RLlenanti : Length of the eligibility Hebbian and anti-Hebbian eligibility traces, or the decay time constants if the traces are decaying exponentials.
RANGE RLhebbwt, RLantiwt : Maximum gains to be applied to the reward or punishing signal by Hebbian and anti-Hebbian eligibility traces.
RANGE wmax : The maximum weight for the synapse.
RANGE softthresh : Flag turning on "soft thresholding" for the maximal adjustment parameters.
RANGE STDPon : Flag for turning STDP adjustment on / off.
RANGE RLon : Flag for turning RL adjustment on / off.
RANGE verbose : Flag for turning off prints of weight update events for debugging.
RANGE tlastpre, tlastpost : Remembered times for last pre- and post-synaptic spikes.
RANGE tlasthebbelig, tlastantielig : Remembered times for Hebbian anti-Hebbian eligibility traces.
RANGE interval : Interval between current time t and previous spike.
RANGE deltaw : The calculated weight change.
RANGE newweight : New calculated weight.
RANGE skip : Flag to skip 2nd set of conditions
}
ASSIGNED {
synweight
tlastpre (ms)
tlastpost (ms)
tlasthebbelig (ms)
tlastantielig (ms)
interval (ms)
deltaw
newweight
}
INITIAL {
tlastpre = -1 : no spike yet
tlastpost = -1 : no spike yet
tlasthebbelig = -1 : no eligibility yet
tlastantielig = -1 : no eligibility yet
interval = 0
deltaw = 0
newweight = 0
}
PARAMETER {
tauhebb = 10 (ms)
tauanti = 10 (ms)
hebbwt = 1.0
antiwt = -1.0
RLwindhebb = 10 (ms)
RLwindanti = 10 (ms)
useRLexp = 0 : default to using binary eligibility traces
RLlenhebb = 100 (ms)
RLlenanti = 100 (ms)
RLhebbwt = 1.0
RLantiwt = -1.0
wmax = 15.0
softthresh = 0
STDPon = 1
RLon = 1
verbose = 0
skip = 0
}
NET_RECEIVE (w) {
deltaw = 0.0 : Default the weight change to 0.
skip = 0
if (verbose > 0) { printf("t=%f (BEFORE) tlaspre=%f, tlastpost=%f, flag=%f, w=%f, deltaw=%f \n",t,tlastpre, tlastpost,flag,w,deltaw) }
: Hebbian weight update happens 1ms later to check for simultaneous spikes (otherwise bug when using mpi)
if ((flag == -1) && (tlastpre != t-1)) {
skip = 1 : skip the 2nd set of conditions since this was artificial net event to update weights
deltaw = hebbwt * exp(-interval / tauhebb) : Use the Hebbian decay to set the Hebbian weight adjustment.
if (softthresh == 1) { deltaw = softthreshold(deltaw) } : If we have soft-thresholding on, apply it.
adjustweight(deltaw) : Adjust the weight.
if (verbose > 0) { printf("Hebbian STDP event: t = %f ms; tlastpre = %f; w = %f; deltaw = %f\n",t,tlastpre,w,deltaw) } : Show weight update information if debugging on.
}
: Ant-hebbian weight update happens 1ms later to check for simultaneous spikes (otherwise bug when using mpi)
else if ((flag == 1) && (tlastpost != t-1)) { :update weight 1ms later to check for simultaneous spikes (otherwise bug when using mpi)
skip = 1 : skip the 2nd set of conditions since this was artificial net event to update weights
deltaw = antiwt * exp(interval / tauanti) : Use the anti-Hebbian decay to set the anti-Hebbian weight adjustment.
if (softthresh == 1) { deltaw = softthreshold(deltaw) } : If we have soft-thresholding on, apply it.
adjustweight(deltaw) : Adjust the weight.
if (verbose > 0) { printf("anti-Hebbian STDP event: t = %f ms; deltaw = %f\n",t,deltaw) } : Show weight update information if debugging on.
}
: If we receive a non-negative weight value, we are receiving a pre-synaptic spike (and thus need to check for an anti-Hebbian event, since the post-synaptic weight must be earlier).
if (skip == 0) {
if (w >= 0) {
interval = tlastpost - t : Get the interval; interval is negative
if ((tlastpost > -1) && (-interval > 1.0)) { : If we had a post-synaptic spike and a non-zero interval...
if (STDPon == 1) { : If STDP learning is turned on...
if (verbose > 0) {printf("net_send(1,1)\n")}
net_send(1,1) : instead of updating weight directly, use net_send to check if simultaneous spike occurred (otherwise bug when using mpi)
}
if ((RLon == 1) && (-interval <= RLwindanti)) { tlastantielig = t } : If RL and anti-Hebbian eligibility traces are turned on, and the interval falls within the maximum window for eligibility, remember the eligibilty trace start at the current time.
}
tlastpre = t : Remember the current spike time for next NET_RECEIVE.
: Else, if we receive a negative weight value, we are receiving a post-synaptic spike (and thus need to check for a Hebbian event, since the pre-synaptic weight must be earlier).
} else {
interval = t - tlastpre : Get the interval; interval is positive
if ((tlastpre > -1) && (interval > 1.0)) { : If we had a pre-synaptic spike and a non-zero interval...
if (STDPon == 1) { : If STDP learning is turned on...
if (verbose > 0) {printf("net_send(1,-1)\n")}
net_send(1,-1) : instead of updating weight directly, use net_send to check if simultaneous spike occurred (otherwise bug when using mpi)
}
if ((RLon == 1) && (interval <= RLwindhebb)) {
tlasthebbelig = t} : If RL and Hebbian eligibility traces are turned on, and the interval falls within the maximum window for eligibility, remember the eligibilty trace start at the current time.
}
tlastpost = t : Remember the current spike time for next NET_RECEIVE.
}
}
if (verbose > 0) { printf("t=%f (AFTER) tlaspre=%f, tlastpost=%f, flag=%f, w=%f, deltaw=%f \n",t,tlastpre, tlastpost,flag,w,deltaw) }
}
PROCEDURE reward_punish(reinf) {
if (RLon == 1) { : If RL is turned on...
deltaw = 0.0 : Start the weight change as being 0.
deltaw = deltaw + reinf * hebbRL() : If we have the Hebbian eligibility traces on, add their effect in.
deltaw = deltaw + reinf * antiRL() : If we have the anti-Hebbian eligibility traces on, add their effect in.
if (softthresh == 1) { deltaw = softthreshold(deltaw) } : If we have soft-thresholding on, apply it.
adjustweight(deltaw) : Adjust the weight.
if (verbose > 0) { printf("RL event: t = %f ms; reinf = %f; RLhebbwt = %f; RLlenhebb = %f; tlasthebbelig = %f; deltaw = %f\n",t,reinf,RLhebbwt,RLlenhebb,tlasthebbelig, deltaw) } : Show weight update information if debugging on.
}
}
FUNCTION hebbRL() {
if ((RLon == 0) || (tlasthebbelig < 0.0)) { hebbRL = 0.0 } : If RL is turned off or eligibility has not occurred yet, return 0.0.
else if (useRLexp == 0) { : If we are using a binary (i.e. square-wave) eligibility traces...
if (t - tlasthebbelig <= RLlenhebb) { hebbRL = RLhebbwt } : If we are within the length of the eligibility trace...
else { hebbRL = 0.0 } : Otherwise (outside the length), return 0.0.
}
else { hebbRL = RLhebbwt * exp((tlasthebbelig - t) / RLlenhebb) } : Otherwise (if we're using an exponential decay traces)...use the Hebbian decay to calculate the gain.
}
FUNCTION antiRL() {
if ((RLon == 0) || (tlastantielig < 0.0)) { antiRL = 0.0 } : If RL is turned off or eligibility has not occurred yet, return 0.0.
else if (useRLexp == 0) { : If we are using a binary (i.e. square-wave) eligibility traces...
if (t - tlastantielig <= RLlenanti) { antiRL = RLantiwt } : If we are within the length of the eligibility trace...
else {antiRL = 0.0 } : Otherwise (outside the length), return 0.0.
}
else { antiRL = RLantiwt * exp((tlastantielig - t) / RLlenanti) } : Otherwise (if we're using an exponential decay traces), use the anti-Hebbian decay to calculate the gain.
}
FUNCTION softthreshold(rawwc) {
if (rawwc >= 0) { softthreshold = rawwc * (1.0 - synweight / wmax) } : If the weight change is non-negative, scale by 1 - weight / wmax.
else { softthreshold = rawwc * synweight / wmax } : Otherwise (the weight change is negative), scale by weight / wmax.
}
PROCEDURE adjustweight(wc) {
synweight = synweight + wc : apply the synaptic modification, and then clip the weight if necessary to make sure it's between 0 and wmax.
if (synweight > wmax) { synweight = wmax }
if (synweight < 0) { synweight = 0 }
}
Hello @jhielson ,
I have edited the mod
files of the Izhikevich
model to be compatible with CoreNEURON
here: https://github.com/iomaganaris/39948/commit/aba2e4a5a5eaf5f7f8ef2ee9e5642df7b6feb578
For stdp.mod
the situation is a bit more complex since you need to follow the guide in https://github.com/BlueBrain/CoreNeuron/blob/master/docs/userdoc/MemoryManagement/bbcorepointer.md to transform the POINTER
variable to BBCOREPOINTER
so that it can be transferred from NEURON
to CoreNEURON
.
Dear @iomaganaris ,
I was using 'sudo' before. With my own user I get the following error:
VERBOSE=1 nrnivmodl -coreneuron .
/home/jhielson/catkin_ws/src/cerebellum/src
Mod files: "./izhi2007a.mod" "./izhi2007bS.mod" "./spikeout.mod" "./SynExp2NMDA.mod"
COBJS=''
[INFO] Running: make -j4 -f /home/jhielson/nrn-install/share/coreneuron/nrnivmodl_core_makefile ROOT=/home/jhielson/nrn-install MODS_PATH=x86_64/corenrn/mod2c BUILD_TYPE=STATIC
Default NMODL flags:
/usr/bin/perl /home/jhielson/nrn-install/share/coreneuron/mod_func.c.pl SynExp2NMDA.mod exp2syn.mod expsyn.mod hh.mod izhi2007a.mod izhi2007bS.mod netstim.mod passive.mod pattern.mod spikeout.mod stim.mod svclmp.mod > x86_64/corenrn/mod2c/_mod_func.cpp.tmp
cd x86_64/corenrn/mod2c; \
/usr/bin/python3.6 /home/jhielson/nrn-install/share/coreneuron/kinderiv.py;
diff -q x86_64/corenrn/mod2c/_mod_func.cpp.tmp x86_64/corenrn/mod2c/_mod_func.cpp || \
mv x86_64/corenrn/mod2c/_mod_func.cpp.tmp x86_64/corenrn/mod2c/_mod_func.cpp
/opt/nvidia/hpc_sdk/Linux_x86_64/21.5/compilers/bin/nvc++ -O3 -g -acc -gpu=cuda11.3,cc60,cc70 --diag_suppress 161,177,550 -mp -g -O2 --c++14 -fPIC -DMPI_NO_CPPBIND=1 -DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX=1 -DCORENEURON_BUILD -DHAVE_MALLOC_H -DEIGEN_DONT_VECTORIZE=1 -DNRNMPI=1 -DMPI_NO_CPPBIND=1 -DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX=1 -DLAYOUT=0 -DDISABLE_HOC_EXP -DENABLE_SPLAYTREE_QUEUING -I/home/jhielson/nrn-install/include -I/home/jhielson/nrn-install/include/coreneuron/utils/randoms -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.5/comm_libs/openmpi/openmpi-3.1.5/include -c x86_64/corenrn/mod2c/izhi2007a.cpp -o x86_64/corenrn/build/izhi2007a.o
/opt/nvidia/hpc_sdk/Linux_x86_64/21.5/compilers/bin/nvc++ -O3 -g -acc -gpu=cuda11.3,cc60,cc70 --diag_suppress 161,177,550 -mp -g -O2 --c++14 -fPIC -DMPI_NO_CPPBIND=1 -DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX=1 -DCORENEURON_BUILD -DHAVE_MALLOC_H -DEIGEN_DONT_VECTORIZE=1 -DNRNMPI=1 -DMPI_NO_CPPBIND=1 -DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX=1 -DLAYOUT=0 -DDISABLE_HOC_EXP -DENABLE_SPLAYTREE_QUEUING -I/home/jhielson/nrn-install/include -I/home/jhielson/nrn-install/include/coreneuron/utils/randoms -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.5/comm_libs/openmpi/openmpi-3.1.5/include -c x86_64/corenrn/mod2c/izhi2007bS.cpp -o x86_64/corenrn/build/izhi2007bS.o
/opt/nvidia/hpc_sdk/Linux_x86_64/21.5/compilers/bin/nvc++ -O3 -g -acc -gpu=cuda11.3,cc60,cc70 --diag_suppress 161,177,550 -mp -g -O2 --c++14 -fPIC -DMPI_NO_CPPBIND=1 -DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX=1 -DCORENEURON_BUILD -DHAVE_MALLOC_H -DEIGEN_DONT_VECTORIZE=1 -DNRNMPI=1 -DMPI_NO_CPPBIND=1 -DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX=1 -DLAYOUT=0 -DDISABLE_HOC_EXP -DENABLE_SPLAYTREE_QUEUING -I/home/jhielson/nrn-install/include -I/home/jhielson/nrn-install/include/coreneuron/utils/randoms -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.5/comm_libs/openmpi/openmpi-3.1.5/include -c x86_64/corenrn/mod2c/spikeout.cpp -o x86_64/corenrn/build/spikeout.o
/opt/nvidia/hpc_sdk/Linux_x86_64/21.5/compilers/bin/nvc++ -O3 -g -acc -gpu=cuda11.3,cc60,cc70 --diag_suppress 161,177,550 -mp -g -O2 --c++14 -fPIC -DMPI_NO_CPPBIND=1 -DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX=1 -DCORENEURON_BUILD -DHAVE_MALLOC_H -DEIGEN_DONT_VECTORIZE=1 -DNRNMPI=1 -DMPI_NO_CPPBIND=1 -DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX=1 -DLAYOUT=0 -DDISABLE_HOC_EXP -DENABLE_SPLAYTREE_QUEUING -I/home/jhielson/nrn-install/include -I/home/jhielson/nrn-install/include/coreneuron/utils/randoms -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.5/comm_libs/openmpi/openmpi-3.1.5/include -c x86_64/corenrn/mod2c/stim.cpp -o x86_64/corenrn/build/stim.o
NVC++-S-1061-Procedures called in a compute region must have acc routine information - fopen (x86_64/corenrn/mod2c/izhi2007a.cpp: 627)
NVC++-S-1000-Call in OpenACC region to procedure '_ZN10coreneuron13hoc_execerrorEPKcS1_' which has no acc routine information (x86_64/corenrn/mod2c/izhi2007bS.cpp: 406)
NVC++/x86-64 Linux 21.5-0: compilation completed with severe errors
/home/jhielson/nrn-install/share/coreneuron/nrnivmodl_core_makefile:213: recipe for target 'x86_64/corenrn/build/izhi2007bS.o' failed
make: *** [x86_64/corenrn/build/izhi2007bS.o] Error 2
make: *** Waiting for unfinished jobs....
NVC++/x86-64 Linux 21.5-0: compilation completed with severe errors
/home/jhielson/nrn-install/share/coreneuron/nrnivmodl_core_makefile:213: recipe for target 'x86_64/corenrn/build/izhi2007a.o' failed
make: *** [x86_64/corenrn/build/izhi2007a.o] Error 2
NVC++-W-1053-External and Static variables are not supported in acc routine - _ZN10coreneuron11nrn_threadsE (x86_64/corenrn/mod2c/spikeout.cpp: 422)
NVC++/x86-64 Linux 21.5-0: compilation completed with warnings
Hi @iomaganaris ,
It seems to be a bit similar to the following issue: https://github.com/BlueBrain/CoreNeuron/issues/580#issuecomment-869745985
But now with acc routines:
NVC++-S-1061-Procedures called in a compute region must have acc routine information - fopen (x86_64/corenrn/mod2c/izhi2007a.cpp: 627)
NVC++-S-1000-Call in OpenACC region to procedure '_ZN10coreneuron13hoc_execerrorEPKcS1_' which has no acc routine information (x86_64/corenrn/mod2c/izhi2007bS.cpp: 406)
Hello @jhielson ,
I have updated the mod files to make them compatible with GPU compilation in https://github.com/iomaganaris/39948/commit/e5187a9c13f3587b44e1ffdff8cd64a37e99173e. Please try with these changes and let me know if it works.
Hi @iomaganaris ,
Thanks! It now compiles properly but when I use one of them in my code it generates an error.
Compilation of the mod file:
VERBOSE=0 nrnivmodl -coreneuron .
/home/jhielson/catkin_ws/src/cerebellum/src
Mod files: "./izhi2007a.mod" "./izhi2007bS.mod" "./spikeout.mod" "./SynExp2NMDA.mod"
COBJS=''
[INFO] Running: make -j4 -f /home/jhielson/nrn-install/share/coreneuron/nrnivmodl_core_makefile ROOT=/home/jhielson/nrn-install MODS_PATH=x86_64/corenrn/mod2c BUILD_TYPE=STATIC
Default NMODL flags:
/usr/bin/perl /home/jhielson/nrn-install/share/coreneuron/mod_func.c.pl SynExp2NMDA.mod exp2syn.mod expsyn.mod hh.mod izhi2007a.mod izhi2007bS.mod netstim.mod passive.mod pattern.mod spikeout.mod stim.mod svclmp.mod > x86_64/corenrn/mod2c/_mod_func.cpp.tmp
cd x86_64/corenrn/mod2c; \
/usr/bin/python3.6 /home/jhielson/nrn-install/share/coreneuron/kinderiv.py;
diff -q x86_64/corenrn/mod2c/_mod_func.cpp.tmp x86_64/corenrn/mod2c/_mod_func.cpp || \
mv x86_64/corenrn/mod2c/_mod_func.cpp.tmp x86_64/corenrn/mod2c/_mod_func.cpp
mkdir -p x86_64/corenrn/build/scopmath; \
cd x86_64/corenrn/build/scopmath && ar -x /home/jhielson/nrn-install/lib/libscopmath.a && cd -;\
rm -f x86_64/libcorenrnmech.a; \
ar cq x86_64/libcorenrnmech.a x86_64/corenrn/build/enginemech.o x86_64/corenrn/build/_mod_func.o x86_64/corenrn/build/_dimplic.o x86_64/corenrn/build/SynExp2NMDA.o x86_64/corenrn/build/exp2syn.o x86_64/corenrn/build/expsyn.o x86_64/corenrn/build/hh.o x86_64/corenrn/build/izhi2007a.o x86_64/corenrn/build/izhi2007bS.o x86_64/corenrn/build/netstim.o x86_64/corenrn/build/passive.o x86_64/corenrn/build/pattern.o x86_64/corenrn/build/spikeout.o x86_64/corenrn/build/stim.o x86_64/corenrn/build/svclmp.o x86_64/corenrn/build/scopmath/*.o;
/home/jhielson/catkin_ws/src/cerebellum/src
rm -rf x86_64/.libs/libcorenrnmech.a; \
mkdir -p x86_64/.libs; \
ln -s ../libcorenrnmech.a x86_64/.libs/libcorenrnmech.a
=> Binary creating x86_64/special-core
/opt/nvidia/hpc_sdk/Linux_x86_64/21.5/compilers/bin/nvc++ -O3 -g -acc -gpu=cuda11.3,cc60,cc70 --diag_suppress 161,177,550 -mp -g -O2 --c++14 -o x86_64/special-core /home/jhielson/nrn-install/share/coreneuron/coreneuron.cpp \
-I/home/jhielson/nrn-install/include \
-Lx86_64 -lcorenrnmech -L/home/jhielson/nrn-install/lib -lcoreneuron -lcudacoreneuron /usr/local/cuda-11.3/lib64/libcudart_static.a -ldl /usr/lib/x86_64-linux-gnu/librt.so /opt/nvidia/hpc_sdk/Linux_x86_64/21.5/comm_libs/openmpi/openmpi-3.1.5/lib/libmpi.so \
-Wl,-rpath,'$ORIGIN' -Wl,-rpath,/home/jhielson/nrn-install/lib
/home/jhielson/nrn-install/share/coreneuron/coreneuron.cpp:
[INFO] MOD files built successfully for CoreNEURON
-> Compiling mod_func.cpp
/opt/nvidia/hpc_sdk/Linux_x86_64/21.5/compilers/bin/nvc -g -O2 -O3 -g -I. -I/home/jhielson/nrn-install/include -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.5/comm_libs/openmpi/openmpi-3.1.5/include -fPIC -c mod_func.cpp -o mod_func.o
=> LINKING shared library ./libnrnmech.so
/opt/nvidia/hpc_sdk/Linux_x86_64/21.5/compilers/bin/nvc++ -g -O2 -O3 -g --c++11 -shared -fPIC -I /home/jhielson/nrn-install/include -o ./libnrnmech.so -Wl,-soname,libnrnmech.so \
./mod_func.o ./izhi2007a.o ./izhi2007bS.o ./spikeout.o ./SynExp2NMDA.o -L/home/jhielson/nrn-install/lib -lnrniv -Wl,-rpath,/home/jhielson/nrn-install/lib /usr/lib/x86_64-linux-gnu/libreadline.so -Wl,-rpath,/usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/libcurses.so -Wl,-rpath,/usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/libform.so -Wl,-rpath,/usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/libpython3.6m.so -Wl,-rpath,/usr/lib/x86_64-linux-gnu /opt/nvidia/hpc_sdk/Linux_x86_64/21.5/comm_libs/openmpi/openmpi-3.1.5/lib/libmpi.so -Wl,-rpath,/opt/nvidia/hpc_sdk/Linux_x86_64/21.5/comm_libs/openmpi/openmpi-3.1.5/lib
rm -f ./.libs/libnrnmech.so ; mkdir -p ./.libs ; cp ./libnrnmech.so ./.libs/libnrnmech.so
Successfully created x86_64/special
My simulation output:
mpirun -n 6 ./x86_64/special -mpi -python completeModel.py
numprocs=6
NEURON -- VERSION 8.0a-590-ge40208d8+ master (e40208d8+) 2021-06-18
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2021
See http://neuron.yale.edu/neuron/credits
Additional mechanisms from files
"./izhi2007a.mod" "./izhi2007bS.mod" "./spikeout.mod" "./SynExp2NMDA.mod"
Start time: 2022-02-03 12:39:09.130380
Creating network of 117 cell populations on 6 hosts...
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
ERROR: Some mechanisms and/or ions were not inserted (for details run with cfg.verbose=True). Make sure the required mod files are compiled.
>>> >>> >>> >>> >>> >>> Traceback (most recent call last):
File "completeModel.py", line 1943, in <module>
output = network.simulate()
File "completeModel.py", line 1569, in simulate
sim.net.createCells()
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/network.py", line 86, in createCells
newCells = ipop.createCells() # create cells for this pop using Pop method
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/pop.py", line 79, in createCells
cells = self.createCellsFixedNum()
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/pop.py", line 175, in createCellsFixedNum
cells.append(self.cellModelClass(gid, cellTags)) # instantiate Cell object
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 52, in __init__
if create: self.create() # create cell
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 107, in create
self.createNEURONObj(prop) # add sections, mechanisms, synaptic mechanisms, geometry and topolgy specified by this property set
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 432, in createNEURONObj
setattr(sec['pointps'][pointpName]['hObj'], pointpParamName, pointpParamValue)
LookupError: 'f' is not a defined hoc variable name.
Traceback (most recent call last):
File "completeModel.py", line 1943, in <module>
output = network.simulate()
File "completeModel.py", line 1569, in simulate
sim.net.createCells()
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/network.py", line 86, in createCells
newCells = ipop.createCells() # create cells for this pop using Pop method
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/pop.py", line 79, in createCells
cells = self.createCellsFixedNum()
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/pop.py", line 175, in createCellsFixedNum
cells.append(self.cellModelClass(gid, cellTags)) # instantiate Cell object
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 52, in __init__
if create: self.create() # create cell
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 107, in create
self.createNEURONObj(prop) # add sections, mechanisms, synaptic mechanisms, geometry and topolgy specified by this property set
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 432, in createNEURONObj
setattr(sec['pointps'][pointpName]['hObj'], pointpParamName, pointpParamValue)
LookupError: 'f' is not a defined hoc variable name.
Traceback (most recent call last):
File "completeModel.py", line 1943, in <module>
output = network.simulate()
File "completeModel.py", line 1569, in simulate
sim.net.createCells()
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/network.py", line 86, in createCells
newCells = ipop.createCells() # create cells for this pop using Pop method
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/pop.py", line 79, in createCells
cells = self.createCellsFixedNum()
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/pop.py", line 175, in createCellsFixedNum
cells.append(self.cellModelClass(gid, cellTags)) # instantiate Cell object
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 52, in __init__
if create: self.create() # create cell
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 107, in create
self.createNEURONObj(prop) # add sections, mechanisms, synaptic mechanisms, geometry and topolgy specified by this property set
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 432, in createNEURONObj
setattr(sec['pointps'][pointpName]['hObj'], pointpParamName, pointpParamValue)
LookupError: 'f' is not a defined hoc variable name.
Traceback (most recent call last):
File "completeModel.py", line 1943, in <module>
output = network.simulate()
File "completeModel.py", line 1569, in simulate
sim.net.createCells()
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/network.py", line 86, in createCells
newCells = ipop.createCells() # create cells for this pop using Pop method
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/pop.py", line 79, in createCells
cells = self.createCellsFixedNum()
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/pop.py", line 175, in createCellsFixedNum
cells.append(self.cellModelClass(gid, cellTags)) # instantiate Cell object
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 52, in __init__
if create: self.create() # create cell
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 107, in create
self.createNEURONObj(prop) # add sections, mechanisms, synaptic mechanisms, geometry and topolgy specified by this property set
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 432, in createNEURONObj
setattr(sec['pointps'][pointpName]['hObj'], pointpParamName, pointpParamValue)
LookupError: 'f' is not a defined hoc variable name.
Traceback (most recent call last):
File "completeModel.py", line 1943, in <module>
output = network.simulate()
File "completeModel.py", line 1569, in simulate
sim.net.createCells()
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/network.py", line 86, in createCells
newCells = ipop.createCells() # create cells for this pop using Pop method
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/pop.py", line 79, in createCells
cells = self.createCellsFixedNum()
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/network/pop.py", line 175, in createCellsFixedNum
cells.append(self.cellModelClass(gid, cellTags)) # instantiate Cell object
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 52, in __init__
if create: self.create() # create cell
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 107, in create
self.createNEURONObj(prop) # add sections, mechanisms, synaptic mechanisms, geometry and topolgy specified by this property set
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 432, in createNEURONObj
setattr(sec['pointps'][pointpName]['hObj'], pointpParamName, pointpParamValue)
LookupError: 'f' is not a defined hoc variable name.
Hello @jhielson ,
It seems to me like something is not properly set in the simulation you're trying to run since I see that the mechanisms from the mod files are loaded in NEURON:
Additional mechanisms from files
"./izhi2007a.mod" "./izhi2007bS.mod" "./spikeout.mod" "./SynExp2NMDA.mod"
The problem seems to be coming from:
File "/home/jhielson/.local/lib/python3.6/site-packages/netpyne/cell/compartCell.py", line 432, in createNEURONObj
setattr(sec['pointps'][pointpName]['hObj'], pointpParamName, pointpParamValue)
LookupError: 'f' is not a defined hoc variable name.
https://github.com/suny-downstate-medical-center/netpyne/blob/eedb155a7467c4a1deeed1e50eb5db4ea46db783/netpyne/cell/compartCell.py#L432 Maybe something is not set properly in the circuit configuration?
Hi @iomaganaris ,
You are right. I was using an old setup in my code. Thank you!
cellRule['secs']['soma']['pointps']['Izhi'] = {'mod': 'Izhi2007bS',
'a': 0.1,
'b': 0.2,
'c': -65,
'd': 2,
'f': 5,
'g': 140,
'thresh': 30}
Hi @iomaganaris,
Can you help me with this new issue? I am getting the following error after running my code:
Error creating point process mechanism STN in cell with gid 815
5 ./x86_64/special: NetCon[0] source is missing
5 near line 0
5 objref hoc_obj_[2]
Output:
$ mpirun -n 6 ./x86_64/special -mpi -python completeModel.py
numprocs=6
NEURON -- VERSION 8.0a-590-ge40208d8+ master (e40208d8+) 2021-06-18
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2021
See http://neuron.yale.edu/neuron/credits
Additional mechanisms from files
"./GP.mod" "./izhi2007a.mod" "./izhi2007bS.mod" "./spikeout.mod" "./STN.mod" "./Str.mod" "./SynExp2NMDA.mod" "./thalamus.mod"
Start time: 2022-02-10 13:51:53.086230
Creating network of 668 cell populations on 6 hosts...
Error creating point process mechanism STN in cell with gid 815
5 ./x86_64/special: NetCon[0] source is missing
5 near line 0
5 objref hoc_obj_[2]
^
Error creating point process mechanism STN in cell with gid 812
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 5 in communicator MPI_COMM_WORLD
with errorcode -1.
NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
That's how I designed a STN neuron:
def stnCellRules(self, gkcabar=3.8e-3):
cellRule = {'conds': {'cellModel': 'STN', 'cellType': 'STN'}, 'secs': {}}
cellRule['secs']['soma'] = {'geom': {}, 'mechs': {}}
cellRule['secs']['soma']['geom'] = {'diam': 5.642,
'L': 5.642,
'Ra': 1,
'nseg': 1}
cellRule['secs']['soma']['mechs']['STN'] = {'dbs': self.dbs,'gkcabar': gkcabar}
cellRule['secs']['soma']['vinit'] = random.gauss(-62, 5)
cellRule['secs']['soma']['threshold'] = -10
self.netParams.cellParams['STN'] = cellRule
That's the STN.mod file:
TITLE STN ion channels for single compartment model
COMMENT
//program from Basal ganglia network model of subthalamic deep brain stimulation (Hahn and McIntyre 2010)
//derived from: Otsuka model
//available on :
//https://senselab.med.yale.edu/modeldb/ShowModel.cshtml?model=127388
//Author: Daniel Tamashiro, Unicamp
//Updated 08/16/2016
ENDCOMMENT
UNITSON
NEURON {
SUFFIX STN
NONSPECIFIC_CURRENT ilk
NONSPECIFIC_CURRENT icaT,icaL,ikD,ikA,ikAHP,ina, idbs
RANGE gnabar, ena, m_inf, h_inf, tau_h, tau_m : fast sodium
RANGE gkdrbar, ek, n_inf, tau_n : delayed K rectifier
RANGE gl, el : leak
RANGE gcatbar, p_inf, tau_p, q_inf, tau_q : T-type ca current
RANGE gcalbar, eca, c_inf, d1_inf, d2_inf, tau_c, tau_d1, tau_d2 : L-type ca current
RANGE gkabar, ek, a_inf, tau_a, b_inf, tau_b : A-type K current
RANGE gkcabar, ek, r_inf : ca dependent AHP K current
RANGE periodo, tezao, cai, dbs
}
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(S) = (siemens)
(molar) = (1/liter)
(mM) = (millimolar)
}
PARAMETER {
ena = 60 (mV)
ek = -90 (mV)
cao = 2000
con =12.8392 (mV)
tezao = 7.6923 (ms)
dbs
:Fast Na channel
gnabar = 49e-3 (S/cm2)
theta_m = -40 (mV)
theta_h = -45.5 (mV)
k_m = -8 (mV)
k_h = 6.4 (mV)
tau_m0 = 0.2 (ms)
tau_m1 = 3 (ms)
tau_h0 = 0 (ms)
tau_h1 = 24.5 (ms)
tht_m = -53 (mV)
tht_h1 = -50 (mV)
tht_h2 = -50 (mV)
sig_m = -0.7 (mV)
sig_h1 = -15 (mV)
sig_h2 = 16 (mV)
: Delayed rectifier K
gkdrbar = 57e-3 (S/cm2)
theta_n = -41 (mV)
k_n = -14 (mV)
tau_n0 = 0 (ms)
tau_n1 = 11 (ms)
tht_n1 = -40 (mV)
tht_n2 = -40 (mV)
sig_n1 = -40 (mV)
sig_n2 = 50 (mV)
:Leakage current
gl = 0.35e-3 (S/cm2)
el = -60 (mV)
:T-type ca current
gcatbar = 5e-3 (S/cm2)
theta_p = -56 (mV)
theta_q = -85 (mV)
k_p = -6.7 (mV)
k_q = 5.8 (mV)
tau_p0 = 5 (ms)
tau_p1 = 0.33 (ms)
tau_q0 = 0 (ms)
tau_q1 = 400 (ms)
tht_p1 = -27 (mV)
tht_p2 = -102 (mV)
tht_q1 = -50 (mV)
tht_q2 = -50 (mV)
sig_p1 = -10 (mV)
sig_p2 = 15 (mV)
sig_q1 = -15 (mV)
sig_q2 = 16 (mV)
:Ca L current
gcalbar = 15e-3 (S/cm2)
theta_c = -30.6 (mV)
theta_d1 = -60 (mV)
theta_d2 = 0.1 (mV)
k_c = -5 (mV)
k_d1 = 7.5 (mV)
k_d2 = 0.02 (mV)
tau_c0 = 45 (ms)
tau_c1 = 10 (ms)
tau_d10 = 400 (ms)
tau_d11 = 500 (ms)
tht_c1 = -27 (mV)
tht_c2 = -50 (mV)
tht_d11 = -40 (mV)
tht_d12 = -20 (mV)
sig_c1 = -20 (mV)
sig_c2 = 15 (mV)
sig_d11 = -15 (mV)
sig_d12 = 20 (mV)
tau_d2 = 130 (ms)
:A current
gkabar = 5e-3 (S/cm2)
theta_a = -45 (mV)
theta_b = -90 (mV)
k_a = -14.7 (mV)
k_b = 7.5 (mV)
tau_a0 = 1 (ms)
tau_a1 = 1 (ms)
tau_b0 = 0 (ms)
tau_b1 = 200 (ms)
tht_a = -40 (mV)
tht_b1 = -60 (mV)
tht_b2 = -40 (mV)
sig_a = -0.5 (mV)
sig_b1 = -30 (mV)
sig_b2 = 10 (mV)
:AHP current (Ca dependent K current)
gkcabar = 1e-3 (S/cm2)
theta_r = 0.17 (mV)
k_r = -0.08 (mV)
tau_r = 2 (ms)
:cai
acai=5.18e-3 (cm2/mA/ms)
bcai=2e-3 (1/ms)
}
ASSIGNED {
v (mV)
ina (mA/cm2)
ikD (mA/cm2)
ikA (mA/cm2)
ikAHP(mA/cm2)
icaT(mA/cm2)
icaL (mA/cm2)
ilk (mA/cm2)
idbs (mA/cm2)
periodo (ms)
:Fast Na
h_inf
tau_h (ms)
m_inf
tau_m (ms)
:Delayed rectifier
n_inf
tau_n (ms)
:ca T current
p_inf
q_inf
tau_p (ms)
tau_q (ms)
eca (mV) :calc from Nernst
:ca L current
c_inf
tau_c (ms)
d1_inf
tau_d1 (ms)
d2_inf
:A current
a_inf
tau_a (ms)
b_inf
tau_b (ms)
:AHP (Ca dependent K current)
r_inf
}
STATE {
m h n
p q
c d1 d2
cai
a b r
}
BREAKPOINT {
SOLVE states METHOD cnexp
eca = con*log(cao/cai)
ina = gnabar * m*m*m*h * (v - ena)
ikD = gkdrbar * n^4 * (v - ek)
ikA = gkabar * a*a*b * (v - ek)
ikAHP = gkcabar *r*r* (v - ek)
icaT = gcatbar * p*p*q * (v - eca)
icaL = gcalbar * c*c*d1*d2 * (v - eca)
ilk = gl * (v - el)
if (t >= periodo + tezao){
periodo = periodo + tezao
}
if (t >= periodo && t <= periodo + 0.3) {
idbs = -0.3*dbs
} else{
idbs = 0
}
}
DERIVATIVE states {
evaluate_fct(v)
h' = (h_inf - h)/tau_h
m' = (m_inf - m)/tau_m
n' = (n_inf - n)/tau_n
p' = (p_inf - p)/tau_p
q' = (q_inf - q)/tau_q
c' = (c_inf - c)/tau_c
d1' = (d1_inf - d1)/tau_d1
d2' = (d2_inf - d2)/tau_d2
cai' = -acai*(icaL+icaT)-bcai*cai
a' = (a_inf - a)/tau_a
b' = (b_inf - b)/tau_b
r' = (r_inf - r)/tau_r
}
UNITSOFF
INITIAL {
evaluate_fct(v)
m = m_inf
h = h_inf
n = n_inf
p = p_inf
q = q_inf
c = c_inf
d1 = d1_inf
d2 = d2_inf
a = a_inf
b = b_inf
r = r_inf
cai= 0.005
periodo = 0
}
PROCEDURE evaluate_fct(v(mV)) {
:Fast Na current
h_inf = 1/(1+exp((v-theta_h)/k_h))
m_inf = 1/(1+exp((v-theta_m)/k_m))
tau_h = tau_h0 + tau_h1/(exp(-(v-tht_h1)/sig_h1) + exp(-(v-tht_h2)/sig_h2))
tau_m = tau_m0 + tau_m1/(1+exp(-(v-tht_m)/sig_m))
:Delayed rectifier K
n_inf = 1/(1+exp((v-theta_n)/k_n))
tau_n = tau_n0 + tau_n1/(exp(-(v-tht_n1)/sig_n1) + exp(-(v-tht_n2)/sig_n2))
:Ca T current
p_inf = 1/(1+exp((v-theta_p)/k_p))
q_inf = 1/(1+exp((v-theta_q)/k_q))
tau_p = tau_p0 + tau_p1/(exp(-(v-tht_p1)/sig_p1) + exp(-(v-tht_p2)/sig_p2))
tau_q = tau_q0 + tau_q1/(exp(-(v-tht_q1)/sig_q1) + exp(-(v-tht_q2)/sig_q2))
:Ca L current
c_inf = 1/(1+exp((v-theta_c)/k_c))
d1_inf = 1/(1+exp((v-theta_d1)/k_d1))
d2_inf = 1/(1+exp((v-theta_d2)/k_d2))
tau_c = tau_c0 + tau_c1/(exp(-(v-tht_c1)/sig_c1) + exp(-(v-tht_c2)/sig_c2))
tau_d1 = tau_d10 + tau_d11/(exp(-(v-tht_d11)/sig_d11) + exp(-(v-tht_d12)/sig_d12))
:A current
a_inf = 1/(1+exp((v-theta_a)/k_a))
b_inf = 1/(1+exp((v-theta_b)/k_b))
tau_a = tau_a0 + tau_a1/(1+exp(-(v-tht_a)/sig_a))
tau_b = tau_b0 + tau_b1/(exp(-(v-tht_b1)/sig_b1) + exp(-(v-tht_b2)/sig_b2))
:AHP current
r_inf = 1/(1+exp((v-theta_r)/k_r))
}
UNITSON
I have tested the code without using Coreneuron and it works properly. I think the issue might be in the following line:
cellRule['secs']['soma']['mechs']['STN'] = {'dbs': self.dbs,'gkcabar': gkcabar}
Maybe, I am missing something there.
Dear @iomaganaris,
After a long debugging, we could find the solution for that issue. It seems the name of the cell mechanism can not be the same used for the cell type and cell model. After changing that, things started to work.
Before:
def stnCellRules(self, gkcabar=3.8e-3):
cellRule = {'conds': {'cellModel': 'STN', 'cellType': 'STN'}, 'secs': {}}
cellRule['secs']['soma'] = {'geom': {}, 'mechs': {}}
cellRule['secs']['soma']['geom'] = {'diam': 5.642,
'L': 5.642,
'Ra': 1,
'nseg': 1}
cellRule['secs']['soma']['mechs']['STN'] = {'dbs': self.dbs,'gkcabar': gkcabar}
cellRule['secs']['soma']['vinit'] = random.gauss(-62, 5)
cellRule['secs']['soma']['threshold'] = -10
self.netParams.cellParams['STN'] = cellRule
After:
cellRule = {'conds': {'cellModel':'STN', 'cellType':'STN'}, 'secs': {}}
cellRule['secs']['soma'] = {'geom': {}, 'mechs': {}}
cellRule['secs']['soma']['geom'] = {'diam': 5.642,
'L': 5.642,
'Ra': 1,
'nseg': 1}
cellRule['secs']['soma']['mechs']['SubTN'] = {'dbs': self.dbs,'gkcabar': gkcabar}
cellRule['secs']['soma']['vinit'] = random.gauss(-62, 5)
cellRule['secs']['soma']['threshold'] = -10
self.netParams.cellParams['STN'] = cellRule
PS: I also changed its name inside the mod file.
Hi all,
I was wondering if there is a tutorial explaining how to use coreNeuron on a NetpyNE model. I have installed the coreNeuron package already. But, based on their documentation, the following commands are necessary to activate the GPU support:
Enable cache efficiency :
from neuron import h h.cvode.cache_efficient(1)
Enable CoreNEURON :
from neuron import coreneuron coreneuron.enable = True
If GPU support is enabled during build, enable GPU execution using:
coreneuron.gpu = True
:warning: In this case you must launch your script using the special binary! This is explained in more detail below.
Use psolve to run simulation after initialization :
h.stdinit() pc.psolve(h.tstop)
Is there anything similar for NetPyNE?