Python: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 127: Line 127:


<!--T:69-->
<!--T:69-->
Whenever we provide a wheel for a given package, we strongly recommend to use it by way of the <code>--no-index</code> option. Compared to using packages from PyPI, wheels that have been compiled by our staff can prevent issues with missing or conflicting dependencies, and were optimised for our clusters hardware and libraries. See [[#Available_wheels|Available wheels]].
Whenever we provide a wheel for a given package, we strongly recommend to use it by way of the <code>--no-index</code> option. Compared to using packages from PyPI, wheels that have been compiled by our staff can prevent issues with missing or conflicting dependencies, and were optimized for our clusters hardware and libraries. See [[#Available_wheels|Available wheels]].


<!--T:34-->
<!--T:34-->
Line 365: Line 365:
# Then, when installing, use the path for file <code>pip install tensorboardX-1.9-py2.py3-none-any.whl</code>.
# Then, when installing, use the path for file <code>pip install tensorboardX-1.9-py2.py3-none-any.whl</code>.


== Parallel programming with the Python <tt>multiprocessing</tt> module == <!--T:45-->
== Parallel programming with the Python <code>multiprocessing</code> module == <!--T:45-->


<!--T:67-->
<!--T:67-->
Doing parallel programming with Python can be an easy way to get results faster. An usual way of doing so is to use the [https://sebastianraschka.com/Articles/2014_multiprocessing.html <tt>multiprocessing</tt>] module. Of particular interest is the <tt>Pool</tt> class of this module, since it allows one to control the number of processes started in parallel, and apply the same calculation to multiple data. As an example, suppose we want to calculate the <tt>cube</tt> of a list of numbers. The serial code would look like this :  
Doing parallel programming with Python can be an easy way to get results faster. An usual way of doing so is to use the [https://sebastianraschka.com/Articles/2014_multiprocessing.html <code>multiprocessing</code>] module. Of particular interest is the <code>Pool</code> class of this module, since it allows one to control the number of processes started in parallel, and apply the same calculation to multiple data. As an example, suppose we want to calculate the <code>cube</code> of a list of numbers. The serial code would look like this :  
<tabs>
<tabs>
<tab name="Using a loop">
<tab name="Using a loop">
rsnt_translations
56,420

edits