spikerecord() and spikeout() in single cell MULTISPLIT

General issues of interest both for network and
individual cell parallelization.

Moderator: hines

Post Reply
jackfolla
Posts: 48
Joined: Wed Jul 07, 2010 7:42 am

spikerecord() and spikeout() in single cell MULTISPLIT

Post by jackfolla »

Dear all,
I have the following problem:

I want to record and print the spike train of the single cell that I multisplitted.

Using the following code:

Code: Select all

objref tvec, idvec

proc spikerecord() {local i  localobj nc, nil
  tvec = new Vector()
  if (section_exists("soma", 0)) {
   	soma nc=new NetCon(&v(1),nil,10,1,0.01)
   	nc.record(tvec)
  }
}

proc spikeout() { local i
	pc.barrier()
	if (pc.id==0) printf("Spikes Time:\n")
	for i=0, tvec.size-1 printf("Spike %d at %g\n", i+1, tvec.x[i])
	pc.barrier()
}
there is the problem that one host knows the spikes info, and a priori I don't know what is this host.

I have seen that is possible to use:

Code: Select all

...
pnm.want_all_spikes()
...
for i=0, pnm.spikevec.size-1 {
	print pnm.spikevec.x[i]
}
print pnm.spikevec.size
...
but if I replace my spikerecord() with pnm.want_all_spikes(), and spikeout() with for ... {print pnm.spikevec.x} the program goes into infinite loop.

In addition I have an other problem with printing in a text file:

Code: Select all

start=200
  
for u=start,200{
        ...   
	if (u==start){
		savdata3 = new File()
		sprint(name3,"Simulation_%s.dat",str)
		savdata3.wopen(name3)
		pc.barrier()
		if (section_exists("soma",0)){
			savdata3.printf("gNa_axon=%f \t",gna_axon)
			savdata3.printf("gK_axon=%f \t",gkdrbar_axon)
			savdata3.printf("gK_soma=%f \t",gkdrbar_soma)
			savdata3.printf("gNa_soma=%f \t",gna_soma)
			savdata3.printf("gK_basal=%f \t",gkdrbar_basal)
			savdata3.printf("g_Km=%f \t",gbar_km)
			savdata3.printf("g_Ih=%f \t",soma_hbar)
			savdata3.printf("g_CaT=%f \t",gcatbar_cat)
			savdata3.printf("g_CaL=%f \t",gcalbar_cal)
			savdata3.printf("g_CaR=%f \t",gcabar_somacar)
			savdata3.printf("g_sAHP=%f \t",gbar_kca)
			savdata3.printf("g_mAHP=%f \t\n",gkbar_mykca)
			savdata3.printf("#nsynE \t #Spikes\n")
		}
	}
	run_program()
}
and for each iteration proc run_program() print into file savdata3 the values nsynE and Spikes.
But, for a single iteration (for example), the output is the following:

Code: Select all

 200 	 0
0.300000 	 gK_axon=0.030000 	 gK_soma=0.007500 	 gNa_soma=0.030000 	 gK_basal=0.000100 	 g_Km=0.000400 	 g_Ih=0.000019 	g_CaT=0.000050 	g_CaL=0.007000 	 g_CaR=0.000600 g_sAHP=0.000500	 g_mAHP=0.090750
 200 	 2
Note that savdata3.printf("gNa_axon=%f \t",gna_axon) is incomplete, and savdata3.printf("#nsynE \t #Spikes\n") is absent. In addition, it is possible to note the problem of spikes info (in this case "number of spikes") that is 0 for host 0 and 2 for host 1.

PS: mpiexec -np 2 nrniv -mpi -NSTACK 2000 init.hoc

Thanks for your help.
Pasquale.
hines
Site Admin
Posts: 1691
Joined: Wed May 18, 2005 3:32 pm

Re: spikerecord() and spikeout() in single cell MULTISPLIT

Post by hines »

The host where the soma exists is the pc.id of that host where
section_exists("soma", 0) is nonzero. That is how you decided to record into tvec.
So, in spikeout, no need for a barrier. Just say
if (section_exists("soma", 0)) {
printf("Spike...
for i=0, ...
}


The pnm may not be working because you may not have associated a gid with the spike output location.


With regard to your incomplete savdata3 file, remember that you have every process opening the same file for
writing (I don't see where it is being closed) . Just open and close the file on the process where soma exists.
jackfolla
Posts: 48
Joined: Wed Jul 07, 2010 7:42 am

Re: spikerecord() and spikeout() in single cell MULTISPLIT

Post by jackfolla »

Dear Hines,
thanks a lot.

I have an other question:
formerly you sent me a patch (roundoff.patch) for roundoff error in multisplit case, and a test program (hhchain.hoc).

Now I want to apply this patch.

I used (on Ubuntu Linux 10.10) "patch -p1 < roundoff.patch" (in /home/my_user_name/neuron/nrn-7.1) with the following output:

Code: Select all

patching file src/nrnoc/fadvance.c
Hunk #1 succeeded at 468 (offset -4 lines).
patching file src/oc/hoc_init.c
patching file src/oc/math.c
Now, using the test program with "nrniv hhchain.hoc" I have the following error:

Code: Select all

nrniv: dbl_precision undefined function
 in hhchain.hoc near line 21
 }
  ^
        dbl_precision(53)
Perhaps, after applying the patch, I need to use some other command, like "make"???

Thanks, Pasquale.
Post Reply