-
Notifications
You must be signed in to change notification settings - Fork 200
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
Memory allocation failed error when running 'cargo test' #343
Comments
I made it much further, but failed on another test (Ubuntu 16.04)
|
Interesting, @vsoch . My system is running Linux Mint 20 and has 8GB RAM. Running top shows that there's some memory available. What are the specifications for your machine? |
Ok, both of our machines should have enough memory to run a few tests. I think that there is an issue with memory allocation somewhere, but I'm not sure exactly where. If you have time, @vsoch you could try running the tests without other major programs running, just to see if that makes a difference. I think that there will still be an allocation issue somewhere along the line. I understand that memory management in Rust primarily depends on the current scope, so I don't know exactly why the tests are trying to allocate so much memory at once. I will take a look at the test suite later today to see what I can find. Does anyone else know why these tests could be running into these memory issues? |
When rerunning the tests, I find that every time the tests fail, the test fails to allocate the same amount of memory, 2147483640 bytes, every time it runs, even though the test output will stop at different points. For me, the test will always fail right after either test_interleave_gaps_x or test_interleave_gaps_y. Looking at the status of top in another window shows that the program will go up to 4g worth of memory, then stop. |
Is it possible to narrow down the location of the error and check if it still happens when |
Running by themselves: $ cargo test test_interleave_gaps_x
Finished test [unoptimized + debuginfo] target(s) in 0.20s
Running target/debug/deps/bio-364865763329b4a8
running 2 tests
test stats::pairhmm::pairhmm::tests::test_interleave_gaps_x ... ok
test stats::pairhmm::homopolypairhmm::tests::test_interleave_gaps_x ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 343 filtered out
Running target/debug/deps/mod-2eda39cc1fbd9701
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out and
Ok - I just tested running tests with my chrome open (failed at same point) and closed (all finished successfully), but that doesn't tell us any new information. :) |
Hmm, when I set the number of jobs (CPU) to use, it started working for me, and now I can't get it to fail again. This worked for me (success with chrome open) $ cargo test --jobs 8 and my machine has $ nproc
8 I tested from 2 to 8. And now the regular test command is no longer failing either! |
@vsoch I am now experiencing something similar. When I run the tests using: |
When running the tests again with several other programs open, the tests will fail again as before. This is true even when running: @vsoch did you happen to try testing with a bunch of other programs open? @Daniel-Liu-c0deb0t what does running the tests look like on your machine? |
My initial failure had two firefox windows (with many tabs open) plus Audacity, later I just had the browsers. Now I just opened audacity again and it's still working! lol. The bug that got away... |
For me, all tests pass with just I don't think compilation or optimization is the issue here. I guess if you want to check, you can use I think the real problem here is why the test is trying to allocate ~2GB of memory, as @joshwilding4444 mentioned. I see that the memory usage spikes up to ~5GB during the tests. I went through a few possibilities based on when the memory usage spiked, and believe the |
It's neither the tests fault nor a bug in the algorithm. The problem here is that a transition table is pre-allocated (and pre-computed) with 2147483640 entries of size 8, i.e. An easy "fix": since most transitions are 0 anyways, use a sparse datastructure (which supports indexing) instead. Ultimately, it's a problem of striking a balance between memory consumption and cpu time, I guess. Edit: Only ~80 or so transitions are actually used, so, whoops, 268435455 is a bit overkill 😆 |
Ah, I see. Glad to see this fixed. |
When running the current master branch as of Aug 31, 2020, when I run the tests using:
$ cargo test
I receive the following error:
The failure to allocate memory happens at the test_interleave_gaps_y or at test_interleave_gaps_x within stats::pairhmm::homopolypairhmm::tests. This same error happens if I run all tests or if I just run the tests in stats.
Has anyone else experienced this problem when trying to run tests for the latest build?
The text was updated successfully, but these errors were encountered: