current[cell_id][np.where(distance == depth)[0][0]] = amp print("spike! at time {0} and position {1}, cell {2} segment {3}".format(spike_time_loc[0], cell.get_idx_name(spike_time_loc[1])[1], cell_id, cell.get_idx_name(spike_time_loc[1])[0])) c_vext[cell_id][np.where(distance == depth)] = v_cell_ext[spike_time_loc[1]][spike_time_loc[0]] ap_loc[cell_id][np.where(distance == depth)] = spike_time_loc[1] # glb_vmem.append(cell.vmem) # cells.append(cell) else: click += 1 COMM.Barrier() is_spike = False COMM.Barrier() if RANK == 0: cells.append(utils.built_for_mpi_space(cell, cell_id)) for i_proc in range(1, SIZE): cells.append(COMM.recv(source=i_proc)) else: COMM.send(utils.built_for_mpi_space(cell, cell_id), dest=0) COMM.Barrier() if cell_id == 0: gather_current = [] # plot_current = np.zeros((n_cells, spatial_resolution)) # print len(utils.built_for_mpi_comm(cell, glb_vext, glb_vmem, v_idxs, RANK)) # single_cells = [utils.built_for_mpi_comm(cell, glb_vext, glb_vmem, v_idxs, RANK)] gather_current.append({"current": current[cell_id], "v_ext_at_pulse": c_vext[cell_id], "ap_loc": ap_loc[cell_id], "rank": cell_id}) for i_proc in range(1, n_cells):
tmax = vxmax for i in range(1, n_cells): temp = COMM.recv(source=i) if temp[0] < tmin: tmin = temp[0] if temp[1] > tmax: tmax = temp[1] else: COMM.send([vxmin, vxmax], dest=0) COMM.Barrier() if cell_id == 0: cells = [] cells.append( utils.built_for_mpi_space(cell, cell_id, spike_time_loc, cell.allsecnames)) for i_proc in range(1, SIZE): cells.append(COMM.recv(source=i_proc)) else: COMM.send(utils.built_for_mpi_space(cell, cell_id, spike_time_loc, cell.allsecnames), dest=0) COMM.Barrier() xlim_min = -750 xlim_max = 750 ylim_min = -200 ylim_max = 200 zlim_min = -2000 zlim_max = 50
# if SIZE > 1: # if RANK == 0: # for i in range(1, SIZE): # COMM_DICT.update(COMM.recv(source=i, tag=123)) # print('received from RANK {} on RANK {}'.format(i, RANK)) # else: # print('sent from RANK {}'.format(RANK)) # COMM.send(COMM_DICT, dest=0, tag=123) # else: # pass COMM.Barrier() if RANK == 0: print("simulation done") cells = [] cells.append(utils.built_for_mpi_space(cell, RANK)) for i_proc in range(1, SIZE): cells.append(COMM.recv(source=i_proc)) else: COMM.send(utils.built_for_mpi_space(cell, RANK), dest=0) COMM.Barrier() color = iter(plt.cm.rainbow(np.linspace(0, 1, SIZE))) if RANK == 0: col = ['b', 'r'] figview = plt.figure(1) axview = plt.subplot(111, title="3D view", aspect='auto',