fix int type usage#1391
Conversation
This fixes ERRORs and FAILs in the testsuite on 32bit:
TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
and
assert_(out[0].dtype == np.int64)
File "/usr/lib/python2.7/site-packages/numpy/testing/utils.py", line 92, in assert_
raise AssertionError(smsg)
AssertionError
|
I'm also wondering if MDAnalysis/core/groups.py:2739 should be changed to |
|
@rathann do you know of a way of testing if this is robust to run on 32bit using a 64bit travis machine? |
|
Maybe follow the recipe in travis-ci/travis-ci#5770 and use a docker image with a 32 bit chroot for testing on travis? |
|
And obspy/obspy#1580 was apparently a successful attempt to Enable 32bit linux on travis CI without docker, just using compat 32 bit libs and the 32-bit miniconda. And they use Python 2.7 and 3.5. |
|
According to numpy/numpy#4384 (comment),
This seems to imply that we ought to be using it everywhere instead of |
Not everywhere, only for array indexing. And no, I'm not replacing all. Just those that made the tests fail. I'm not familiar with the codebase. |
|
I've made a new PR which extends this a little with some tests. I've changed all the arrays we use for indexing to use |
Issue #1362 : use np.intp types for indexing instead of np.int64 - According to numpy/numpy#4384 (comment), `np.intp` is the recommended dtype for indexing: "... use np.intp as dtype whenever things have to do with indexing or are logically related to indexing/array sizes. This is the natural dtype for it and it will normally also be the fastest one. - see https://docs.scipy.org/doc/numpy/user/basics.types.html - see also PR #1391 for discussion - This change should go some way towards increasing compatibility with i386/i696 (32 bit) platforms. NOTE: No dedicated testing on 32 bit yet (see WIP PR #1392 )
Fixes part of #1362 .
Changes made in this Pull Request:
PR Checklist