The Data Parallel Haskell example from the Haskell Wiki won't work

Hello dear Haskell People! I'm currently very interested in doing some parallel programming in Haskell, specially in using the Data Parallel Haskell stuff... So as a first step I tried to emulate the vector multiply example found in the Haskell Wiki: http://www.haskell.org/haskellwiki/GHC/Data_Parallel_Haskell#A_simple_exampl... The code I've written (two files) for this example is in the following pastebins: DPHVecMul.hs: http://paste.org/pastebin/view/22899 Main.hs: http://paste.org/pastebin/view/22900 I've compiled successfully both files and linked them, exactly as described in the Wiki. But when I run the resulting executable, the following error shows up: "dotp: Prelude.undefined" It's seems (from the tests I've done) that the call to the function *fromPArrayP *of the module *Data.Parallel.Array.Prelude *results always in undefined. In fact, I've taken a look at the function definition in the docs, and in fact it always returns undefined. It doesn't make ANY SENSE to me :P Has someone been able to successfully compile and run this example code?? If so, what am I doing wrong? Is there some obvious error I'm incurring in? :D Regards, João Paulo Pizani Flor joaopizani@gmail.com Computer Science - 2007/1 Federal University of Santa Catarina - Brazil

Well, it seems that my problem is solved. I copied again the whole example,
this time literally (Ctrl-C, Ctrl-V), and it just worked.
Problem is, I still don't know what went wrong with my previous attempt :P
Anyways, thanks!
João Paulo Pizani Flor
joaopizani@gmail.com
Ciência da Computação - 2007/1
Universidade Federal de Santa Catarina
2010/9/27 João Paulo Pizani Flor
Hello dear Haskell People! I'm currently very interested in doing some parallel programming in Haskell, specially in using the Data Parallel Haskell stuff...
So as a first step I tried to emulate the vector multiply example found in the Haskell Wiki: http://www.haskell.org/haskellwiki/GHC/Data_Parallel_Haskell#A_simple_exampl...
The code I've written (two files) for this example is in the following pastebins:
DPHVecMul.hs: http://paste.org/pastebin/view/22899 Main.hs: http://paste.org/pastebin/view/22900
I've compiled successfully both files and linked them, exactly as described in the Wiki. But when I run the resulting executable, the following error shows up:
"dotp: Prelude.undefined"
It's seems (from the tests I've done) that the call to the function *fromPArrayP *of the module *Data.Parallel.Array.Prelude *results always in undefined. In fact, I've taken a look at the function definition in the docs, and in fact it always returns undefined. It doesn't make ANY SENSE to me :P
Has someone been able to successfully compile and run this example code?? If so, what am I doing wrong? Is there some obvious error I'm incurring in? :D
Regards,
João Paulo Pizani Flor joaopizani@gmail.com Computer Science - 2007/1 Federal University of Santa Catarina - Brazil

On 27/09/2010, at 10:06 , João Paulo Pizani Flor wrote:
The code I've written (two files) for this example is in the following pastebins:
DPHVecMul.hs: http://paste.org/pastebin/view/22899 Main.hs: http://paste.org/pastebin/view/22900
I've compiled successfully both files and linked them, exactly as described in the Wiki. But when I run the resulting executable, the following error shows up:
"dotp: Prelude.undefined"
It's seems (from the tests I've done) that the call to the function fromPArrayP of the module Data.Parallel.Array.Prelude results always in undefined. In fact, I've taken a look at the function definition in the docs, and in fact it always returns undefined. It doesn't make ANY SENSE to me :P
Has someone been able to successfully compile and run this example code?? If so, what am I doing wrong? Is there some obvious error I'm incurring in? :D
It's because you didn't add {-# OPTIONS -fvectorise #-} when compiling the DPHVectMul.hs module. The GHC vectoriser rewrites calls to fromPArrayP to the real implementations in its back-end library, but if the vectoriser doesn't run you get the default implementation which is just "undefined". I agree its an atrocious error message. It should have a real one in the head / GHC 7.0 Ben.

Has someone been able to successfully compile and run this example code?? If so, what am I doing wrong? Is there some obvious error I'm incurring in? :D
It's because you didn't add {-# OPTIONS -fvectorise #-} when compiling the DPHVectMul.hs module. The GHC vectoriser rewrites calls to fromPArrayP to the real implementations in its back-end library, but if the vectoriser doesn't run you get the default implementation which is just "undefined". I agree its an atrocious error message. It should have a real one in the head / GHC 7.0
You can also add -fvectorise on the command line, but I prefer using the OPTIONS pragma because it's less easy to forget. Ben.

Thanks a lot Ben!
Shame on me, I've really forgotten that PRAGMA line, but now everything
works as it should...
[]s
João Paulo Pizani Flor
joaopizani@gmail.com
Computer Science - 2007
Federal University of Santa Catarina - Brazil
On Wed, Sep 29, 2010 at 4:27 AM, Ben Lippmeier
Has someone been able to successfully compile and run this example code?? If so, what am I doing wrong? Is there some obvious error I'm incurring in? :D
It's because you didn't add {-# OPTIONS -fvectorise #-} when compiling the DPHVectMul.hs module. The GHC vectoriser rewrites calls to fromPArrayP to the real implementations in its back-end library, but if the vectoriser doesn't run you get the default implementation which is just "undefined". I agree its an atrocious error message. It should have a real one in the head / GHC 7.0
You can also add -fvectorise on the command line, but I prefer using the OPTIONS pragma because it's less easy to forget.
Ben.
participants (2)
-
Ben Lippmeier
-
João Paulo Pizani Flor