Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test newer Numpy versions #66

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Test newer Numpy versions #66

wants to merge 8 commits into from

Conversation

JulienPeloton
Copy link
Owner

Test #65

@coveralls
Copy link

Coverage Status

Coverage: 85.988% (-0.01%) from 86.0% when pulling 93e287c on issue/65/py39 into 979db49 on master.

@JulienPeloton
Copy link
Owner Author

JulienPeloton commented Jan 2, 2023

Summary:

Python Numpy Comment
3.7 1.21.5 Tests pass
3.9 1.21.5 Tests pass
3.9 1.22.4 Fail with error
3.9 1.23.5 Fail with error (but at a different place from above)
3.9 1.24 Fail with error (np.int is no more available, but f2py errors appear later)

It seems that 1.22 introduced changes (see e.g. numpy/numpy#20853 or numpy/numpy#21256). Looking at the latest documentation, the interface also changed a bit, especially with the keyword dimension. I will dig into.

@JulienPeloton
Copy link
Owner Author

@gfabbian -- as a temporary fix, you can still use numpy 1.21 with python 3.9 ;-)

@JulienPeloton
Copy link
Owner Author

JulienPeloton commented Jan 2, 2023

If I look at the signature files generated with numpy 1.21 or 1.22, here is the difference:

# do it with different version of numpy
python -m numpy.f2py tod_f.f90 -m tod -h tod_numpy21.pyf
(base) peloton@peloton:~/codes/s4cmb/s4cmb$ diff tod_numpy21.pyf tod_numpy22.pyf 
16,19c16,19
<                 integer(kind=4) dimension(npix*nt),intent(in),depend(npix,nt) :: waferi1d
<                 real(kind=8) dimension(npix*nt-1+1),intent(in),depend(npix,nt) :: waferpa
<                 real(kind=8) dimension(npix*nt*2-1+1),intent(in),depend(npix,nt) :: waferts
<                 real(kind=8) dimension(npix),intent(in) :: diff_weight
---
>                 integer(kind=4) dimension(npix * nt),intent(in) :: waferi1d
>                 real(kind=8) dimension(npix * nt),intent(in),depend(nt,npix) :: waferpa
>                 real(kind=8) dimension(2 * npix * nt),intent(in),depend(nt,npix) :: waferts
>                 real(kind=8) dimension(npix),intent(in),depend(npix) :: diff_weight
21,24c21,24
<                 integer(kind=4), optional,intent(in),check(len(diff_weight)>=npix),depend(diff_weight) :: npix=len(diff_weight)
<                 integer(kind=4) intent(in) :: nt
<                 integer(kind=4) dimension(npix*nt-1+1),intent(in),depend(npix,nt) :: wafermask_pixel
<                 integer(kind=4), optional,intent(in),check(len(d)>=nskypix),depend(d) :: nskypix=len(d)
---
>                 integer(kind=4), optional,intent(in),check(shape(waferi1d, 0) == npix * nt),depend(waferi1d,nt) :: npix=shape(waferi1d, 0) / nt
>                 integer(kind=4), optional,intent(in),check(shape(waferi1d, 0) == npix * nt),depend(waferi1d,npix) :: nt=shape(waferi1d, 0) / npix
>                 integer(kind=4) dimension(npix * nt),intent(in),depend(nt,npix) :: wafermask_pixel
>                 integer(kind=4), optional,intent(in),check(shape(d, 0) == nskypix),depend(d) :: nskypix=shape(d, 0)
39,42c39,42
<                 integer(kind=4) dimension(npix*nt-1+1),intent(in),depend(npix,nt) :: waferi1d
<                 real(kind=8) dimension(npix*nt-1+1),intent(in),depend(npix,nt) :: waferpa
<                 real(kind=8) dimension(npix*nt*2-1+1),intent(in),depend(npix,nt) :: waferts
<                 real(kind=8) dimension(npix),intent(in) :: diff_weight
---
>                 integer(kind=4) dimension(npix * nt),intent(in) :: waferi1d
>                 real(kind=8) dimension(npix * nt),intent(in),depend(nt,npix) :: waferpa
>                 real(kind=8) dimension(2 * npix * nt),intent(in),depend(nt,npix) :: waferts
>                 real(kind=8) dimension(npix),intent(in),depend(npix) :: diff_weight
44,47c44,47
<                 integer(kind=4), optional,intent(in),check(len(diff_weight)>=npix),depend(diff_weight) :: npix=len(diff_weight)
<                 integer(kind=4) intent(in) :: nt
<                 integer(kind=4) dimension(npix*nt-1+1),intent(in),depend(npix,nt) :: wafermask_pixel
<                 integer(kind=4), optional,intent(in),check(len(d)>=nskypix),depend(d) :: nskypix=len(d)
---
>                 integer(kind=4), optional,intent(in),check(shape(waferi1d, 0) == npix * nt),depend(waferi1d,nt) :: npix=shape(waferi1d, 0) / nt
>                 integer(kind=4), optional,intent(in),check(shape(waferi1d, 0) == npix * nt),depend(waferi1d,npix) :: nt=shape(waferi1d, 0) / npix
>                 integer(kind=4) dimension(npix * nt),intent(in),depend(nt,npix) :: wafermask_pixel
>                 integer(kind=4), optional,intent(in),check(shape(d, 0) == nskypix),depend(d) :: nskypix=shape(d, 0)
56,59c56,59
<                 integer(kind=4) dimension(npix*nt-1+1),intent(in),depend(npix,nt) :: waferi1d
<                 real(kind=8) dimension(npix*nt-1+1),intent(in),depend(npix,nt) :: waferpa
<                 real(kind=8) dimension(npix*nt*3*2-1+1),intent(in),depend(npix,nt) :: waferts
<                 real(kind=8) dimension(npix),intent(in) :: weight4
---
>                 integer(kind=4) dimension(npix * nt),intent(in) :: waferi1d
>                 real(kind=8) dimension(npix * nt),intent(in),depend(nt,npix) :: waferpa
>                 real(kind=8) dimension(6 * npix * nt),intent(in),depend(nt,npix) :: waferts
>                 real(kind=8) dimension(npix),intent(in),depend(npix) :: weight4
61,64c61,64
<                 integer(kind=4), optional,intent(in),check(len(weight4)>=npix),depend(weight4) :: npix=len(weight4)
<                 integer(kind=4) intent(in) :: nt
<                 integer(kind=4) dimension(npix*nt-1+1),intent(in),depend(npix,nt) :: wafermask_pixel
<                 integer(kind=4), optional,intent(in),check(len(d0)>=nskypix),depend(d0) :: nskypix=len(d0)
---
>                 integer(kind=4), optional,intent(in),check(shape(waferi1d, 0) == npix * nt),depend(waferi1d,nt) :: npix=shape(waferi1d, 0) / nt
>                 integer(kind=4), optional,intent(in),check(shape(waferi1d, 0) == npix * nt),depend(waferi1d,npix) :: nt=shape(waferi1d, 0) / npix
>                 integer(kind=4) dimension(npix * nt),intent(in),depend(nt,npix) :: wafermask_pixel
>                 integer(kind=4), optional,intent(in),check(shape(d0, 0) == nskypix),depend(d0) :: nskypix=shape(d0, 0)
70,71c70,72
< ! This file was auto-generated with f2py (version:1.21.5).
< ! See http://cens.ioc.ee/projects/f2py2e/
---
> ! This file was auto-generated with f2py (version:1.22.4).
> ! See:
> ! https://web.archive.org/web/20140822061353/http://cens.ioc.ee/projects/f2py2e

We can see that the dependency checks have disappeared in numpy 1.22 (green)! See also numpy/numpy#21892

@JulienPeloton
Copy link
Owner Author

Hum, there seems to be an error with the fortran constructor. If I write:

- tod2map_pair_f(d, w, dc, ds, cc, cs, ss, nhit, waferi1d, &
-    waferpa, waferts, diff_weight, sum_weight, npix, nt, &
-    wafermask_pixel, nskypix)
+ tod2map_pair_f(d, w, dc, ds, cc, cs, ss, nhit, waferi1d, &
+    waferpa, waferts, diff_weight, sum_weight, nt, &
+    wafermask_pixel, npix nskypix)

no more error (but the result is wrong...). To be continued...

@JulienPeloton JulienPeloton changed the title Test newer Python versions Test newer Numpy versions Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants