Antoine Latter | 1 Feb 2011 01:34
Picon
Gravatar

Re: Packages all screwed up

On Mon, Jan 31, 2011 at 4:59 PM, Arnaud Bailly <arnaud.oqube <at> gmail.com> wrote:
> Hello,
> I recently tried to upgrade some package (eg. yesod) and it seems
> that, in the process, I screwed up my Haskell packages setup.
> When I am trying to do a simple:
>> ghc --make Crete1941

What command(s) did you issue to "upgrade some packages?"
Were you trying to do a user or global install?

When ghc loads packages, I've had cases where packages in the user db
would shadow packages in the global db, causing *other* packages in
the global db to report as "broken".

Thanks,
Antoine
MattMan | 1 Feb 2011 02:54
Picon
Favicon

Re: Inheritance and Wrappers


<\quote>
Henning Thielemann wrote:
> 
> If all methods of AbGroup can be defined for all Num types - why do you 
> want an AbGroup at all? You could simply write functions with Num 
> constraint.
> 
> 

Well, I'd rather not have to implement (*), abs, etc on every abelian group.

You may be also interested in existing approaches to algebra in Haskell:
   http://www.haskell.org/haskellwiki/Mathematical_prelude_discussion

Yes, in fact I am!  Thanks for the suggestion; it seems "numeric-prelude"
does [most of] the things I want.  Thanks all.
--

-- 
View this message in context: http://haskell.1045720.n5.nabble.com/Inheritance-and-Wrappers-tp3365126p3365555.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
Andy Stewart | 1 Feb 2011 03:22
Picon

Re: plugins and internal error: stg_ap_v_ret

Hi Michael,

plugins use it's own function instead GHC API, so it's easy to break
with new version GHC.

  -- Andy

Michael Snoyman <michael <at> snoyman.com>
writes:

> Hi all,
>
> I'm trying to convert wai-handler-devel to use plugins instead of
> hint, but cannot even get some basic usages to work properly. I've put
> together a minimal example that loads a WAI application from a
> separate file and runs it, but this immediately causes the program to
> crash saying:
>
> loader: internal error: stg_ap_v_ret
>     (GHC version 6.12.3 for i386_unknown_linux)
>     Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
>
> Is this an actual bug in GHC, or am I misusing the plugins package?
>
> The two source files:
>
> MyModule.hs
> {-# LANGUAGE OverloadedStrings #-}
> module MyModule where
>
(Continue reading)

Conrad Parker | 1 Feb 2011 04:42
Favicon
Gravatar

Re: Loading bitmap with xlib

On 31 January 2011 21:40, Francesco Mazzoli <f <at> mazzo.li> wrote:
> Francesco Mazzoli <f <at> mazzo.li> writes:
>
> At the end I gave up and I wrote the function myself:
>
> http://hpaste.org/43464/readbitmapfile
>

cool ... the listed maintainer for the Xlib bindings is
libraries <at> haskell.org. Perhaps you could prepare a patch and send it
there? (does anyone know if there is an actual maintainer?)

Conrad.
Steven Collins | 1 Feb 2011 06:07
Picon

Automatically move cursor focus in split window in haskell-mode in emacs on load (C-c C-l) command?

I'm using haskell-mode-2.8.0 and emacs 22.2.1 on Ubuntu 9.10


The following elisp code works for me to change the focus to the GHCi buffer (window) after the C-c C-l command in Haskell Mode.  Try this in your .emacs file.


(defadvice inferior-haskell-load-file (after change-focus-after-load)
  "Change focus to GHCi window after C-c C-l command"
  (other-window 1))

(ad-activate 'inferior-haskell-load-file)

I have this after the haskell mode configuration section of my .emacs file.

Remeber to go to the Emacs-lisp menu and 'Byte-compile and Load' after adding the above code to your .emacs file.

  To understand what the elisp code is doing you can go to the help menu in emacs, then drill down via 'Search Documentation ' , then 'Find any object by name'.  Which will put you in the mini-buffer.  Type in either defadvice or ad-activate to see the documentation for these functions. If you are a little rusty on elisp this documentation may be a little hard to understand.

  Basically this is what's happening.  The function that is bound to the C-c C-l command is inferior-haskell-load-file.  Which is an elisp function name and part of the elisp haskell mode code.  The defadvice is kind of overloading this function.   We are telling emacs that 'after' executing the 'inferior-haskell-load-file' function,  execute our new function who's name is 'change-focus-after-load'.  The body of our function is just one expression (other-window 1).
  This is the kind of stuff that makes it easy to modify (hack) the functionality of emacs to do what you want.

I hope this helps and enjoy hacking in Haskell
Steven



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Ryan Newton | 1 Feb 2011 06:51
Picon
Favicon

Re: Splittable random numbers

Small update:


I got the first results from the hardware accelerated version on a 3.33 ghz westmere machine.  Right now it does twice as well as the Gladman software version, which is also twice as well as the System.Random stdgen, and 1000 times faster than a the Haskell implementation of AES that I got from the Crypto package:

     How many random numbers can we generate in a second on one thread?
      Cost of rdtsc (ffi call):    84
      Approx getCPUTime calls per second: 209,798
      Approx clock frequency:  3,331,093,772
      First, timing with System.Random interface:
76,811,104 random ints generated [constant zero gen]       
14,482,725 random ints generated [System.Random stdGen]    
    16,061 random ints generated [PureHaskell/reference]   
    32,309 random ints generated [PureHaskell]             
 2,401,893 random ints generated [Gladman inefficient]     
15,980,625 random ints generated [Gladman]                 
 2,329,500 random ints generated [IntelAES inefficient]    
32,383,799 random ints generated [IntelAES]                
      Comparison to C's rand():
71,392,408 random ints generated [rand/store in C loop]    
71,347,778 random ints generated [rand in Haskell loop]    
71,324,158 random ints generated [rand/store in Haskell loop] 

This is what Burton Smith originally thought, that AES based RNG would be pretty fast and even faster with hardware acceleration.

-Ryan



On Mon, Jan 31, 2011 at 1:25 AM, Ryan Newton <newton <at> mit.edu> wrote:
Hi Cafe,

I've included Gladman's efficient, portable C implementation of AES generating random numbers now, and the hardware-accelerated version is working too.  I'm currently seeing higher throughput for even the software based version than the builtin stdGen:


  First, timing with System.Random interface:
     13,051,964 random ints generated [System.Random stdGen]      ~ 252 cycles/int
         15,635 random ints generated [PureHaskell/reference]     ~ 210,763 cycles/int
         31,159 random ints generated [PureHaskell]               ~ 105,757 cycles/int
      2,180,488 random ints generated [Gladman inefficient]       ~ 1,511 cycles/int
     15,015,095 random ints generated [Gladman]                   ~ 219 cycles/int

That seems like a good argument for cryptographic RNGs to me!

I'm having a lot of trouble getting cabal to build/install it successfully.  You can see what I've got there now.  I'd be interested to know if anyone else can build it successfully.  It should work -- but only by building the assembly code into a .so and assuming the build directory is /opt/intel-aes ;-).

I don't have real numbers for the hardware version yet because the Westmere machine I'm logged into is redhat 5.4 and is giving me "GLIBC_2.7 not found" errors.  You can run it for correctness purposes using an emulation tool called sde (software development emulator) that's based on dynamic binary translation.

-Ryan

P.S. Checkout command:
git clone git://github.com/rrnewton/intel-aes.git





On Sat, Jan 29, 2011 at 8:52 AM, Ryan Newton <rrnewton <at> gmail.com> wrote:
perhaps performance? Is this approach less robust with a faster,
non-cryptographic RNG?

Yes, I don't understand that either.  Is there a reason that using a weaker PRNG in this case is WORSE than using it in the non-splitting case?  Is that why there is more of an impetus to use the cryptographic approach in this case?

Anyway, taking for granted that the Burton approach is a useful thing to have implemented, I started developing a package for this stuff -- AES based RNG including both a haskell implementation and wrapping an AESNI-based C one .  I haven't posted it to Hackage yet, but you can find the git repository here:

    https://github.com/rrnewton/intel-aes

If you build with cabal and run the benchmark-intel-aes-rng executable, it will give you a breakdown like this:

    How many random numbers can we generate in a second on one thread?
      Cost of rdtsc (ffi call):    83
      Approx getCPUTime calls per second: 205,640
      Approx clock frequency:  3,306,891,339
      First, timing with System.Random interface:
       193,178,901 random ints generated [constant zero gen]  
        14,530,358 random ints generated [System.Random stdGen]
            16,346 random ints generated [BurtonGenSlow/reference]
            32,965 random ints generated [BurtonGenSlow]    
      Comparison to C's rand():
       118,766,285 random ints generated [rand/store in C loop]
       114,668,028 random ints generated [rand / Haskell loop]
       114,675,116 random ints generated [rand/store Haskell]

At the moment this is Haskell-only, I haven't included the wrapped Intel assembly code library yet.  As you can see, the pure-Haskell AES based RNG (BurtonGenSlow) is pretty slow.

Would anyone else be interested in running those RNG testing tools (diehard, big crush) on this to make sure it is working correctly?

Also I'd be happy if anyone with a performance-oriented-eye would like to take a look at what's going on.  Both for the sake of the serial performance (above) and because the parallel performance is currently mysterious (see below).

I figure one of the main reasons for splittable RNG is deterministic parallel computations.  Thus it's important that all threads be able to run the RNG efficiently.  Right now, if you look at SimpleRNGBench.hs I'm just running the same RNG on numCapabilities threads.  Yet with that simple test I'm running into problems, summarized thus:

  * I get substantial (3X) variance in program performance on consecutive runs.
  * I see a minor hit in performance adding -threaded, but going from -N1 to -N4 (even with a single-thread of work) yields a big hit in performance and increase in variance.
  * -N4 with four actual threads of work is actually pretty good for the pure haskell version.  All four threads on my nehalem 3.33ghz can maintain 93% of their throughput in the serial case.  BUT the variance problem persists.
  * I run a busy-wait loop that measures cpu frequency... and this seems to get messed up in threaded mode (even with -qm -qa).  I don't know why.
  * I cannot killThread a haskell thread (forkIO or forkOS) that is currently running a divergent FFI call (safe or unsafe).  (See "time_c".)

You can find the details in the DEVLOG here:

   https://github.com/rrnewton/intel-aes/blob/master/CHANGELOG

Let me know if you have any ideas.  I'm going to leave the Haskell version how it is and focus on wrapping the Intel asm (which has a permissive license).

Cheers,
  -Ryan

P.S. Regarding this benchmarking -- would it be appropriate to use Criterion for this?  Or is it sufficient to measure aggregate throughput as I've been doing?



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Arnaud Bailly | 1 Feb 2011 08:16
Picon
Gravatar

Re: Packages all screwed up

Hi,
Thanks for your answers.

I did

> cabal upgrade yesod

As for the user/global issue, I think I tried a user install, this is
default isn't it?

Looks like I will have to reinstall everything :-(

Arnaud

On Tue, Feb 1, 2011 at 1:34 AM, Antoine Latter <aslatter <at> gmail.com> wrote:
> On Mon, Jan 31, 2011 at 4:59 PM, Arnaud Bailly <arnaud.oqube <at> gmail.com> wrote:
>> Hello,
>> I recently tried to upgrade some package (eg. yesod) and it seems
>> that, in the process, I screwed up my Haskell packages setup.
>> When I am trying to do a simple:
>>> ghc --make Crete1941
>
> What command(s) did you issue to "upgrade some packages?"
> Were you trying to do a user or global install?
>
> When ghc loads packages, I've had cases where packages in the user db
> would shadow packages in the global db, causing *other* packages in
> the global db to report as "broken".
>
> Thanks,
> Antoine
>
Max Cantor | 1 Feb 2011 09:27
Picon
Gravatar

Haskell Platform 2011.x - planned release date?

January has come and gone and HP 2011 has not come with it.  Is there an updated timetable for the next version
of the HP?  I'm not complaining or upset or whining, just trying to plan.  

Great work so far, looking forward to HP 2011!

mc
Thomas Schilling | 1 Feb 2011 09:53
Gravatar

Re: Haskell Platform 2011.x - planned release date?

My guess is that they're waiting for the next (and final) stable
release of 7.0, which should happen in the next few weeks.

On 1 February 2011 08:27, Max Cantor <mxcantor <at> gmail.com> wrote:
> January has come and gone and HP 2011 has not come with it.  Is there an updated timetable for the next
version of the HP?  I'm not complaining or upset or whining, just trying to plan.
>
> Great work so far, looking forward to HP 2011!
>
> mc
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe <at> haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

--

-- 
Push the envelope. Watch it bend.
Krzysztof Skrzętnicki | 1 Feb 2011 11:42
Picon

Re: Packages all screwed up

This is the easiest way conceptually. You can also try to --reinstall every package that 'ghc-pkg check' report is broken. If you pick up the right version and compilation options will match there is a high chance you can fix this state. I've done this before and it worked.


Best regards,
Krzysztof Skrzętnicki

On Tue, Feb 1, 2011 at 08:16, Arnaud Bailly <arnaud.oqube <at> gmail.com> wrote:
Hi,
Thanks for your answers.

I did

> cabal upgrade yesod

As for the user/global issue, I think I tried a user install, this is
default isn't it?

Looks like I will have to reinstall everything :-(

Arnaud

On Tue, Feb 1, 2011 at 1:34 AM, Antoine Latter <aslatter <at> gmail.com> wrote:
> On Mon, Jan 31, 2011 at 4:59 PM, Arnaud Bailly <arnaud.oqube <at> gmail.com> wrote:
>> Hello,
>> I recently tried to upgrade some package (eg. yesod) and it seems
>> that, in the process, I screwed up my Haskell packages setup.
>> When I am trying to do a simple:
>>> ghc --make Crete1941
>
> What command(s) did you issue to "upgrade some packages?"
> Were you trying to do a user or global install?
>
> When ghc loads packages, I've had cases where packages in the user db
> would shadow packages in the global db, causing *other* packages in
> the global db to report as "broken".
>
> Thanks,
> Antoine
>

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane