ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
arch.m
Go to the documentation of this file.
1%> \brief
2%> Return the processor architecture name of
3%> the current system on which MATLAB is running,
4%> which is also supported by the ParaMonte MATLAB library.<br>
5%>
6%> \return
7%> ``str`` : The output scalar MATLAB string containing the processor architecture.<br>
8%> The output value can be either:<br>
9%> <ol>
10%> <li> ``"arm64"`` : This can be currently true only if the OS is Darwin.<br>
11%> <li> ``"amd64"`` : This can be currently true for either Darwin, Linux, or Windows.<br>
12%> </ol>
13%>
14%> \interface{arch}
15%> \code{.m}
16%>
17%> str = pm.sys.arch()
18%>
19%> \endcode
20%>
21%> \note
22%> If the function cannot detect any of the above,
23%> the system-returned value will be output as is.<br>
24%>
25%> \example{arch}
26%> \include{lineno} example/sys/arch/main.m
27%> \output{arch}
28%> \include{lineno} example/sys/arch/main.out.m
29%>
30%> \final{arch}
31%>
32%> \author
33%> \JoshuaOsborne, May 21 2024, 5:34 AM, University of Texas at Arlington<br>
34%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
35%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
36function str = arch()
37 if isunix
38 [failed, str] = system("uname -m");
39 if failed
40 error ( newline ...
41 + "Failed to detect the processor architecture via" + newline ...
42 + "the MATLAB intrinsic call `system('uname -m'): " + newline ...
43 + newline ...
44 + pm.io.arch + strtrim(str) + newline ...
45 + newline ...
46 )
47 end
48 elseif ispc
49 [~, str] = system("echo %PROCESSOR_ARCHITECTURE%");
50 else
51 error ( newline ...
52 + "Unrecognized operating system for MATLAB." + newline ...
53 + "This is impossible, unless we live in the distant future." + newline ...
54 + newline ...
55 );
56 end
57 strLower = lower(strtrim(str));
58 if contains(strLower, "arm64")
59 str = "arm64";
60 elseif contains(strLower, "amd64") || contains(strLower, "x86_64")
61 str = "amd64";
62 else
63 warning ( newline ...
64 + "Unrecognized unsupported processor architecture" + newline ...
65 + "for the ParaMonte MATLAB library: " + newline ...
66 + newline ...
67 + pm.io.tab() + strtrim(str) + newline ...
68 + newline ...
69 );
70 end
71 %str = computer('arch');
72end
function name(in vendor)
Return the MPI library name as used in naming the ParaMonte MATLAB shared libraries.
function arch()
Return the processor architecture name of the current system on which MATLAB is running,...
function tab()
Return a scalar MATLAB string containing 4 blank characters equivalent to a tab character.
function which(in vendor)
Return the a MATLAB string containing the path to the first mpiexec executable binary found in system...