Skip to content

Commit cbb3e83

Browse files
Reduce accuracy test default host memory limit
1 parent 7a8c475 commit cbb3e83

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

clients/tests/gtest_main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,9 @@ int main(int argc, char* argv[])
339339
"Logical size of input buffer.")
340340
("osize", po::value<std::vector<size_t>>(&manual_params.osize)->multitoken(),
341341
"Logical size of output.")
342-
("R", po::value<size_t>(&ramgb)->default_value((start_memory.total_bytes + ONE_GiB - 1) / ONE_GiB), "Ram limit in GiB for tests.")
342+
("R", po::value<size_t>(&ramgb)->default_value((static_cast<size_t>(start_memory.total_bytes * system_memory::percentage_usable_memory)
343+
+ ONE_GiB - 1)
344+
/ ONE_GiB), "Ram limit in GiB for tests.")
343345
("V", po::value<size_t>(&vramgb)->default_value(0), "vram limit in GiB for tests.")
344346
("half_epsilon", po::value<double>(&half_epsilon)->default_value(9.77e-4))
345347
("single_epsilon", po::value<double>(&single_epsilon)->default_value(3.75e-5))

shared/accuracy_test.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ struct system_memory
7070
{
7171
size_t total_bytes = 0;
7272
size_t free_bytes = 0;
73+
// Limits the amount of memory used throught the tests.
74+
// Test RAM limit is: total_bytes * percentage_usable_memory.
75+
// If the test system has little swap space (or there are many
76+
// other processes running concurrently) and we are too
77+
// aggressive with host memory usage, then the test process
78+
// may get OOM killed.
79+
static constexpr double percentage_usable_memory = .85;
7380
};
7481
extern system_memory start_memory;
7582

0 commit comments

Comments
 (0)