Skip to content

Instantly share code, notes, and snippets.

@gramian
Created February 7, 2019 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gramian/3bc06a63cfdc7e400aefe1278caf1980 to your computer and use it in GitHub Desktop.
Save gramian/3bc06a63cfdc7e400aefe1278caf1980 to your computer and use it in GitHub Desktop.
Clone of Julia's versioninfo for Octave and MATLAB on Linux
function v = versioninfo()
%%% project: versioninfo (clone of Julia's versioninfo for Octave and MATLAB)
%%% version: 1.0 ( 2019-02-07 )
%%% authors: C. Himpe ( 0000-0003-2194-6754 )
%%% license: BSD 2-Clause License ( opensource.org/licenses/BSD-2-Clause )
%%% summary: Collect compute environment and version information on Linux
% Interpreter name
if(exist('OCTAVE_VERSION','builtin'))
v.name = 'OCTAVE';
else
v.name = 'MATLAB';
end
% Interpreter version
v.ver = version();
% Operating system
[s,o] = system('cat /etc/os-release | grep "PRETTY_NAME="');
v.os = strtrim(o(14:end-2));
% System word width
[s,c] = system('uname -m');
v.arch = strtrim(c);
% Basic hardware info
[s,p] = system('cat /proc/cpuinfo | grep "model name" | head -1');
y = find(p==':');
v.cpu = strtrim(p(y(1)+1:end-1));
[s,m] = system('cat /proc/meminfo | grep "MemTotal" | head -1');
y = find(m==':');
v.mem = strtrim(m(y(1)+1:end-1));
% BLAS / LAPACK library backends
v.blas = version('-blas');
v.lapack = version('-lapack');
% Toolboxes
v.pkg = ver();
if(nargout==0)
fprintf('\n');
fprintf(' Interpreter: %s\n',v.name);
fprintf(' Version: %s\n',v.ver);
fprintf(' System: %s\n',v.os);
fprintf(' Architecture: %s\n',v.arch);
fprintf(' Processor: %s\n',v.cpu);
fprintf(' Memory: %s\n',v.mem);
fprintf(' BLAS: %s\n',v.blas);
fprintf(' LAPACK: %s\n',v.lapack);
fprintf('\n');
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment