File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 11%% CHECKRAM estimate if RAM will fit a new array
22% checks that requested memory for the new array won't exceed AVAILABLE RAM with Matlab
33%
4+ % %% Inputs
5+ % * newSize: vector of array per-dimension lengths
6+ % * myclass: name of class
7+ % %% Outputs
8+ % * OK: logical if array is predicted to fit in RAM
9+ % * newSizeBytes: estimated array memory usage
10+ % * freebytes: current free RAM (before allocating array)
11+ %
412% This script is optimistic as Matlab won't always be able to
513% create an array using ALL available RAM, but at least you know when you
614% certainly CAN'T create an array without digging deep into swap or worse.
715
16+
817function [OK ,newSizeBytes ,freebytes ] = checkRAM(newSize , myclass )
9- arguments
10- newSize (1 ,: ) {mustBeNumeric }
11- myclass
12- end
1318
1419% get available RAM
1520freebytes = stdlib .ram_free();
Original file line number Diff line number Diff line change 77% * b: backend used
88
99function [i , b ] = get_uid(backend )
10- arguments
11- backend (1 ,: ) string = [" dotnet" , " python" , " perl" ]
10+ if nargin < 1
11+ backend = [" dotnet" , " python" , " perl" ];
12+ else
13+ backend = string(backend );
1214end
1315
1416i = [];
You can’t perform that action at this time.
0 commit comments