Skip to content

Commit 014fb3d

Browse files
committed
add fft benchmarks
1 parent ed256be commit 014fb3d

File tree

4 files changed

+986
-0
lines changed

4 files changed

+986
-0
lines changed

fft/check_ram.m

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
function check_ram(expected_bytes, mem_avail)
2+
arguments
3+
expected_bytes (1,1) {mustBeInteger,mustBePositive}
4+
mem_avail {mustBeScalarOrEmpty} = []
5+
end
6+
7+
if isempty(mem_avail)
8+
m = memory();
9+
mem_avail = m.MaxPossibleArrayBytes; % set available memory to maximum possible
10+
end
11+
12+
% get user set preference for memory limit
13+
s = settings;
14+
ws = s.matlab.desktop.workspace;
15+
16+
% Check if the maximum array size limit is enabled
17+
if ws.ArraySizeLimitEnabled.ActiveValue
18+
limit_bytes = double(ws.ArraySizeLimit.ActiveValue) / 100 * stdlib.ram_total();
19+
else
20+
limit_bytes = inf; % no limit set
21+
end
22+
23+
limit_bytes = min(limit_bytes, mem_avail);
24+
25+
assert(expected_bytes < limit_bytes, "expected array bytes %d too big for memory %d", expected_bytes, mem_avail)
26+
27+
end

0 commit comments

Comments
 (0)