/*
* test_rng_seeds.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/>.
*
*/
/* BeginDocumentation
Name: testsuite::test_rng_seeds - test if setting and getting of the rng seeds works
Synopsis: (test_rng_seeds) run -> dies if assertion fails
Description:
This script checks for different numbers of threads if the seeds are
consistently set for all threads. This script can be run using a
single process. However, to test all aspects of rng seeding, it should
be run via mpirun and different numbers of processes.
Author: Eppler
FirstVersion: October 2008
*/
/unittest (6688) require
/unittest using
% Check the default seeds
[1 2 4] {
/n_threads Set
ResetKernel
0 << /local_num_threads n_threads >> SetStatus
0 GetStatus /rng_seeds get
[0 /total_num_virtual_procs get] Range eq assert_or_die
} forall
% Check manual setting of seeds
[1 2 4] {
/n_threads Set
ResetKernel
0 << /local_num_threads n_threads >> SetStatus
/seeds [0 /total_num_virtual_procs get] Range 100 add def
0 << /rng_seeds seeds >> SetStatus
0 GetStatus /rng_seeds get seeds eq assert_or_die
} forall