Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6975805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:24:57+00:00 2026-05-27T17:24:57+00:00

Graphics is one of those embarrassingly parallel problems. Haskell is supposed to be really,

  • 0

Graphics is one of those “embarrassingly parallel” problems. Haskell is supposed to be really, really good for parallel processing. So my question is:

  1. What is the best way to throw as many CPU cores as possible at a rendering problem?

  2. Is it possible to get the GPU to do the task instead?

By “rendering problem”, I mean problems such as:

  • Each pixel’s colour is a pure function of its coordinates.

  • We start with an existing “input” image, and each “output” pixel’s colour is a pure function of the corresponding input pixel, or maybe a small neighbourhood of such pixels.


Regarding #1: This looks like it’s trivial, but actually it isn’t. There are several possible choices of data structure to store the computed pixels in (which influences how you can access it, and how easily you can dump the result onto disk or screen). There are several ways to execute on multiple cores. And so on.

It seems to me that Data Parallel Haskell would be an ideal choice for this type of thing. However, last time I checked, DPH doesn’t work yet. So that’s that. Even assuming it did work, you would presumably create a parallel array to hold the pixels, and then you’d have to copy the pixels to display them on screen or write them to disk.

I would try sparking every single pixel, but that’s probably far too fine-grained. I could make the pixels a list and use one of the parallel list strategies. Or I could make it an (unboxed?) immutable array and write some manual code to start sparks. Or I could go with explicit threads and mutable arrays. Or I could have a bunch of worker threads them stream pixel values through a channel to a master thread that puts the results into the right place. Or…

In summary, there are a surprising number of possibilities here, and I’m not sure which is best.


Regarding #2: Obviously this type of problem is the entire reason that GPUs exist in the first place. Clearly the GPU is ideally suited to attacking these kinds of problems. My question is more “is it hard to do this from Haskell?”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:24:58+00:00Added an answer on May 27, 2026 at 5:24 pm

    If you are amenable to mixing languages, then OpenCL is very versatile. Although the OpenCL language is very close to being C (so definitely not Haskell), you can write your kernel code in a more or less functional style and think of it as mapping that kernel over spatial coordinates. An advantage of doing things with a mainstream parallel programming framework like OpenCL is that you can lean on the growing volume of knowledge both HPC and graphics folks have amassed over the years across many application domains. Retargeting between the CPU and GPU is mostly painless, but you will need to be aware of considerations about data types (e.g. some GPUs don’t support double precision).

    I wrote a tutorial on calling into OpenCL from Haskell. It rests upon the relatively new OpenCL bindings (there are several OpenCL bindings on hackage, I can not attest to their relative quality).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

One of the advantages of Flash/Flex is that you can use vector graphics (SVG),
Here's the situation: We have some generic graphics code that we use for one
Graphics and audio editing and processing software often contain functions called High-Pass Filter and
This is a bit more of a fun question than a serious one, but
Answers should compare the best possible methods/libraries for drawing/animating the vector graphics on both
I need good word-wrapping handling for Java. Not too difficult, except for one wrinkle:
Could someone tell me why one of my graphics (blue) doesn't show on the
could any one suggest me the way to show multiple images in tab of
What graphics toolkit is used for the Window's Google Talk application?
What graphics library is used to create the graphics in the Solitaire and Freecell

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.