 universeSize c =
   commGetAttr c universeSizeKey
 
-foreign import ccall unsafe "&mpi_universe_size" universeSize_ :: Ptr Int
+foreign import ccall unsafe "&mpi_universe_size" universeSize_ :: Ptr CInt
 
 -- | Numeric key for recommended MPI communicator attribute @MPI_UNIVERSE_SIZE@.
 -- To be used with 'commGetAttr'.
 universeSizeKey :: Int
-universeSizeKey = unsafePerformIO (peek universeSize_)
+universeSizeKey = unsafePerformIO (peekIntConv universeSize_)
 
 -- | Return the rank of the calling process for the given
 -- communicator. If it is an intercommunicator, returns rank of the

-- When called before 'init' or 'initThread' would return 0.
tagUpperBound :: Int
tagUpperBound =
  let key = unsafePerformIO (peek tagUB_)
      in fromMaybe 0 $ unsafePerformIO (commGetAttr commWorld key)

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

{- | True if clocks at all processes in
'commWorld' are synchronized, False otherwise. The expectation is that

commSpawnSimple rank program maxprocs =
  commSpawn program argvNull maxprocs infoNull rank commSelf errcodesIgnore

foreign import ccall "&mpi_undefined" mpiUndefined_ :: Ptr CInt

-- | Predefined constant that might be returned as @Rank@ by calls
--  like 'groupTranslateRanks'. Corresponds to @MPI_UNDEFINED@. Please
--  refer to \"MPI Report Constant And Predefined Handle Index\" for a
--  list of situations where @mpiUndefined@ could appear.
mpiUndefined :: Int
mpiUndefined = unsafePerformIO $ peekIntConv mpiUndefined_

-- | Return the number of bytes used to store an MPI @Datatype@.
typeSize :: Datatype -> Int
