Giter Club home page Giter Club logo

Comments (6)

simonmar avatar simonmar commented on May 24, 2024

I forgot the other module:

module PortablePixmap where

data PixMap = Pixmap Integer Integer Int [(Int,Int,Int)]

createPixmap::Integer -> Integer -> Int -> [(Int,Int,Int)] -> PixMap
createPixmap width height max colours = Pixmap width height max colours

instance Show PixMap where
    showsPrec prec (Pixmap x y z rgbs) = showHeader x y z . showRGB rgbs


showHeader::Integer -> Integer -> Int -> ShowS
showHeader x y z    = showString "P6\n" . showBanner .
              shows x . showReturn .
              shows y . showReturn .
              shows z . showReturn

showRGB::[(Int,Int,Int)] ->  ShowS
showRGB []      = id
showRGB ((r,g,b):rest)  = showChar (toEnum r) .
              showChar (toEnum g) .
              showChar (toEnum b) .
              showRGB rest

showSpace  = showChar ' '
showReturn = showChar '\n'

showBanner = showString "# Portable pixmap created by Haskell Program :\n" .
         showString "#\tPortablePixmap.lhs (Jon.Hill 28/5/92)\n"

(this I took from the mandelbrot set generator in nofib, I should probably use Gloss for displaying the image instead)

from accelerate.

tmcdonell avatar tmcdonell commented on May 24, 2024

Strange that I had never run into this before. This should be fixed now, and I added the test to the examples package.
Thanks!

from accelerate.

rrnewton avatar rrnewton commented on May 24, 2024

For reference, here's a link to the new bit of doc:

https://github.com/AccelerateHS/accelerate-cuda/blob/4575f474fa85d15bf48a88a4abb59ec62992d1cf/Data/Array/Accelerate/CUDA.hs#L85

from accelerate.

rrnewton avatar rrnewton commented on May 24, 2024

Would it be a solution to walk the AST (during or before convertAcc) and force all the input arrays, before doing anything with the context?

Wouldn't that be a built-in equivalent of the seq Simon uses above? The Accelerate computation is strict in all the arrays that gets used, so I don't think this approach would force anything that isn't due to be forced anyway.

Shall we keep this issue open until a fix for the underlying issue is found? As Simon pointed out, behavior should not differ from the interpreter.

from accelerate.

tmcdonell avatar tmcdonell commented on May 24, 2024

I think this is actually in relation to #48, but yes, I see your point. If we make the right things strict in the library, the user shouldn't have to deal with adding seq themselves.

from accelerate.

tmcdonell avatar tmcdonell commented on May 24, 2024

this issue was related to finalisers, migrate these comments to #48 which is about seq and dependent computations.

from accelerate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.