convertSharingExp error #81

Open
jeannekamikaze opened this Issue Mar 2, 2013 · 3 comments

Projects

None yet

3 participants

@jeannekamikaze

The error:

hterra-demo: 
*** Internal error in package accelerate ***
*** Please submit a bug report at https://github.com/mchakravarty/accelerate/issues
./Data/Array/Accelerate/Trafo/Sharing.hs:403 (convertSharingExp): inconsistent valuation @ shared 'Exp' tree with stable name 353;
  env = [356]

The issues:

  1. The error itself.
  2. The link to github is broken.

The offending code (hopefully this is enough):

type Point2 a = (a,a)
type Noise a b = Exp a -> Exp b

type H a = a
type Lacunarity a = a
type Octaves = Int

fBm :: (RealFrac a, IsFloating a, Ord a, Elt a)
    => Noise (Point2 a) a -- ^ The basis noise function
    -> H a                -- ^ The Hurst exponent, a value between 0 and 1
    -> Lacunarity a       -- ^ The lacunarity or frequency step between successive frequencies
    -> Octaves            -- ^ The number of octaves to add
    -> Noise (Point2 a) a
fBm noise h' l' o' p = A.fold1 (+) vals ! index0 / maxfBm
    where vals   = A.zipWith (*) amps noises
          amps   = A.generate (index1 o)
                 $ \ix -> let (Z:.i) = unlift ix in gain ** A.fromIntegral i
          gain   = l ** (-2*h)
          noises = A.map noise points
          points = A.zipWith scale freqs $ A.fill (index1 o) p
          freqs  = A.generate (index1 o)
                 $ \ix -> let (Z:.i) = unlift ix in l ** A.fromIntegral i
          maxfBm = geom gain (A.fromIntegral o)
          h = constant h'
          l = constant l'
          o = constant o'
@jeannekamikaze

Update: this looks like #63. I'm indexing an array that I generate within that same computation. In fact, (!index0) seems to have the same effect as "the". Still, it would be cool if a more readable error was produced.

@tmcdonell
Member

Yep, you are correct, this is creating nested parallelism. The error message should really mention this possibility.

@mchakravarty
Member

Some errors mention the possibility of nested parallelism. IIRC it is in some cases not easy to determine whether the cause is nested data parallelism or something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment