Permalink
Browse files

Merge remote-tracking branch 'upstream/master'

  • Loading branch information...
2 parents 80360bd + 070df58 commit 6a8777c96d4eeb91c54aad6cc86bafb5d17b9d0d @adk9 committed Mar 26, 2012
Showing with 43 additions and 11 deletions.
  1. +1 −1 haskell-mpi.cabal
  2. +10 −10 src/Control/Parallel/MPI/Internal.chs
  3. +8 −0 test/OtherTests.hs
  4. +24 −0 test/pbs/job.pbs
View
@@ -1,5 +1,5 @@
name: haskell-mpi
-version: 1.2.0
+version: 1.2.1
cabal-version: >= 1.6
synopsis: Distributed parallel programming in Haskell using MPI.
description:
@@ -1148,7 +1148,7 @@ infoGet' = {# fun unsafe Info_get as infoGet_
Attempt to supply a value that does not fit into 32 bits will cause a
run-time 'error'.
-}
-newtype Rank = MkRank { rankId :: Int -- ^ Extract numeric value of the 'Rank'
+newtype Rank = MkRank { rankId :: CInt -- ^ Extract numeric value of the 'Rank'
}
deriving (Eq, Ord, Enum, Integral, Real)
@@ -1162,9 +1162,9 @@ instance Num Rank where
| x < 0 = error "Negative Rank value"
| otherwise = MkRank (fromIntegral x)
-foreign import ccall "&mpi_any_source" anySource_ :: Ptr Int
-foreign import ccall "&mpi_root" theRoot_ :: Ptr Int
-foreign import ccall "&mpi_proc_null" procNull_ :: Ptr Int
+foreign import ccall "&mpi_any_source" anySource_ :: Ptr CInt
+foreign import ccall "&mpi_root" theRoot_ :: Ptr CInt
+foreign import ccall "&mpi_proc_null" procNull_ :: Ptr CInt
foreign import ccall "&mpi_request_null" requestNull_ :: Ptr MPIRequest
foreign import ccall "&mpi_comm_null" commNull_ :: Ptr MPIComm
@@ -1198,11 +1198,11 @@ instance Show Rank where
-- | Map arbitrary 'Enum' value to 'Rank'
toRank :: Enum a => a -> Rank
-toRank x = MkRank { rankId = fromEnum x }
+toRank x = MkRank { rankId = cIntConv (fromEnum x) }
-- | Map 'Rank' to arbitrary 'Enum'
fromRank :: Enum a => Rank -> a
-fromRank = toEnum . rankId
+fromRank = toEnum . cIntConv . rankId
type MPIRequest = {# type MPI_Request #}
{-| Haskell representation of the @MPI_Request@ type. Returned by
@@ -1260,7 +1260,7 @@ peekCast = peek . castPtr
{-| Haskell datatype that represents values which could be used as
tags for point-to-point transfers.
-}
-newtype Tag = MkTag { tagVal :: Int -- ^ Extract numeric value of the Tag
+newtype Tag = MkTag { tagVal :: CInt -- ^ Extract numeric value of the Tag
}
deriving (Eq, Ord, Enum, Integral, Real)
@@ -1279,13 +1279,13 @@ instance Show Tag where
-- | Map arbitrary 'Enum' value to 'Tag'
toTag :: Enum a => a -> Tag
-toTag x = MkTag { tagVal = fromEnum x }
+toTag x = MkTag { tagVal = cIntConv (fromEnum x) }
-- | Map 'Tag' to arbitrary 'Enum'
fromTag :: Enum a => Tag -> a
-fromTag = toEnum . tagVal
+fromTag = toEnum . cIntConv . tagVal
-foreign import ccall unsafe "&mpi_any_tag" anyTag_ :: Ptr Int
+foreign import ccall unsafe "&mpi_any_tag" anyTag_ :: Ptr CInt
-- | Predefined tag value that allows reception of the messages with
-- arbitrary tag values. Corresponds to @MPI_ANY_TAG@.
View
@@ -22,6 +22,7 @@ otherTests threadSupport _ =
, testCase "queryThread" $ queryThreadTest threadSupport
, testCase "test requestNull" $ testRequestNull
, testCase "Info objects" $ testInfoObjects
+ , testCase "anySource/anySize values" anySourceTagTest
]
queryThreadTest :: ThreadSupport -> IO ()
@@ -104,3 +105,10 @@ testInfoObjects = do
infoDelete i "foo"
v'' <- infoGet i "foo"
v'' == Nothing @? "Key 'foo' was not deleted"
+
+anySourceTagTest :: IO ()
+anySourceTagTest = do
+ if (anySource) == (toEnum (-1)) then return ()
+ else putStrLn ("anySource is not -1, but rather " ++ show anySource)
+ if (anyTag) == (toEnum (-1)) then return ()
+ else putStrLn ("anyTag is not -1, but rather " ++ show anyTag)
View
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# PBS script for running the tests
+
+# Queue for the job:
+#PBS -q batch
+
+# The name of the job:
+#PBS -N test
+
+# Maximum number of CPU cores used by the job:
+#PBS -l procs=2
+
+# The amount of memory in gigabytes per process in the job:
+#PBS -l pvmem=3gb
+
+# The maximum running time of the job in days:hours:mins:secs
+#PBS -l walltime=0:0:10:0
+
+# Run the job from the directory where it was launched:
+cd $PBS_O_WORKDIR
+
+# The job command(s):
+mpirun -np 2 haskell-mpi-testsuite 1>sender.log 2>receiver.log

0 comments on commit 6a8777c

Please sign in to comment.