<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, 25 Jun 2015 at 02:57 Eric Snow <<a href="mailto:ericsnowcurrently@gmail.com">ericsnowcurrently@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, Jun 24, 2015 at 10:28 AM, Sturla Molden <<a href="mailto:sturla.molden@gmail.com" target="_blank">sturla.molden@gmail.com</a>> wrote:<br>
> The reality is that Python is used on even the largest supercomputers. The<br>
> scalability problem that is seen on those systems is not the GIL, but the<br>
> module import. If we have 1000 CPython processes importing modules like<br>
> NumPy simultaneously, they will do a "denial of service attack" on the file<br>
> system. This happens when the module importer generates a huge number of<br>
> failed open() calls while trying to locate the module files.<br>
><br>
> There is even described in a paper on how to avoid this on an IBM Blue<br>
> Brain: "As an example, on Blue Gene P just starting up Python and importing<br>
> NumPy and GPAW with 32768 MPI tasks can take 45 minutes!"<br>
<br>
I'm curious what difference there is under Python 3.4 (or even 3.3).<br>
Along with being almost entirely pure Python, the import system now<br>
has some optimizations that help mitigate filesystem access<br>
(particularly stats).<br></blockquote><div><br></div><div>From the HPC setup that I use there does appear to be some difference. <br></div><div>The number of syscalls required to import numpy is significantly lower with 3.3 than 2.7 in our setup (I don't have 3.4 in there and I didn't compile either of these myself):<br><br>$ strace python3.3 -c "import numpy" 2>&1 | egrep -c '(open|stat)'<br>1315<br>$ strace python2.7 -c "import numpy" 2>&1 | egrep -c '(open|stat)'<br>4444<br><br></div><div>It doesn't make any perceptible difference when running "time python -c 'import numpy'" on the login node. I'm not going to request 1000 cores in order to test the difference properly. Also note that profiling in these setups is often complicated by the other concurrent users of the system.<br></div><div><br>--<br></div><div>Oscar<br></div></div></div>