/*
 *  test_neuron_vp.sli
 *
 *  This file is part of NEST.
 *
 *  Copyright (C) 2004 The NEST Initiative
 *
 *  NEST is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  NEST is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with NEST.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

/*
 * See #336 for discussion.
 * HEP
 */

% run this program sequentially with:
% 
%      nest_indirect test_neuron_vp.sli
%
% the result should always be the same because the 
% distribution of nodes over virtual processes is 
% independent of the number of jobs used to carry out
% the calculation.

% /vp get

(unittest) run
/unittest using

skip_if_not_threaded

[1 2 4]
{
  ResetKernel

  0 << /total_num_virtual_procs 4 >> SetStatus

  /subnet Create /net Set
  net ChangeSubnet
    /iaf_neuron Create /n1 Set
    /iaf_neuron Create /n2 Set
    /iaf_neuron Create /n3 Set
    /iaf_neuron Create /n4 Set
  0 ChangeSubnet

  net GetGlobalNodesInfo /nodes Set

 Rank 0 eq
 {

  () =
  (gid vp | gid vp | gid vp | gid vp) =
  (---------------------------------) =
  ()
  nodes 
  { 
    /d Set
    d /global_id get cvs  (   ) join d /vp get cvs join  ( |  ) join join
  } forall
  dup =

  } if
}

distributed_invariant_assert_or_die








%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% expected output
%
% gid vp | gid vp | gid vp | gid vp
% ---------------------------------
% 1   1 |  2   2 |  3   3 |  4   0
%
%
