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 failed = failed ~= 0;
40 if failed
41 error ( newline ...
42 + "Failed to detect the processor architecture via" + newline ...
43 + "the MATLAB intrinsic call `system('uname -m'): " + newline ...
44 + newline ...
45 + pm.io.arch + strtrim(str) + newline ...
46 + newline ...
47 )
48 end
49 elseif ispc
50 [~, str] = system("echo %PROCESSOR_ARCHITECTURE%");
51 else
52 error ( newline ...
53 + "Unrecognized operating system for MATLAB." + newline ...
54 + "This is impossible, unless we live in the distant future." + newline ...
55 + newline ...
56 );
57 end
58 strLower = lower(strtrim(str));
59 if contains(strLower, "arm64")
60 str = "arm64";
61 elseif contains(strLower, "amd64") || contains(strLower, "x86_64")
62 str = "amd64";
63 else
64 warning ( newline ...
65 + "Unrecognized unsupported processor architecture" + newline ...
66 + "for the ParaMonte MATLAB library: " + newline ...
67 + newline ...
68 + pm.io.tab() + strtrim(str) + newline ...
69 + newline ...
70 );
71 end
72 %str = computer('arch');
73end
function name(in vendor)
Return the MPI library name as used in naming the ParaMonte MATLAB shared library directories.
function arch()
Return the processor architecture name of the current system on which MATLAB is running,...
function detect(in vendor)
Return the MPI image count and current image ID (e.g., MPI rank + 1) and the MPI library name as it a...
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...