Ejemplo n.º 1
0
    def test15(self):
        particles = plummer.new_plummer_model(512)
        expected_positions = None
        for mode in ["cpu", "openmp", "opencl"]:
            try:
                instance = Huayno(mode=mode,
                                  number_of_workers=1)  #, debugger="xterm")
            except:
                print("Running huayno with mode=", mode, " was unsuccessful.")
                continue
            else:
                print("Running huayno with mode=", mode, "... ")

            instance.initialize_code()
            instance.parameters.epsilon_squared = 0.01 | nbody_system.length**2
            instance.particles.add_particles(particles)

            instance.evolve_model(0.2 | nbody_system.time)
            instance.synchronize_model()
            if expected_positions is None:
                expected_positions = instance.particles.position
            else:
                self.assertAlmostRelativeEquals(expected_positions,
                                                instance.particles.position, 8)
            instance.stop()
Ejemplo n.º 2
0
 def test13(self):
     particles = plummer.new_plummer_model(31)
    
     instance = Huayno(number_of_workers=1)#, debugger="xterm")
     instance.initialize_code()
     instance.parameters.epsilon_squared = 0.01 | nbody_system.length ** 2
     instance.particles.add_particles(particles)
     
     instance.evolve_model(0.1 | nbody_system.time)
     instance.synchronize_model()
     expected_positions = instance.particles.position
     instance.stop()
Ejemplo n.º 3
0
    def test13(self):
        particles = plummer.new_plummer_model(31)

        instance = Huayno(number_of_workers=1)  #, debugger="xterm")
        instance.initialize_code()
        instance.parameters.epsilon_squared = 0.01 | nbody_system.length**2
        instance.particles.add_particles(particles)

        instance.evolve_model(0.1 | nbody_system.time)
        instance.synchronize_model()
        expected_positions = instance.particles.position
        instance.stop()
Ejemplo n.º 4
0
 def test15(self):
     particles = plummer.new_plummer_model(512)
     expected_positions = None
     for mode in ["cpu", "openmp", "opencl"]:
         try:
             instance = Huayno(mode=mode, number_of_workers=1)#, debugger="xterm")
         except:
             print "Running huayno with mode=", mode, " was unsuccessful."
             continue
         else:
             print "Running huayno with mode=", mode, "... "
             
         instance.initialize_code()
         instance.parameters.epsilon_squared = 0.01 | nbody_system.length ** 2
         instance.particles.add_particles(particles)
         
         instance.evolve_model(0.2 | nbody_system.time)
         instance.synchronize_model()
         if expected_positions is None:
             expected_positions = instance.particles.position
         else:
             self.assertAlmostRelativeEquals(expected_positions, instance.particles.position, 8)
         instance.stop()