The ParaMonte Documentation Website
Current view: top level - kernel - SpecBase_MpiFinalizeRequested_mod.f90 (source / functions) Hit Total Coverage
Test: ParaMonte 1.5.1 :: Coarray Parallel Kernel - Code Coverage Report Lines: 10 10 100.0 %
Date: 2021-01-08 12:59:07 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       2             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       3             : !!!!
       4             : !!!!   MIT License
       5             : !!!!
       6             : !!!!   ParaMonte: plain powerful parallel Monte Carlo library.
       7             : !!!!
       8             : !!!!   Copyright (C) 2012-present, The Computational Data Science Lab
       9             : !!!!
      10             : !!!!   This file is part of the ParaMonte library.
      11             : !!!!
      12             : !!!!   Permission is hereby granted, free of charge, to any person obtaining a 
      13             : !!!!   copy of this software and associated documentation files (the "Software"), 
      14             : !!!!   to deal in the Software without restriction, including without limitation 
      15             : !!!!   the rights to use, copy, modify, merge, publish, distribute, sublicense, 
      16             : !!!!   and/or sell copies of the Software, and to permit persons to whom the 
      17             : !!!!   Software is furnished to do so, subject to the following conditions:
      18             : !!!!
      19             : !!!!   The above copyright notice and this permission notice shall be 
      20             : !!!!   included in all copies or substantial portions of the Software.
      21             : !!!!
      22             : !!!!   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
      23             : !!!!   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
      24             : !!!!   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
      25             : !!!!   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
      26             : !!!!   DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
      27             : !!!!   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
      28             : !!!!   OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
      29             : !!!!
      30             : !!!!   ACKNOWLEDGMENT
      31             : !!!!
      32             : !!!!   ParaMonte is an honor-ware and its currency is acknowledgment and citations.
      33             : !!!!   As per the ParaMonte library license agreement terms, if you use any parts of 
      34             : !!!!   this library for any purposes, kindly acknowledge the use of ParaMonte in your 
      35             : !!!!   work (education/research/industry/development/...) by citing the ParaMonte 
      36             : !!!!   library as described on this page:
      37             : !!!!
      38             : !!!!       https://github.com/cdslaborg/paramonte/blob/main/ACKNOWLEDGMENT.md
      39             : !!!!
      40             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      41             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      42             : 
      43             : !> \brief
      44             : !> This module contains the classes and procedures for setting up the `mpiFinalizeRequested` attribute of ParaMonte samplers.
      45             : !> For more information, see the description of this attribute in the body of the module.
      46             : !> \author Amir Shahmoradi
      47             : 
      48             : module SpecBase_MpiFinalizeRequested_mod
      49             : 
      50             :     implicit none
      51             : 
      52             :     ! namelist input
      53             :     logical                         :: mpiFinalizeRequested
      54             : 
      55             :     type                            :: MpiFinalizeRequested_type
      56             :         logical                     :: val
      57             :         logical                     :: def
      58             :         character(:), allocatable   :: desc
      59             :     contains
      60             :         procedure, pass             :: set => setMpiFinalizeRequested, nullifyNameListVar
      61             :     end type MpiFinalizeRequested_type
      62             : 
      63             :     interface MpiFinalizeRequested_type
      64             :         module procedure            :: constructMpiFinalizeRequested
      65             :     end interface MpiFinalizeRequested_type
      66             : 
      67             :     private :: constructMpiFinalizeRequested, setMpiFinalizeRequested
      68             : 
      69             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      70             : 
      71             : contains
      72             : 
      73             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      74             : 
      75        1047 :     function constructMpiFinalizeRequested(methodName) result(MpiFinalizeRequestedObj)
      76             : #if INTEL_COMPILER_ENABLED && defined DLL_ENABLED && (OS_IS_WINDOWS || defined OS_IS_DARWIN)
      77             :         !DEC$ ATTRIBUTES DLLEXPORT :: constructMpiFinalizeRequested
      78             : #endif
      79             :         use String_mod, only: log2str
      80             :         implicit none
      81             :         character(*), intent(in)        :: methodName
      82             :         type(MpiFinalizeRequested_type) :: MpiFinalizeRequestedObj
      83        1047 :         MpiFinalizeRequestedObj%def = .true.
      84             :         MpiFinalizeRequestedObj%desc = &
      85             :         "In parallel " // methodName // " simulations via MPI communication libraries, &
      86             :         &if mpiFinalizeRequested = true (or T, both case-insensitive), then a call will be made to the MPI_Finalize() routine &
      87             :         &from inside " // methodName // " at the end of the simulation to finalize the MPI communications. Set this variable to &
      88             :         &false (or f, both case-insensitive) if you do not want " // methodName // " to finalize the MPI communications for you. &
      89             :         &This is a low-level simulation specification variable, relevant to simulations that directly involve MPI parallelism. &
      90             :         &If you do not have any MPI-routine calls in your main program, you can safely ignore this variable with its default value. &
      91             :         &Note that in non-MPI-enabled simulations, such as serial and Coarray-enabled simulations, the value of &
      92        1047 :         &this variable is completely ignored. The default value is " // log2str(MpiFinalizeRequestedObj%def) // "."
      93        1047 :     end function constructMpiFinalizeRequested
      94             : 
      95             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      96             : 
      97        1047 :     subroutine nullifyNameListVar(MpiFinalizeRequestedObj)
      98             : #if INTEL_COMPILER_ENABLED && defined DLL_ENABLED && (OS_IS_WINDOWS || defined OS_IS_DARWIN)
      99             :         !DEC$ ATTRIBUTES DLLEXPORT :: nullifyNameListVar
     100             : #endif
     101             :         implicit none
     102             :         class(MpiFinalizeRequested_type), intent(in) :: MpiFinalizeRequestedObj
     103        1047 :         mpiFinalizeRequested = MpiFinalizeRequestedObj%def
     104        2094 :     end subroutine nullifyNameListVar
     105             : 
     106             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     107             : 
     108        2088 :     subroutine setMpiFinalizeRequested(MpiFinalizeRequestedObj,mpiFinalizeRequested)
     109             : #if INTEL_COMPILER_ENABLED && defined DLL_ENABLED && (OS_IS_WINDOWS || defined OS_IS_DARWIN)
     110             :         !DEC$ ATTRIBUTES DLLEXPORT :: setMpiFinalizeRequested
     111             : #endif
     112             :         implicit none
     113             :         class(MpiFinalizeRequested_type), intent(inout) :: MpiFinalizeRequestedObj
     114             :         logical, intent(in)                             :: mpiFinalizeRequested
     115        2088 :         MpiFinalizeRequestedObj%val = mpiFinalizeRequested
     116             : 
     117        3135 :     end subroutine setMpiFinalizeRequested
     118             : 
     119             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     120             : 
     121             : end module SpecBase_MpiFinalizeRequested_mod ! LCOV_EXCL_LINE

ParaMonte: Plain Powerful Parallel Monte Carlo Library 
The Computational Data Science Lab
© Copyright 2012 - 2021