run.py 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. from random import seed
  2. import logging
  3. import os
  4. import sys
  5. synergine2_ath = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../'))
  6. sys.path.append(synergine2_ath)
  7. from sandbox.perf.simulation import ComputeSubject
  8. from synergine2.config import Config
  9. from synergine2.core import Core
  10. from synergine2.cycle import CycleManager
  11. from synergine2.log import get_default_logger
  12. from synergine2.simulation import Simulation, Subjects
  13. from synergine2.terminals import TerminalManager
  14. def main():
  15. seed(42)
  16. config = Config(dict(complexity=10000))
  17. logger = get_default_logger(level=logging.ERROR)
  18. simulation = Simulation(config)
  19. subjects = Subjects(simulation=simulation)
  20. subjects.extend([ComputeSubject(
  21. config=config,
  22. simulation=simulation,
  23. ) for i in range(500)])
  24. simulation.subjects = subjects
  25. core = Core(
  26. config=config,
  27. logger=logger,
  28. simulation=simulation,
  29. cycle_manager=CycleManager(
  30. config=config,
  31. logger=logger,
  32. simulation=simulation,
  33. ),
  34. terminal_manager=TerminalManager(
  35. config=config,
  36. logger=logger,
  37. terminals=[]
  38. ),
  39. cycles_per_seconds=1000000,
  40. )
  41. core.run()
  42. if __name__ == '__main__':
  43. main()