Browse files

Remove unportable "status" and "count" fields from Status. Use "getCo…

…unt" instead.
  • Loading branch information...
1 parent 0b01cb8 commit 8d5005326871456dac9c4094e802315536bbf3cc @adept committed Nov 3, 2011
Showing with 1 addition and 27 deletions.
  1. +0 −25 src/Control/Parallel/MPI/Internal.chs
  2. +1 −1 test/OtherTests.hs
  3. +0 −1 test/TestHelpers.hs
View
25 src/Control/Parallel/MPI/Internal.chs
@@ -1172,18 +1172,11 @@ blanking out freshly allocated memory, so beware!
-}
-- | Haskell structure that holds fields of @MPI_Status@.
---
--- Please note that MPI report lists only three fields as mandatory:
--- @status_source@, @status_tag@ and @status_error@. However, all
--- MPI implementations that were used to test those bindings supported
--- extended set of fields represented here.
data Status =
Status
{ status_source :: Rank -- ^ rank of the source process
, status_tag :: Tag -- ^ tag assigned at source
, status_error :: CInt -- ^ error code, if any
- , status_count :: CInt -- ^ number of received elements, if applicable
- , status_cancelled :: Bool -- ^ whether the request was cancelled
}
deriving (Eq, Ord, Show)
@@ -1197,28 +1190,10 @@ instance Storable Status where
<$> liftM (MkRank . cIntConv) ({#get MPI_Status->MPI_SOURCE #} p)
<*> liftM (MkTag . cIntConv) ({#get MPI_Status->MPI_TAG #} p)
<*> liftM cIntConv ({#get MPI_Status->MPI_ERROR #} p)
-#ifdef MPICH2
- -- MPICH2 and OpenMPI use different names for the status struct
- -- fields-
- <*> liftM cIntConv ({#get MPI_Status->count #} p)
- <*> liftM cToEnum ({#get MPI_Status->cancelled #} p)
-#else
- <*> liftM cIntConv ({#get MPI_Status->_count #} p)
- <*> liftM cToEnum ({#get MPI_Status->_cancelled #} p)
-#endif
poke p x = do
{#set MPI_Status.MPI_SOURCE #} p (fromRank $ status_source x)
{#set MPI_Status.MPI_TAG #} p (fromTag $ status_tag x)
{#set MPI_Status.MPI_ERROR #} p (cIntConv $ status_error x)
-#ifdef MPICH2
- -- MPICH2 and OpenMPI use different names for the status struct
- -- fields AND different order of fields
- {#set MPI_Status.count #} p (cIntConv $ status_count x)
- {#set MPI_Status.cancelled #} p (cFromEnum $ status_cancelled x)
-#else
- {#set MPI_Status._count #} p (cIntConv $ status_count x)
- {#set MPI_Status._cancelled #} p (cFromEnum $ status_cancelled x)
-#endif
-- NOTE: Int here is picked arbitrary
allocaCast f =
View
2 test/OtherTests.hs
@@ -34,7 +34,7 @@ queryThreadTest threadSupport = do
statusPeekPoke :: IO ()
statusPeekPoke = do
alloca $ \statusPtr -> do
- let s0 = Status (fromIntegral (maxBound::CInt)) 2 3 maxBound True
+ let s0 = Status (fromIntegral (maxBound::CInt)) 2 3
poke statusPtr s0
s1 <- peek statusPtr
s0 == s1 @? ("Poked " ++ show s0 ++ ", but peeked " ++ show s1)
View
1 test/TestHelpers.hs
@@ -31,7 +31,6 @@ checkStatus :: Status -> Rank -> Tag -> IO ()
checkStatus _status src tag = do
status_source _status == src @? "Wrong source in status: expected " ++ show src ++ ", but got " ++ show (status_source _status)
status_tag _status == tag @? "Wrong tag in status: expected " ++ show tag ++ ", but got " ++ show (status_tag _status)
- not (status_cancelled _status) @? "Status says \"cancelled\""
-- Error status is not checked since MPI implementation does not have to set it to 0 if there were no error
-- status_error _status == 0 @? "Non-zero error code: " ++ show (status_error _status)

0 comments on commit 8d50053

Please sign in to comment.