Changeset 915 for trunk

Show
Ignore:
Timestamp:
01/27/11 11:57:12 (2 years ago)
Author:
apdavison
Message:

Discovered that when using NEST with mpi4py, you must import nest first and let it do the MPI initialization. The only time this seems to be a problem with PyNN is if a user imports pyNN.random before pyNN.nest. It would be nice to handle this more gracefully, but for now I've just added a test that NEST and mpi4py agree on the rank, and a hopefully useful error message.

Location:
trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/examples/IF_curr_exp2.py

    r756 r915  
    1313 
    1414import numpy 
    15 from pyNN.random import NumpyRNG 
    1615from pyNN.utility import get_script_args 
    17  
    1816simulator_name = get_script_args(1)[0]   
    1917exec("from pyNN.%s import *" % simulator_name) 
    20  
     18from pyNN.random import NumpyRNG 
    2119 
    2220setup(timestep=0.01, min_delay=2.0, max_delay=4.0) 
  • trunk/examples/VAbenchmarks.py

    r869 r915  
    2020from math import * 
    2121 
    22 from pyNN.random import NumpyRNG, RandomDistribution 
    2322from pyNN.utility import get_script_args, Timer 
    2423usage = """Usage: python VAbenchmarks.py <simulator> <benchmark> 
     
    2726simulator_name, benchmark = get_script_args(2, usage)   
    2827exec("from pyNN.%s import *" % simulator_name) 
     28from pyNN.random import NumpyRNG, RandomDistribution 
    2929 
    3030timer = Timer() 
  • trunk/examples/VAbenchmarks2-csa.py

    r768 r915  
    2424import csa 
    2525 
    26 from pyNN.random import NumpyRNG, RandomDistribution 
    2726from pyNN.utility import get_script_args, Timer 
    2827usage = """Usage: python VAbenchmarks.py <simulator> <benchmark> 
     
    3130simulator_name, benchmark = get_script_args(2, usage)   
    3231exec("from pyNN.%s import *" % simulator_name) 
     32from pyNN.random import NumpyRNG, RandomDistribution 
    3333 
    3434timer = Timer() 
  • trunk/examples/VAbenchmarks2.py

    r869 r915  
    2323from math import * 
    2424 
    25 from pyNN.random import NumpyRNG, RandomDistribution 
    2625from pyNN.utility import get_script_args, Timer 
    2726usage = """Usage: python VAbenchmarks.py <simulator> <benchmark> 
     
    3029simulator_name, benchmark = get_script_args(2, usage)   
    3130exec("from pyNN.%s import *" % simulator_name) 
     31from pyNN.random import NumpyRNG, RandomDistribution 
    3232 
    3333timer = Timer() 
  • trunk/examples/VAbenchmarks3.py

    r869 r915  
    2323from math import * 
    2424 
    25 from pyNN.random import NumpyRNG, RandomDistribution 
    2625from pyNN.utility import get_script_args, Timer 
    2726usage = """Usage: python VAbenchmarks.py <simulator> <benchmark> 
     
    3029simulator_name, benchmark = get_script_args(2, usage)   
    3130exec("from pyNN.%s import *" % simulator_name) 
     31from pyNN.random import NumpyRNG, RandomDistribution 
    3232 
    3333timer = Timer() 
  • trunk/src/nest/__init__.py

    r913 r915  
    1010common.simulator = simulator 
    1111recording.simulator = simulator 
     12 
     13if nest.Rank() != recording.mpi_comm.rank: 
     14    raise Exception("MPI not working properly. Please make sure you import pyNN.nest before pyNN.random.") 
    1215 
    1316import numpy