Haskell Array.Accelerate - forkOS error

Trying to build the output of some of the calculations of Data.Array.Accelerate with gnuplot , I ran into some strange problem. When launched through the interpreter, everything is fine, as it builds direct Haskell data or simply prints Accelerate values, however, an attempt to create Accelerate data is not performed. The above error forkOS_entry: interrupted .

Since then, I realized that I just had to be more UNIXy and do one (good) thing in every program. But I am curious to find out why this fails. I include a minimal code example below.

 import Prelude hiding (zip,zipWith) import Graphics.Gnuplot.Simple import Data.Array.Accelerate -- import Data.Array.Accelerate.Interpreter import Data.Array.Accelerate.CUDA f :: Vector Float -> Vector Float -> Acc (Vector Float) f xs ys = let xs' = use xs ys' = use ys in (zipWith (*) xs' ys') n=10::Int points = toList.run $ f (fromList (Z:.n) [1..10]) (fromList (Z:.n) [-5..4]) main = plotList [] points 

update 2014/09/11

Based on user2141650 suggestion (thanks!) That changed the last line to

 plotList [] $! points 

fixes the problem. In fact, this makes the plot actually appear, whereas without it the program would end with or without an error, but would never display a graph. I suppose I would take this as an answer if it were written, but it would be nice to know what was going on.

Perhaps related:

  • forkOS_entry: aborted error: what is it?

(By the way, please stop trying to edit the grammar. There is nothing wrong with the question, as it is, I am a native speaker and I write exactly what I mean. Thanks for your input.)

+71
haskell plot gpu gnuplot
Feb 04 '14 at 21:13
source share
1 answer

As I mentioned in the commentary, this is most likely due to the alternation of gnuplot interaction and acceleration on the GPU, when the calculation of acceleration is called lazy. I can’t say that I know the details, but this [0] seems relevant. Gnuplot may not be able to use the GPU, since Accelerate has already announced this, but Accelerate will not release it until the full evaluation. Or that gnuplot claims the GPU is up to speed. A hairy issue, and this may require mention in the github tracker for speed.

[0] https://github.com/AccelerateHS/accelerate/issues/48

+1
Sep 12 '14 at 9:05
source share



All Articles