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.)
haskell plot gpu gnuplot
user328062 Feb 04 '14 at 21:13 2014-02-04 21:13
source share