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

WIP, TST: add 32-bit support #2346

Closed
wants to merge 4 commits into from
Closed

WIP, TST: add 32-bit support #2346

wants to merge 4 commits into from

Conversation

tylerjereddy
Copy link
Member

Fixes #2342

Currently WIP, with my fork feature branch fix_32bit reducing total failures to 137 from around 1000 or so. I will first aim to add 32-bit testing to CI.

I'm currently stuck trying to get the testsuite/MDAnalysisTests/core/test_wrap.py tests passing--some of the C++ stuff in _cutil.pyx is not friendly for Python maintainers...

Anyway, will aim to get the large number of 32 bit test failures reproduced in CI here for demo purposes, then will try pushing in the WIP improvements to drop the fail count down...

@codecov
Copy link

codecov bot commented Sep 8, 2019

Codecov Report

Merging #2346 into develop will decrease coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2346      +/-   ##
===========================================
- Coverage    89.89%   89.87%   -0.03%     
===========================================
  Files          173      173              
  Lines        21784    21784              
  Branches      2861     2861              
===========================================
- Hits         19583    19578       -5     
- Misses        1609     1613       +4     
- Partials       592      593       +1
Impacted Files Coverage Δ
package/MDAnalysis/core/groups.py 98.28% <100%> (ø) ⬆️
package/MDAnalysis/lib/distances.py 97.46% <100%> (ø) ⬆️
package/MDAnalysis/coordinates/TRJ.py 94.04% <0%> (-0.78%) ⬇️
package/MDAnalysis/lib/util.py 88.18% <0%> (-0.3%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1b0e65...5a071e6. Read the comment docs.

@tylerjereddy
Copy link
Member Author

tylerjereddy commented Sep 8, 2019

Initial Azure CI output confirms 32-bit testing with failures related to buffer dtype mismatches as one might expect, with

= 1085 failed, 14289 passed, 84 skipped, 2 xfailed, 2 xpassed, 27795 warnings, 27 error in 758.51s (0:12:38) =

I'll now push in some of the WIP improvements from my feature branch to demonstrate better results. I should also improve our test code line to produce xml output for the summary, but that can wait for now.

@tylerjereddy
Copy link
Member Author

Ok, the improved results are now clearly visible in 32-bit Azure CI run:

= 137 failed, 15264 passed, 84 skipped, 2 xfailed, 2 xpassed, 27939 warnings in 695.13s (0:11:35) =

@zemanj may be able to help for some of the testsuite/MDAnalysisTests/core/test_wrap.py failures--there's an awful lot of integer typing in _cutil.pyx

I'll try to take a look at some other failures as time permits...

@richardjgowers
Copy link
Member

richardjgowers commented Sep 8, 2019 via email

@tylerjereddy
Copy link
Member Author

Pushed in some more fixes -- CI should hopefully confirm the new result I get locally for full test suite:

= 89 failed, 15312 passed, 84 skipped, 2 xfailed, 2 xpassed, 27935 warnings in 535.94s (0:08:55) =

Copy link
Member

@zemanj zemanj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using ndarray.astype(), it would be cool if you made use of the copy kwarg, i.e., use array.astype(np.int64, copy=False) to avoid unnecessary copy operations.

Related idea:
Since we're often dealing with numpy.intp types which correspond to the C99 type ptrdiff_t (platform-dependent 32 or 64 bit integers), we might think about having separate unique_int32_1d(), unique_int64_1d(), and unique_intp_1d() functions in lib._cutil.
Or, much more convenient: Is it possible to somehow realize a template-based implementation of unique_int_1d() for the different integer types? I don't recall right now how well templates work with cython...

Also related to this issue: IMHO we generally need to consolidate integer types in MDA. For example, we use numpy.intp for atom indices but numpy.int32 for bond indices.
I don't mean that we should change that but we should have proper centralized type definitions for these kind of things instead of having types hard-coded all over the place. I think numpy is a good example in that respect.

@richardjgowers
Copy link
Member

richardjgowers commented Sep 12, 2019 via email

Copy link
Member

@richardjgowers richardjgowers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if we have a lot of astype calls it's going to slow down everything, so it's probably better to have things in the correct dtype to begin with (like I tried & failed with in #2352). I don't think we've ever had a user actually require a 32 bit build, it's just downstream maintainers, so I'm not sure it's worth having a slower path that (maybe) later gets fixed.

@tylerjereddy
Copy link
Member Author

How much is the slow down in practice? Without benchmarks we're just speculating I think. It may be modest.

@tylerjereddy
Copy link
Member Author

I think a top-level / initialization variable could be used to detect if you're on a 32-bit platform & if not the astype calls can all be no-ops that return the same type.

This was referenced May 22, 2020
@lilyminium lilyminium mentioned this pull request May 23, 2020
This was referenced May 24, 2020
@tylerjereddy
Copy link
Member Author

Superseded by #2696, so closing. We might want to extract the addition of the 32-bit Linux test to CI from here though.

@RMeli RMeli deleted the azure-32bit branch December 23, 2023 21:57
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.

Tests on i686: ValueError: Buffer dtype mismatch, expected 'int64_t' but got 'int'
3 participants