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

This is the kernel_type class for generating objects with logical components to determine the operating system (OS) kernel and its name. More...

Public Attributes

character(:, SK), allocatable name
 The allocatable scalar of type character of default kind SK, containing the operating system name. More...
 
type(kernelis_typeis
 The scalar object of type kernelis_type containing the logical components indicating the OS. More...
 

Detailed Description

This is the kernel_type class for generating objects with logical components to determine the operating system (OS) kernel and its name.

When an object of this type is generated, a single object component name corresponding to OS name is filled with,

  1. "Windows" if the OS is Windows.
  2. "Cygwin" if the OS is Cygwin.
  3. "MinGW" if the OS is MinGW.
  4. "MSYS" if the OS is MinGW.
  5. "Linux" if the OS is Linux.
  6. "Darwin" if the OS is Darwin.
  7. "FreeBSD" if the OS is FreeBSD.

Otherwise, if the appropriate preprocessing macro is undefined, the type constructor will use the facilities of the runtime shell to infer the Operating System kernel name through either:

  1. the Windows OS environmental variable in Windows-style runtime shells.
  2. the UNIX OSTYPE environmental variable in UNIX-style runtime shells.
  3. the UNIX uname command on unix-style runtime shells.
Warning
The environments "msys", "MinGW", "Cygwin" are not really standalone Operating System kernels, rather Linux compatibility environments within Windows platforms.
As such, when such environments are detected, the windows component of the is component of the object of type kernel_type is always set to .true..
Even though Cygwin and MinGW are considered operating systems independently of Windows
Parameters
[out]failed: The output scalar logical of default kind LK that is .true. if and only if an error occurs while inferring the operating system kernel.
(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 failed is also present. If missing, no error message will be output.)
Returns
kernel : The output scalar object of type kernel_type containing the specifics of the operating system kernel name.


Possible calling interfaces

use pm_kind, only: LK
character(255, SK) :: errmsg
type(kernel_type) :: kernel
logical(LK) :: failed
kernel = kernel_type()
kernel = kernel_type(failed)
kernel = kernel_type(failed, errmsg)
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
This module contains procedures and generic interfaces for inferring the operating system kernel type...
Definition: pm_sysInfo.F90:37
This is the kernel_type class for generating objects with logical components to determine the operati...
Definition: pm_sysInfo.F90:244
See also
getSysInfo
kernel_type
kernelis_type
shell_type
shellis_type
isShellWindows
isShellPosix
isKernelLinux
isKernelDarwin
isKernelWindows


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: kernel_type
6
7 implicit none
8
9 logical(LK) :: failed
10 character(255, SK) :: errmsg
11 type(kernel_type) :: kernel
12
13 type(display_type) :: disp
14 disp = display_type(file = "main.out.F90")
15
16 call disp%skip()
17 call disp%show("kernel = kernel_type()")
18 kernel = kernel_type()
19 call dispkernel()
20 call disp%skip()
21
22 call disp%skip()
23 call disp%show("kernel = kernel_type(failed)")
24 kernel = kernel_type(failed)
25 call disp%show("failed ! Check if any error has occurred.")
26 call disp%show( failed )
27 if (failed) then
28 call disp%show("SK_'error occurred.'")
29 call disp%show( SK_'error occurred.' , deliml = SK_"""" )
30 else
31 call dispkernel()
32 end if
33 call disp%skip()
34
35 call disp%skip()
36 call disp%show("kernel = kernel_type(failed, errmsg)")
37 kernel = kernel_type(failed, errmsg)
38 call disp%show("failed ! Check if any error has occurred.")
39 call disp%show( failed )
40 if (failed) then
41 call disp%show("errmsg")
42 call disp%show( errmsg , deliml = SK_"""" )
43 else
44 call dispkernel()
45 end if
46 call disp%skip()
47
48contains
49
50 subroutine dispkernel()
51#if __INTEL_COMPILER
52#undef linux
53#endif
54 call disp%show("kernel%name")
55 call disp%show( kernel%name , deliml = SK_"""" )
56 call disp%show("kernel%is%windows")
57 call disp%show( kernel%is%windows )
58 call disp%show("kernel%is%cygwin")
59 call disp%show( kernel%is%cygwin )
60 call disp%show("kernel%is%mingw")
61 call disp%show( kernel%is%mingw )
62 call disp%show("kernel%is%msys")
63 call disp%show( kernel%is%msys )
64 call disp%show("kernel%is%linux")
65 call disp%show( kernel%is%linux )
66 call disp%show("kernel%is%darwin")
67 call disp%show( kernel%is%darwin )
68 call disp%show("kernel%is%freebsd")
69 call disp%show( kernel%is%freebsd )
70 end subroutine
71
72end 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
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 IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
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
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
2kernel = kernel_type()
3kernel%name
4"Linux"
5kernel%is%windows
6F
7kernel%is%cygwin
8F
9kernel%is%mingw
10F
11kernel%is%msys
12F
13kernel%is%linux
14T
15kernel%is%darwin
16F
17kernel%is%freebsd
18F
19
20
21kernel = kernel_type(failed)
22failed ! Check if any error has occurred.
23F
24kernel%name
25"Linux"
26kernel%is%windows
27F
28kernel%is%cygwin
29F
30kernel%is%mingw
31F
32kernel%is%msys
33F
34kernel%is%linux
35T
36kernel%is%darwin
37F
38kernel%is%freebsd
39F
40
41
42kernel = kernel_type(failed, errmsg)
43failed ! Check if any error has occurred.
44F
45kernel%name
46"Linux"
47kernel%is%windows
48F
49kernel%is%cygwin
50F
51kernel%is%mingw
52F
53kernel%is%msys
54F
55kernel%is%linux
56T
57kernel%is%darwin
58F
59kernel%is%freebsd
60F
61
62


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:50 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas Austin

Definition at line 244 of file pm_sysInfo.F90.

Member Data Documentation

◆ is

type(kernelis_type) pm_sysInfo::kernel_type::is

The scalar object of type kernelis_type containing the logical components indicating the OS.

Definition at line 246 of file pm_sysInfo.F90.

◆ name

character(:, SK), allocatable pm_sysInfo::kernel_type::name

The allocatable scalar of type character of default kind SK, containing the operating system name.

Definition at line 245 of file pm_sysInfo.F90.


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