running.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. <!DOCTYPE html>
  2. <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
  3. <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>How to run a CBD simulation? &mdash; CBD Simulation Development Kit documentation</title>
  8. <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  9. <!-- <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> -->
  10. <link rel="stylesheet" href="_static/style.css" type="text/css" />
  11. <link rel="index" title="Index" href="genindex.html" />
  12. <link rel="search" title="Search" href="search.html" />
  13. <link rel="next" title="Changelog" href="changelog.html" />
  14. <link rel="prev" title="CBD.realtime.threadingTkInter module" href="CBD.realtime.threadingTkInter.html" />
  15. <script async src="https://www.googletagmanager.com/gtag/js?id=UA-167094275-1"></script>
  16. <script src="_static/js/googleanalytics.min.js"></script>
  17. <script src="_static/js/modernizr.min.js"></script>
  18. <!-- Preload the theme fonts -->
  19. <link rel="preload" href="_static/fonts/FreightSans/freight-sans-book.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  20. <link rel="preload" href="_static/fonts/FreightSans/freight-sans-medium.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  21. <link rel="preload" href="_static/fonts/IBMPlexMono/IBMPlexMono-Medium.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  22. <link rel="preload" href="_static/fonts/FreightSans/freight-sans-bold.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  23. <link rel="preload" href="_static/fonts/FreightSans/freight-sans-medium-italic.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  24. <link rel="preload" href="_static/fonts/IBMPlexMono/IBMPlexMono-SemiBold.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  25. <!-- Preload the katex fonts -->
  26. <link rel="preload" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/fonts/KaTeX_Math-Italic.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  27. <link rel="preload" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/fonts/KaTeX_Main-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  28. <link rel="preload" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/fonts/KaTeX_Main-Bold.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  29. <link rel="preload" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/fonts/KaTeX_Size1-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  30. <link rel="preload" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/fonts/KaTeX_Size4-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  31. <link rel="preload" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/fonts/KaTeX_Size2-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  32. <link rel="preload" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/fonts/KaTeX_Size3-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  33. <link rel="preload" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/fonts/KaTeX_Caligraphic-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  34. </head>
  35. <div class="container-fluid header-holder tutorials-header" id="header-holder">
  36. <div class="container">
  37. <div class="header-container">
  38. <a class="header-logo" href="https://catalyst-team.com/" aria-label="Catalyst"></a>
  39. <div class="main-menu">
  40. <ul>
  41. <li>
  42. <div class="ecosystem-dropdown">
  43. <a id="dropdownMenuButtonEcosystem" data-toggle="ecosystem-dropdown">
  44. Ecosystem
  45. </a>
  46. <div class="ecosystem-dropdown-menu">
  47. <a class="nav-dropdown-item" href="https://alchemy.host">
  48. <span class=dropdown-title>Alchemy</span>
  49. <p>Experiments logging & visualization</p>
  50. </a>
  51. <a class="nav-dropdown-item" href="https://github.com/catalyst-team/catalyst">
  52. <span class=dropdown-title>Catalyst</span>
  53. <p>Accelerated deep learning R&D</p>
  54. </a>
  55. <a class="nav-dropdown-item" href="https://github.com/catalyst-team/reaction">
  56. <span class=dropdown-title>Reaction</span>
  57. <p>Convenient deep learning models serving</p>
  58. </a>
  59. </div>
  60. </div>
  61. </li>
  62. <li>
  63. <div class="projects-dropdown">
  64. <a id="dropdownMenuButtonProjects" data-toggle="projects-dropdown">
  65. Projects
  66. </a>
  67. <div class="projects-dropdown-menu">
  68. <a class="nav-dropdown-item" href="https://github.com/catalyst-team/codestyle">
  69. <span class=dropdown-title>Codestyle</span>
  70. <p>Joint R&D codestyle</p>
  71. </a>
  72. <a class="nav-dropdown-item" href="https://github.com/catalyst-team/neuro">
  73. <span class=dropdown-title>Catalyst.Neuro</span>
  74. <p>Catalyst.Team and TReNDS collaborative project</p>
  75. </a>
  76. <a class="nav-dropdown-item" href="https://github.com/catalyst-team/classification">
  77. <span class=dropdown-title>Classification</span>
  78. <p>Image classification pipeline with transfer learning</p>
  79. </a>
  80. <a class="nav-dropdown-item" href="https://github.com/catalyst-team/detection">
  81. <span class=dropdown-title>Detection</span>
  82. <p>Object detection pipeline</p>
  83. </a>
  84. <a class="nav-dropdown-item" href="https://github.com/catalyst-team/segmentation">
  85. <span class=dropdown-title>Segmentation</span>
  86. <p>Image semantic segmentation pipeline</p>
  87. </a>
  88. <a class="nav-dropdown-item" href="https://github.com/catalyst-team/gan">
  89. <span class=dropdown-title>Catalyst.GAN</span>
  90. <p>GAN pipelines</p>
  91. </a>
  92. </div>
  93. </div>
  94. </li>
  95. <li>
  96. <a href="https://github.com/catalyst-team/dl-course">Deep learning course</a>
  97. </li>
  98. </ul>
  99. </div>
  100. <a class="main-menu-open-button" href="#" data-behavior="open-mobile-menu"></a>
  101. </div>
  102. </div>
  103. </div>
  104. <body class="catalyst-body">
  105. <div class="table-of-contents-link-wrapper">
  106. <span>Table of Contents</span>
  107. <a href="#" class="toggle-table-of-contents" data-behavior="toggle-table-of-contents"></a>
  108. </div>
  109. <nav data-toggle="wy-nav-shift" class="catalyst-left-menu" id="catalyst-left-menu">
  110. <div class="catalyst-side-scroll">
  111. <div class="catalyst-menu catalyst-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
  112. <div class="catalyst-left-menu-search">
  113. <div role="search">
  114. <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
  115. <input type="text" name="q" placeholder="Search Docs" />
  116. <input type="hidden" name="check_keywords" value="yes" />
  117. <input type="hidden" name="area" value="default" />
  118. </form>
  119. </div>
  120. </div>
  121. <p class="caption"><span class="caption-text">Setup</span></p>
  122. <ul class="current">
  123. <li class="toctree-l1"><a class="reference internal" href="install.html">How to install the CBD framework?</a></li>
  124. <li class="toctree-l1 current"><a class="current reference internal" href="#">How to run a CBD simulation?</a></li>
  125. <li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a></li>
  126. </ul>
  127. <p class="caption"><span class="caption-text">Simple Examples</span></p>
  128. <ul>
  129. <li class="toctree-l1"><a class="reference internal" href="examples/SinGen.html">Sine Generator</a></li>
  130. <li class="toctree-l1"><a class="reference internal" href="examples/EvenNumberGen.html">Hierarchical Even Number Generator</a></li>
  131. <li class="toctree-l1"><a class="reference internal" href="examples/Fibonacci.html">Fibonacci Sequence Generator</a></li>
  132. <li class="toctree-l1"><a class="reference internal" href="examples/LCG.html">Linear Congruential Generator</a></li>
  133. </ul>
  134. <p class="caption"><span class="caption-text">Advanced Examples</span></p>
  135. <ul>
  136. <li class="toctree-l1"><a class="reference internal" href="examples/RealTime.html">Realtime Simulation</a></li>
  137. <li class="toctree-l1"><a class="reference internal" href="examples/LivePlot.html">Live Plotting of Data During the Simulation</a></li>
  138. </ul>
  139. <p class="caption"><span class="caption-text">Internal Documentation</span></p>
  140. <ul>
  141. <li class="toctree-l1"><a class="reference internal" href="CBD.html">CBD package</a></li>
  142. </ul>
  143. </div>
  144. </div>
  145. </nav>
  146. <div class="catalyst-container">
  147. <div class="catalyst-page-level-bar" id="catalyst-page-level-bar">
  148. <div class="catalyst-breadcrumbs-wrapper">
  149. <div role="navigation" aria-label="breadcrumbs navigation">
  150. <ul class="catalyst-breadcrumbs">
  151. <li>
  152. <a href="index.html">
  153. Docs
  154. </a> &gt;
  155. </li>
  156. <li>How to run a CBD simulation?</li>
  157. <li class="catalyst-breadcrumbs-aside">
  158. </li>
  159. </ul>
  160. </div>
  161. </div>
  162. <div class="catalyst-shortcuts-wrapper" id="catalyst-shortcuts-wrapper">
  163. Shortcuts
  164. </div>
  165. </div>
  166. <section data-toggle="wy-nav-shift" id="catalyst-content-wrap" class="catalyst-content-wrap">
  167. <div class="catalyst-content-left">
  168. <div class="rst-content">
  169. <div role="main" class="main-content" itemscope="itemscope" itemtype="http://schema.org/Article">
  170. <article itemprop="articleBody" id="catalyst-article" class="catalyst-article">
  171. <div class="section" id="how-to-run-a-cbd-simulation">
  172. <h1>How to run a CBD simulation?<a class="headerlink" href="#how-to-run-a-cbd-simulation" title="Permalink to this headline">¶</a></h1>
  173. <p>A simple, local distribution can be executed by running an experiment file,
  174. which will look like this:</p>
  175. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">model</span> <span class="o">=</span> <span class="n">MyModel</span><span class="p">()</span>
  176. <span class="n">sim</span> <span class="o">=</span> <span class="n">Simulator</span><span class="p">()</span>
  177. <span class="n">sim</span><span class="o">.</span><span class="n">run</span><span class="p">()</span>
  178. </pre></div>
  179. </div>
  180. <p>For a more elaborate setup, you can take add some configuration information to
  181. the simulator (before the <code class="xref py py-func docutils literal notranslate"><span class="pre">run()</span></code> method is called); for instance:</p>
  182. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># Set the step delay to 0.1 seconds</span>
  183. <span class="n">sim</span><span class="o">.</span><span class="n">setDeltaT</span><span class="p">(</span><span class="mf">0.1</span><span class="p">)</span>
  184. <span class="c1"># Set the termination time to 500 seconds</span>
  185. <span class="n">sim</span><span class="o">.</span><span class="n">setTerminationTime</span><span class="p">(</span><span class="mi">500</span><span class="p">)</span>
  186. <span class="c1"># Set the the system to terminate whenever cond(model) returns True</span>
  187. <span class="c1"># Take a look at the LCG example for more information</span>
  188. <span class="n">sim</span><span class="o">.</span><span class="n">setTerminationCondition</span><span class="p">(</span><span class="n">cond</span><span class="p">)</span>
  189. <span class="c1"># Show a progress indicator (requires `tqdm` to be installed)</span>
  190. <span class="n">sim</span><span class="o">.</span><span class="n">setProgressBar</span><span class="p">()</span>
  191. </pre></div>
  192. </div>
  193. <p>Take a look at the <a class="reference internal" href="CBD.simulator.html#CBD.simulator.Simulator" title="CBD.simulator.Simulator"><code class="xref py py-class docutils literal notranslate"><span class="pre">CBD.simulator.Simulator</span></code></a> class for more options
  194. and information.</p>
  195. <div class="section" id="running-the-tests">
  196. <h2>Running the Tests<a class="headerlink" href="#running-the-tests" title="Permalink to this headline">¶</a></h2>
  197. <p>Not sure your code base is valid anymore? The CBD framework comes with its
  198. own battery of tests (located in the <code class="code docutils literal notranslate"><span class="pre">src/test</span></code> folder), which can
  199. be executed from the root folder with:</p>
  200. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python -m unittest discover -v src.test <span class="s2">&quot;*.py&quot;</span>
  201. </pre></div>
  202. </div>
  203. </div>
  204. </div>
  205. </article>
  206. </div>
  207. <footer>
  208. <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
  209. <a href="changelog.html" class="btn btn-neutral float-right" title="Changelog" accesskey="n" rel="next">Next <img src="_static/images/chevron-right-orange.svg" class="next-page"></a>
  210. <a href="CBD.realtime.threadingTkInter.html" class="btn btn-neutral" title="CBD.realtime.threadingTkInter module" accesskey="p" rel="prev"><img src="_static/images/chevron-right-orange.svg" class="previous-page"> Previous</a>
  211. </div>
  212. <hr>
  213. <div role="contentinfo">
  214. <p>
  215. &copy; Copyright 2020, Randy Paredis.
  216. </p>
  217. </div>
  218. <div>
  219. Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
  220. </div>
  221. </footer>
  222. </div>
  223. </div>
  224. <div class="catalyst-content-right" id="catalyst-content-right">
  225. <div class="catalyst-right-menu" id="catalyst-right-menu">
  226. <div class="catalyst-side-scroll" id="catalyst-side-scroll-right">
  227. <ul>
  228. <li><a class="reference internal" href="#">How to run a CBD simulation?</a><ul>
  229. <li><a class="reference internal" href="#running-the-tests">Running the Tests</a></li>
  230. </ul>
  231. </li>
  232. </ul>
  233. </div>
  234. </div>
  235. </div>
  236. </section>
  237. </div>
  238. <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
  239. <script type="text/javascript" src="_static/jquery.js"></script>
  240. <script type="text/javascript" src="_static/underscore.js"></script>
  241. <script type="text/javascript" src="_static/doctools.js"></script>
  242. <script type="text/javascript" src="_static/language_data.js"></script>
  243. <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
  244. <script type="text/javascript" src="_static/js/vendor/popper.min.js"></script>
  245. <script type="text/javascript" src="_static/js/vendor/bootstrap.min.js"></script>
  246. <script type="text/javascript" src="_static/js/theme.js"></script>
  247. <script type="text/javascript">
  248. jQuery(function () {
  249. SphinxRtdTheme.Navigation.enable(true);
  250. });
  251. </script>
  252. <!-- Begin Footer -->
  253. <footer class="site-footer" id="site-footer">
  254. <div class="container footer-container">
  255. <div class="footer-logo-wrapper">
  256. <a href="https://catalyst-team.com/" class="footer-logo"></a>
  257. </div>
  258. <div class="footer-links-wrapper">
  259. <div class="footer-links-col">
  260. <ul>
  261. <li class="list-title"><a href="https://github.com/catalyst-team">Ecosystem</a></li>
  262. <li><a class="nav-dropdown-item" href="https://alchemy.host">Alchemy</a></li>
  263. <li><a class="nav-dropdown-item" href="https://github.com/catalyst-team/catalyst">Catalyst</a></li>
  264. <li><a class="nav-dropdown-item" href="https://github.com/catalyst-team/reaction">Reaction</a></li>
  265. </ul>
  266. </div>
  267. <div class="footer-links-col">
  268. <ul>
  269. <li class="list-title"><a href="https://github.com/catalyst-team">Projects</a></li>
  270. <li><a class="nav-dropdown-item" href="https://github.com/catalyst-team/codestyle">Codestyle</a></li>
  271. <li><a class="nav-dropdown-item" href="https://github.com/catalyst-team/neuro">Catalyst.Neuro</a></li>
  272. <li><a class="nav-dropdown-item" href="https://github.com/catalyst-team/classification">Classification</a></li>
  273. <li><a class="nav-dropdown-item" href="https://github.com/catalyst-team/detection">Detection</a></li>
  274. <li><a class="nav-dropdown-item" href="https://github.com/catalyst-team/segmentation">Segmentation</a></li>
  275. <li><a class="nav-dropdown-item" href="https://github.com/catalyst-team/gan">Catalyst.GAN</a></li>
  276. </ul>
  277. </div>
  278. <div class="footer-links-col">
  279. <ul>
  280. <li class="list-title"><a href="https://catalyst-team.com/">Support</a></li>
  281. <li><a href="https://github.com/catalyst-team/catalyst/issues" target="_blank">Github Issues</a></li>
  282. <li><a href="https://github.com/catalyst-team/catalyst/blob/master/CONTRIBUTING.md" target="_blank">Contributing</a></li>
  283. <li><a href="https://www.patreon.com/catalyst_team" target="_blank">Patreon</a></li>
  284. </ul>
  285. </div>
  286. <div class="footer-links-col follow-us-col">
  287. <div class="footer-social-icons">
  288. <a href="https://t.me/catalyst_team" target="_blank" class="telegram"></a>
  289. <a href="https://twitter.com/catalyst_core" target="_blank" class="twitter"></a>
  290. <a href="https://join.slack.com/t/catalyst-team-core/shared_invite/zt-d9miirnn-z86oKDzFMKlMG4fgFdZafw" target="_blank" class="ods"></a>
  291. </div>
  292. </div>
  293. </div>
  294. </div>
  295. </footer>
  296. <!-- End Footer -->
  297. <!-- Begin Mobile Menu -->
  298. <div class="mobile-main-menu">
  299. <div class="container-fluid">
  300. <div class="container">
  301. <div class="mobile-main-menu-header-container">
  302. <a class="header-logo" href="https://catalyst-team.com/" aria-label="Catalyst"></a>
  303. <a class="main-menu-close-button" href="#" data-behavior="close-mobile-menu"></a>
  304. </div>
  305. </div>
  306. </div>
  307. <div class="mobile-main-menu-links-container">
  308. <div class="main-menu">
  309. <ul>
  310. <li>
  311. <a href="">Get Started</a>
  312. </li>
  313. <li>
  314. <a href="https://github.com/catalyst-team/catalyst">Github</a>
  315. </li>
  316. </ul>
  317. </div>
  318. </div>
  319. </div>
  320. <!-- End Mobile Menu -->
  321. <script type="text/javascript" src="_static/js/vendor/anchor.min.js"></script>
  322. <script type="text/javascript">
  323. $(document).ready(function() {
  324. mobileMenu.bind();
  325. mobileTOC.bind();
  326. catalystAnchors.bind();
  327. sideMenus.bind();
  328. scrollToAnchor.bind();
  329. highlightNavigation.bind();
  330. mainMenuDropdown.bind();
  331. // Add class to links that have code blocks, since we cannot create links in code blocks
  332. $("article.catalyst-article a span.pre").each(function(e) {
  333. $(this).closest("a").addClass("has-code");
  334. });
  335. })
  336. </script>
  337. </body>
  338. </html>