Exemplo n.º 1
0
    def prepare_connections(self, input_fn=None):

        if self.params['connectivity'] == 'precomputed':
            print "Proc %d computes initial weights ... " % self.pc_id
            tuning_prop = np.loadtxt(self.params['tuning_prop_means_fn'])
            CC.compute_weights_from_tuning_prop(tuning_prop, self.params, self.comm)

        elif self.pc_id == 0 and self.params['connectivity'] == 'random':
            print "Proc %d shuffles pre-computed weights ... " % self.pc_id
            output_fn = self.params['random_weight_list_fn'] + '0.dat'
            CC.compute_random_weight_list(input_fn, output_fn, self.params)

        if self.comm != None:
            print 'Pid %d at Barrier in prepare_connections' % self.pc_id
            sys.stdout.flush()
            self.comm.Barrier()