Error with pc.allreduce

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

Moderator: hines

Post Reply
neuromau
Posts: 97
Joined: Mon Apr 20, 2009 7:02 pm

Error with pc.allreduce

Post by neuromau »

Hello, I have an issue using pc.allreduce. I'm running code in parallel on my '2-core' Windows Vista machine using Neuron 7.2 installed at the Parallelization Course. Previously, this code worked fine with the following calls for 1 or 2 processors:
mpiexec -n 1 /mypath/nrniv -mpi mycode.hoc
mpiexec -n 2 /mypath/nrniv -mpi mycode.hoc

Now, I have added a function 'performanceinfo()' to my code, and I call it in the rrun statement:

Code: Select all

proc rrun(){
	pnm.want_all_spikes()
	pc.set_maxstep(10)
	runtime = startsw()
	{waittime = pc.wait_time}
	stdinit()
	pc.psolve(tstop)	
	waittime = pc.wait_time - waittime
	runtime = startsw() - runtime
	simtime = startsw() - simstart
	performanceinfo()
	}
proc performanceinfo() {
		w_avg = pc.allreduce(1, waittime)/pc.nhost
		w_max = pc.allreduce(2, waittime)
		w_min = pc.allreduce(3, waittime)
		comp_avg = pc.allreduce(1, pc.step_time)/pc.nhost
		comp_max = pc.allreduce(2, pc.step_time)
		comp_min = pc.allreduce(3, pc.step_time)
		if (pc.id==0) {printf("comp avg = %g max = %g min = %g\n", comp_avg, comp_max, comp_min)}
		if (pc.id==0) {printf("wait avg = %g max = %g min = %g\n", w_avg, w_max, w_min)}
	}
Now, I get an error when running my code with 2 processors. Here is the (relevant) output I get when running the new code with 1 or 2 processors:

1 processor:
comp avg = 1 max = 2 min = 3
wait avg = 1 max = 2 min = 3

2 processors:
, )
)
)
0 /mypath/nrniv: Arg out of range in user function
0 in mycode.hoc near line 751
0 rrun()

0 ParallelContext[0].allreduce(14.5180 performanceinfo(0 rrun(application called MPI_Abort(MPI_COMM_WORLD, -1) - process 0
, )
)
)
1 /mypath/nrniv: Arg out of range in user function
1 in mycode.hoc near line 751
1 rrun()

1 ParallelContext[0].allreduce(10.004000191 performanceinfo(1 rrun(application called MPI_Abort(MPI_COMM_WORLD, -1) - process 1
rank 1 in job 12 MYPC caused collective abort of all ranks
exit status of rank 1: killed by signal 9
rank 0 in job 12 MYPC caused collective abort of all ranks
exit status of rank 0: killed by signal 9

Not sure what I am doing wrong... Let me know if I should send the code directly. Thanks for your assistance.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: Error with pc.allreduce

Post by hines »

The pc.allreduce argument order is reversed:
http://www.neuron.yale.edu/neuron/stati ... #allreduce
result = pc.allreduce(value, type)
neuromau
Posts: 97
Joined: Mon Apr 20, 2009 7:02 pm

Re: Error with pc.allreduce

Post by neuromau »

Thanks! Now that I have my arguments in the correct order, it works just fine =).
Post Reply