Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-12 Thread Robert Kern
On Mon, Oct 12, 2020 at 10:50 AM Hongyi Zhao wrote: > On Mon, Oct 12, 2020 at 10:41 PM Andrea Gavana > wrote: > > > That is not what I meant: what I meant is: write the time consuming part > of your code in C or Fortran and then bridge it to Python using Cython or > f2py. > > I understand your m

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-12 Thread Hongyi Zhao
On Mon, Oct 12, 2020 at 10:41 PM Andrea Gavana wrote: > > Hi, > > On Mon, 12 Oct 2020 at 16.22, Hongyi Zhao wrote: >> >> On Mon, Oct 12, 2020 at 9:33 PM Andrea Gavana >> wrote: >> > >> > Hi, >> > >> > On Mon, 12 Oct 2020 at 14:38, Hongyi Zhao wrote: >> >> >> >> On Sun, Oct 11, 2020 at 3:42 PM

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-12 Thread Andrea Gavana
Hi, On Mon, 12 Oct 2020 at 16.22, Hongyi Zhao wrote: > On Mon, Oct 12, 2020 at 9:33 PM Andrea Gavana > wrote: > > > > Hi, > > > > On Mon, 12 Oct 2020 at 14:38, Hongyi Zhao wrote: > >> > >> On Sun, Oct 11, 2020 at 3:42 PM Evgeni Burovski > >> wrote: > >> > > >> > On Sun, Oct 11, 2020 at 9:55 A

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-12 Thread Hongyi Zhao
On Mon, Oct 12, 2020 at 9:33 PM Andrea Gavana wrote: > > Hi, > > On Mon, 12 Oct 2020 at 14:38, Hongyi Zhao wrote: >> >> On Sun, Oct 11, 2020 at 3:42 PM Evgeni Burovski >> wrote: >> > >> > On Sun, Oct 11, 2020 at 9:55 AM Evgeni Burovski >> > wrote: >> > > >> > > The script seems to be computing

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-12 Thread Andrea Gavana
Hi, On Mon, 12 Oct 2020 at 14:38, Hongyi Zhao wrote: > On Sun, Oct 11, 2020 at 3:42 PM Evgeni Burovski > wrote: > > > > On Sun, Oct 11, 2020 at 9:55 AM Evgeni Burovski > > wrote: > > > > > > The script seems to be computing the particle numbers for an array of > chemical potentials. > > > > >

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-12 Thread Hongyi Zhao
On Sun, Oct 11, 2020 at 3:42 PM Evgeni Burovski wrote: > > On Sun, Oct 11, 2020 at 9:55 AM Evgeni Burovski > wrote: > > > > The script seems to be computing the particle numbers for an array of > > chemical potentials. > > > > Two ways of speeding it up, both are likely simpler then using dask:

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-11 Thread Hongyi Zhao
On Sun, Oct 11, 2020 at 2:56 PM Evgeni Burovski wrote: > > The script seems to be computing the particle numbers for an array of > chemical potentials. > > Two ways of speeding it up, both are likely simpler then using dask: > > First: use numpy > > 1. Move constructing mu_all out of the loop (np

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-11 Thread Evgeni Burovski
Just remove %%timeit пн, 12 окт. 2020 г., 5:56 Hongyi Zhao : > On Sun, Oct 11, 2020 at 3:42 PM Evgeni Burovski > wrote: > > > > On Sun, Oct 11, 2020 at 9:55 AM Evgeni Burovski > > wrote: > > > > > > The script seems to be computing the particle numbers for an array of > chemical potentials. > >

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-11 Thread Hongyi Zhao
On Sun, Oct 11, 2020 at 3:42 PM Evgeni Burovski wrote: > > On Sun, Oct 11, 2020 at 9:55 AM Evgeni Burovski > wrote: > > > > The script seems to be computing the particle numbers for an array of > > chemical potentials. > > > > Two ways of speeding it up, both are likely simpler then using dask:

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-11 Thread Evgeni Burovski
вс, 11 окт. 2020 г., 13:31 Hongyi Zhao : > On Sun, Oct 11, 2020 at 3:42 PM Evgeni Burovski > wrote: > > > > On Sun, Oct 11, 2020 at 9:55 AM Evgeni Burovski > > wrote: > > > > > > The script seems to be computing the particle numbers for an array of > chemical potentials. > > > > > > Two ways of

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-11 Thread Hongyi Zhao
On Sun, Oct 11, 2020 at 3:42 PM Evgeni Burovski wrote: > > On Sun, Oct 11, 2020 at 9:55 AM Evgeni Burovski > wrote: > > > > The script seems to be computing the particle numbers for an array of > > chemical potentials. > > > > Two ways of speeding it up, both are likely simpler then using dask:

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-11 Thread Hongyi Zhao
On Sun, Oct 11, 2020 at 2:56 PM Evgeni Burovski wrote: > > The script seems to be computing the particle numbers for an array of > chemical potentials. > > Two ways of speeding it up, both are likely simpler then using dask: What do you mean by saying *dask*? > > First: use numpy > > 1. Move co

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-11 Thread Evgeni Burovski
On Sun, Oct 11, 2020 at 9:55 AM Evgeni Burovski wrote: > > The script seems to be computing the particle numbers for an array of > chemical potentials. > > Two ways of speeding it up, both are likely simpler then using dask: > > First: use numpy > > 1. Move constructing mu_all out of the loop (np

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-10 Thread Evgeni Burovski
The script seems to be computing the particle numbers for an array of chemical potentials. Two ways of speeding it up, both are likely simpler then using dask: First: use numpy 1. Move constructing mu_all out of the loop (np.linspace) 2. Arrange the integrands into a 2d array 3. np.trapz along a

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-10 Thread Hongyi Zhao
On Sun, Oct 11, 2020 at 2:02 PM Andrea Gavana wrote: > > > > On Sun, 11 Oct 2020 at 07.52, Hongyi Zhao wrote: >> >> On Sun, Oct 11, 2020 at 1:33 PM Andrea Gavana >> wrote: >> > >> > >> > >> > On Sun, 11 Oct 2020 at 07.14, Andrea Gavana >> > wrote: >> >> >> >> Hi, >> >> >> >> On Sun, 11 Oct 20

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-10 Thread Andrea Gavana
On Sun, 11 Oct 2020 at 07.52, Hongyi Zhao wrote: > On Sun, Oct 11, 2020 at 1:33 PM Andrea Gavana > wrote: > > > > > > > > On Sun, 11 Oct 2020 at 07.14, Andrea Gavana > wrote: > >> > >> Hi, > >> > >> On Sun, 11 Oct 2020 at 00.27, Hongyi Zhao > wrote: > >>> > >>> On Sun, Oct 11, 2020 at 1:48 AM

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-10 Thread Hongyi Zhao
On Sun, Oct 11, 2020 at 1:33 PM Andrea Gavana wrote: > > > > On Sun, 11 Oct 2020 at 07.14, Andrea Gavana wrote: >> >> Hi, >> >> On Sun, 11 Oct 2020 at 00.27, Hongyi Zhao wrote: >>> >>> On Sun, Oct 11, 2020 at 1:48 AM Robert Kern wrote: >>> > >>> > You don't need to use vectorize() on fermi(). f

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-10 Thread Andrea Gavana
On Sun, 11 Oct 2020 at 07.14, Andrea Gavana wrote: > Hi, > > On Sun, 11 Oct 2020 at 00.27, Hongyi Zhao wrote: > >> On Sun, Oct 11, 2020 at 1:48 AM Robert Kern >> wrote: >> > >> > You don't need to use vectorize() on fermi(). fermi() will work just >> fine on arrays and should be much faster. >>

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-10 Thread Andrea Gavana
Hi, On Sun, 11 Oct 2020 at 00.27, Hongyi Zhao wrote: > On Sun, Oct 11, 2020 at 1:48 AM Robert Kern wrote: > > > > You don't need to use vectorize() on fermi(). fermi() will work just > fine on arrays and should be much faster. > > Yes, it really does the trick. See the following for the benchma

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-10 Thread Hongyi Zhao
On Sun, Oct 11, 2020 at 1:48 AM Robert Kern wrote: > > You don't need to use vectorize() on fermi(). fermi() will work just fine on > arrays and should be much faster. Yes, it really does the trick. See the following for the benchmark based on your suggestion: $ time python mu.py [-10.999 -10.9

Re: [Numpy-discussion] The mu.py script will keep running and never end.

2020-10-10 Thread Robert Kern
You don't need to use vectorize() on fermi(). fermi() will work just fine on arrays and should be much faster. On Sat, Oct 10, 2020, 8:23 AM Hongyi Zhao wrote: > Hi, > > My environment is Ubuntu 20.04 and python 3.8.3 managed by pyenv. I > try to run the script > < > https://notebook.rcc.uchicag