    let errClass = cToEnum errClassRaw
    unless (errClass == Success) $ do
       errStr <- errorString code
-      throwIO $ MPIError errClass errStr code
-
+      throwIO $ MPIError errClass errStr
+
+-- | Convert MPI error code human-readable error description. Corresponds to @MPI_Error_string@.
 errorString :: CInt -> IO String
 errorString code =
   allocaBytes (fromIntegral maxErrorString) $ \ptr ->


foreign import ccall unsafe "&mpi_tag_ub" tagUB_ :: Ptr Int

-- | Predefined tag value that allows reception of the messages with
--   arbitrary tag values. Corresponds to @MPI_ANY_TAG@.
tagUpperBound :: Int
tagUpperBound =
  let key = unsafePerformIO (peek tagUB_) 
      in fromMaybe 0 $ unsafePerformIO (commGetAttr commWorld key)

-- | Return the rank of the calling process for the given communicator.


{# enum ThreadSupport {underscoreToCase} deriving (Eq,Ord,Show) #}

-- | Value thrown as exception when MPI runtime is instructed to pass
--   errors to user code (via 'commSetErrhandler' and 'errorsReturn').
-- Since raw MPI errors codes are not standartized and not portable,
-- they are not exposed.
data MPIError
   = MPIError
     { mpiErrorClass :: ErrorClass -- ^ Broad class of errors this one belongs to
     , mpiErrorString :: String -- ^ Human-readable error description
     }
   deriving (Eq, Show, Typeable)

