ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_sysInfo::getSysInfo Interface Reference

Generate and return a string containing a comprehensive report of the operating system and platform specifications. More...

Detailed Description

Generate and return a string containing a comprehensive report of the operating system and platform specifications.

The system information is obtained by first identifying the operating system and the runtime shell and then calling one of the following platform/shell-specific commands:

  1. The commands uname -a + sysctl -a | grep machdep.cpu + system_profiler SPHardwareDataType on Darwin (macOS) platforms.
  2. The commands uname -a + lscpu + cat /proc/cpuinfo on Linux or other Unix-like platforms.
  3. The commands systeminfo on Windows platforms.
Parameters
[out]failed: The output scalar of type logical of default kind LK, that is .true. if and only if the process of fetching system information fails.
(optional. If missing and a runtime error occurs, the program will halt by calling error stop.)
[in,out]errmsg: The input/output scalar character of default kind SK of arbitrary length type parameter.
If an error occurs, errmsg will be set to a descriptive message about the nature of the runtime error.
A length of LEN_IOMSG characters is likely sufficient to capture most error messages in full.
(optional. It can be present only if the input argument failed is also present.)
Returns
sysInfo : The output allocatable scalar character of default kind SK containing the system information.


Possible calling interfaces

use pm_kind, only: SK
use test_pm_sys, only: getSysInfo
character(:, SK), allocatable :: sysInfo
sysInfo = getSysInfo()
sysInfo = getSysInfo(failed)
sysInfo = getSysInfo(failed, errmsg)
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
Remarks
The procedures under discussion are impure.
See also
getSysInfo
isKernelLinux
isKernelDarwin
isKernelWindows
kernelis_type
kernel_type


Example usage

1program example
2
3 use pm_kind, only: LK, IK, SK
4 use pm_io, only: display_type
5 use pm_sysInfo, only: getSysInfo
6
7 implicit none
8
9 logical(LK) :: failed
10 character(255, SK) :: errmsg
11 character(:, SK), allocatable :: sysinfo
12
13 type(display_type) :: disp
14 disp = display_type(file = "main.out.F90")
15
16 call disp%skip()
17 call disp%show("sysinfo = getSysInfo()")
18 sysinfo = getSysInfo()
19 call disp%show( sysinfo, deliml = SK_"""" )
20 call disp%skip()
21
22 call disp%skip()
23 call disp%show("sysinfo = getSysInfo(failed)")
24 sysinfo = getSysInfo(failed)
25 call disp%show( sysinfo, deliml = SK_"""" )
26 call disp%show("failed ! Check if any error has occurred.")
27 call disp%show( failed )
28 if (failed) then
29 call disp%show("SK_'error occurred.'")
30 call disp%show( SK_'error occurred.' , deliml = SK_"""" )
31 end if
32 call disp%skip()
33
34 call disp%skip()
35 call disp%show("sysinfo = getSysInfo(failed, errmsg)")
36 sysinfo = getSysInfo(failed, errmsg)
37 call disp%show( sysinfo, deliml = SK_"""" )
38 call disp%show("failed ! Check if any error has occurred.")
39 call disp%show( failed )
40 if (failed) then
41 call disp%show("SK_'error occurred: '//trim(errmsg)")
42 call disp%show( SK_'error occurred: '//trim(errmsg) , deliml = SK_"""" )
43 end if
44 call disp%skip()
45
46end program example
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
Generate and return a string containing a comprehensive report of the operating system and platform s...
Definition: pm_sysInfo.F90:425
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
This module contains procedures and generic interfaces for inferring the operating system kernel type...
Definition: pm_sysInfo.F90:37
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2sysinfo = getSysInfo()
3"
4Linux amir 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
5
6Architecture: x86_64
7CPU op-mode(s): 32-bit, 64-bit
8Address sizes: 46 bits physical, 48 bits virtual
9Byte Order: Little Endian
10CPU(s): 24
11On-line CPU(s) list: 0-23
12Vendor ID: GenuineIntel
13Model name: 12th Gen Intel(R) Core(TM) i9-12950HX
14CPU family: 6
15Model: 151
16Thread(s) per core: 2
17Core(s) per socket: 12
18Socket(s): 1
19Stepping: 2
20BogoMIPS: 4991.99
21Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni umip waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize flush_l1d arch_capabilities
22Virtualization: VT-x
23Hypervisor vendor: Microsoft
24Virtualization type: full
25L1d cache: 576 KiB (12 instances)
26L1i cache: 384 KiB (12 instances)
27L2 cache: 15 MiB (12 instances)
28L3 cache: 30 MiB (1 instance)
29Vulnerability Gather data sampling: Not affected
30Vulnerability Itlb multihit: Not affected
31Vulnerability L1tf: Not affected
32Vulnerability Mds: Not affected
33Vulnerability Meltdown: Not affected
34Vulnerability Mmio stale data: Not affected
35Vulnerability Reg file data sampling: Mitigation; Clear Register File
36Vulnerability Retbleed: Mitigation; Enhanced IBRS
37Vulnerability Spec rstack overflow: Not affected
38Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
39Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
40Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
41Vulnerability Srbds: Not affected
42Vulnerability Tsx async abort: Not affected
43"
44
45
46sysinfo = getSysInfo(failed)
47"
48Linux amir 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
49
50Architecture: x86_64
51CPU op-mode(s): 32-bit, 64-bit
52Address sizes: 46 bits physical, 48 bits virtual
53Byte Order: Little Endian
54CPU(s): 24
55On-line CPU(s) list: 0-23
56Vendor ID: GenuineIntel
57Model name: 12th Gen Intel(R) Core(TM) i9-12950HX
58CPU family: 6
59Model: 151
60Thread(s) per core: 2
61Core(s) per socket: 12
62Socket(s): 1
63Stepping: 2
64BogoMIPS: 4991.99
65Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni umip waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize flush_l1d arch_capabilities
66Virtualization: VT-x
67Hypervisor vendor: Microsoft
68Virtualization type: full
69L1d cache: 576 KiB (12 instances)
70L1i cache: 384 KiB (12 instances)
71L2 cache: 15 MiB (12 instances)
72L3 cache: 30 MiB (1 instance)
73Vulnerability Gather data sampling: Not affected
74Vulnerability Itlb multihit: Not affected
75Vulnerability L1tf: Not affected
76Vulnerability Mds: Not affected
77Vulnerability Meltdown: Not affected
78Vulnerability Mmio stale data: Not affected
79Vulnerability Reg file data sampling: Mitigation; Clear Register File
80Vulnerability Retbleed: Mitigation; Enhanced IBRS
81Vulnerability Spec rstack overflow: Not affected
82Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
83Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
84Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
85Vulnerability Srbds: Not affected
86Vulnerability Tsx async abort: Not affected
87"
88failed ! Check if any error has occurred.
89F
90
91
92sysinfo = getSysInfo(failed, errmsg)
93"
94Linux amir 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
95
96Architecture: x86_64
97CPU op-mode(s): 32-bit, 64-bit
98Address sizes: 46 bits physical, 48 bits virtual
99Byte Order: Little Endian
100CPU(s): 24
101On-line CPU(s) list: 0-23
102Vendor ID: GenuineIntel
103Model name: 12th Gen Intel(R) Core(TM) i9-12950HX
104CPU family: 6
105Model: 151
106Thread(s) per core: 2
107Core(s) per socket: 12
108Socket(s): 1
109Stepping: 2
110BogoMIPS: 4991.99
111Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni umip waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize flush_l1d arch_capabilities
112Virtualization: VT-x
113Hypervisor vendor: Microsoft
114Virtualization type: full
115L1d cache: 576 KiB (12 instances)
116L1i cache: 384 KiB (12 instances)
117L2 cache: 15 MiB (12 instances)
118L3 cache: 30 MiB (1 instance)
119Vulnerability Gather data sampling: Not affected
120Vulnerability Itlb multihit: Not affected
121Vulnerability L1tf: Not affected
122Vulnerability Mds: Not affected
123Vulnerability Meltdown: Not affected
124Vulnerability Mmio stale data: Not affected
125Vulnerability Reg file data sampling: Mitigation; Clear Register File
126Vulnerability Retbleed: Mitigation; Enhanced IBRS
127Vulnerability Spec rstack overflow: Not affected
128Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
129Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
130Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
131Vulnerability Srbds: Not affected
132Vulnerability Tsx async abort: Not affected
133"
134failed ! Check if any error has occurred.
135F
136
137
Test:
test_pm_sys
Bug:

Status: Unresolved
Source: Intel LLVM Fortran Compiler ifx version 2025.0.0 20241008
Description: Intel LLVM Fortran Compiler ifx version 2025.0.0 20241008 yields the following segfault error at runtime for using the css_type array constructor syntax.
deallocate the array of origin in a call to intrinsic move_alloc:
--------------------------------------------------------------------------------
!Segmentation violation detected at 2024-11-06 22:46:51 -0600
--------------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : UTF-8
Deployed : false
GNU C Library : 2.35 stable
Graphics Driver : Uninitialized software
Graphics card 1 : 0x1414( 0x1414 ) 0x8e Version 2.0.3.0 (0-0-0)
Graphics card 2 : 0x1414( 0x1414 ) 0x8e Version 2.0.3.0 (0-0-0)
Java Version : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : glnxa64
MATLAB Entitlement ID : 2406435
MATLAB Root : /usr/local/MATLAB/R2023b
MATLAB Version : 23.2.0.2428915 (R2023b) Update 4
OpenGL : software
Operating System : Ubuntu 22.04.4 LTS
Process ID : 24027
Processor ID : x86 Family 6 Model 151 Stepping 2, GenuineIntel
Session Key : 4af1c654-3fca-4695-8780-e5de2107934f
Window System : Microsoft Corporation(12010000), display :0
Fault Count: 1
Abnormal termination:
Segmentation violation
Current Thread: 'MCR 0 interpret' id 23329188607552
Register State(from fault):
RAX = 0000000000000000 RBX = 00001537bffc8ef8
RCX = 0000000000000001 RDX = 0000000000000000
RSP = 00001537bffc8690 RBP = 00001537bffc8710
RSI = 00001537bffc8ef8 RDI = 000002a6db74779d
R8 = 0000000000000000 R9 = 0000000000040002
R10 = 00001537c00d6fe8 R11 = 0000000000000000
R12 = 0000000000000000 R13 = 00000000000004e0
R14 = 0000000000000000 R15 = 00001536dba470f0
RIP = 00001536db95e473 EFL = 0000000000010202
CS = 0033 FS = 0000 GS = 0000
Stack Trace(from fault):
[ 0] 0x00001536db95e473 /home/amir/git/paramonte/bin/libparamonte_matlab_linux_amd64/+pm/lib/linux/amd64/intelllvm2025/debug/shared/heap/serial/nocheck/libparamonte.so+38818931
[ 1] 0x00001536db95f54e /home/amir/git/paramonte/bin/libparamonte_matlab_linux_amd64/+pm/lib/linux/amd64/intelllvm2025/debug/shared/heap/serial/nocheck/libparamonte.so+38823246
[ 2] 0x00001536db95e69e /home/amir/git/paramonte/bin/libparamonte_matlab_linux_amd64/+pm/lib/linux/amd64/intelllvm2025/debug/shared/heap/serial/nocheck/libparamonte.so+38819486
[ 3] 0x00001536da893fbe /home/amir/git/paramonte/bin/libparamonte_matlab_linux_amd64/+pm/lib/linux/amd64/intelllvm2025/debug/shared/heap/serial/nocheck/libparamonte.so+21213118 pm_sysinfo_MP_getsysinfofailedmsg_+00012510
[ 4] 0x00001536da890b31 /home/amir/git/paramonte/bin/libparamonte_matlab_linux_amd64/+pm/lib/linux/amd64/intelllvm2025/debug/shared/heap/serial/nocheck/libparamonte.so+21199665 pm_sysinfo_MP_getsysinfofailed_+00000177
[ 5] 0x00001536d982d6fe /home/amir/git/paramonte/bin/libparamonte_matlab_linux_amd64/+pm/lib/linux/amd64/intelllvm2025/debug/shared/heap/serial/nocheck/libparamonte.so+04015870 pm_sampling_base_rk2_MP_openfiles_+00126718
[ 6] 0x00001536d980c391 /home/amir/git/paramonte/bin/libparamonte_matlab_linux_amd64/+pm/lib/linux/amd64/intelllvm2025/debug/shared/heap/serial/nocheck/libparamonte.so+03879825 pm_sampling_base_rk2_MP_set_+00135649
[ 7] 0x00001536d9902171 /home/amir/git/paramonte/bin/libparamonte_matlab_linux_amd64/+pm/lib/linux/amd64/intelllvm2025/debug/shared/heap/serial/nocheck/libparamonte.so+04886897 pm_sampling_mcmc_rk2_MP_set_+00030945
[ 8] 0x00001536d998e393 /home/amir/git/paramonte/bin/libparamonte_matlab_linux_amd64/+pm/lib/linux/amd64/intelllvm2025/debug/shared/heap/serial/nocheck/libparamonte.so+05460883 pm_sampling_dram_rk2_MP_set_+00037203
[ 9] 0x00001536d9b51923 /home/amir/git/paramonte/bin/libparamonte_matlab_linux_amd64/+pm/lib/linux/amd64/intelllvm2025/debug/shared/heap/serial/nocheck/libparamonte.so+07309603 pm_sampling_MP_geterrparadram_rk2_+00047939
[ 10] 0x00001536d9b43448 /home/amir/git/paramonte/bin/libparamonte_matlab_linux_amd64/+pm/lib/linux/amd64/intelllvm2025/debug/shared/heap/serial/nocheck/libparamonte.so+07251016 runParaDRAMD+00007992
[ 11] 0x00001536f64624a9 /home/amir/git/paramonte/bin/libparamonte_matlab_linux_amd64/+pm/lib/linux/amd64/intelllvm2025/debug/shared/heap/serial/nocheck/pm_sampling.mexa64+00005289 mexFunction+00000537
This module contains procedures and generic interfaces for the ParaMonte library sampler routines.
Definition: pm_sampling.F90:33

Note that ifort can readily compile the above lines of code.

Remedy (as of ParaMonte Library version 2.0.0): Currently, a preprocessor fence is added specifically for Intel compilers that first allocates the vector of type css_type and then assigns the vector elements one by one.
Note that the above segfault error was discovered while testing the MATLAB interface to the ParaMonte library.
However, the nature and cause of the error is entirely contained within the Fortran programming language.


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, Tuesday March 7, 2017, 3:09 AM, ICES, The University of Texas Austin

Definition at line 425 of file pm_sysInfo.F90.


The documentation for this interface was generated from the following file: