Sterling Clover | 1 Nov 01:41 2008
Picon

Re: Re: Why 'round' does not just round numbers ?


On Oct 30, 2008, at 5:21 PM, Bertram Felgenhauer wrote:

> George Pollard wrote:
>> There's also the ieee-utils package, which provides an IEEE monad  
>> with
>> `setRound`:
>>
>> http://hackage.haskell.org/packages/archive/ieee-utils/0.4.0/doc/ 
>> html/Numeric-IEEE-RoundMode.html
>

> When run with +RTS -N2 -RTS, the output randomly alternates
> between Downward and ToNearest - for me at least.
>
> The problem is that the setRound call will only affect one worker
> thread, while the RTS will sometimes migrate RTS threads from one
> worker to another.
>
> runIEEE really has to be executed in a bound thread (see forkOS
> documentation). Using `par` will also cause trouble - in fact even
> more.
>

That's a really nice catch!

Dons has pointed out to me both the very handy forkOnIO which ensures  
the forked thread remains bound to a single CPU, and also the -qm  
flag to the RTS, which prevents thread migration between  
capabilities. Running the example program with +RTS -N2 -qm restores  
(Continue reading)

Neal Alexander | 1 Nov 08:15 2008
Picon

Re: Memory efficiency questions for real-time graphics

Even when generating one or more copies of "world" per frame the 
performance stays fine and allocations are minimal. From what ive seen, 
the OpenGL calls are whats going to bottle neck.

loop (time, space)

where

   loop = loop <=< runKleisli action

      where

         action = (ChronoSync.sync *** syncExternal channel)

                   >>> Space.update
                   >>> display
                   >>> ChronoSync.yieldCPU
Patrick Perry | 1 Nov 10:02 2008
Picon

ANN: blas version 0.6

New version of BLAS bindings out.  Now with support for the ST monad!   
This breaks backwards compatibility, unfortunately.

More info (and some sample code) here: http://quantile95.com/2008/10/31/ann-blas-bindings-for-haskell-version-06/

Also, if you want to help, please let me know.  There is plenty of  
work to do.

Patrick
Andrew Coppin | 1 Nov 13:53 2008

Array bug?

Consider the following GHCi session:

GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
Prelude> :m Data.Array.IO
Prelude Data.Array.IO> t <- newArray ((0,0),(5,4)) 0 :: IO (IOUArray 
(Int,Int) Int)
Loading package array-0.1.0.0 ... linking ... done.
Prelude Data.Array.IO> getBounds t
((0,0),(5,4))
Prelude Data.Array.IO> writeArray t (10,10) 5
*** Exception: Error in array index
Prelude Data.Array.IO> writeArray t (7,3) 5
*** Exception: Error in array index
Prelude Data.Array.IO> writeArray t (3,7) 5
Prelude Data.Array.IO>

So the array has 0 <= x <= 5 and 0 <= y <= 4, and writing to (10,10) or 
(7,3) throws an exception. However, writing to (3,7) triggers no 
exception - despite being clearly out of range. Judging by the behaviour 
of the large, complex program I was debugging when I stumbled upon this, 
the coordinates "wrap round" to the next column. (!!)

Obviously, writing to non-existent coordinates and not getting an 
exception is a Very Bad Thing. I was counting on writeArray (and 
readArray) to detect out-of-range coordinates so I could fix my code. 
But as you can see, it doesn't actually work as advertised. You have *no 
idea* how long I spent trying to track this bug down! >_<

Is this a known bug? Is it likely to be fixed any time soon? (I'm 
(Continue reading)

Alberto G. Corona | 1 Nov 14:15 2008
Picon

number of references to a variable

Is there a way to know the number of memory references for a variable?. 

The runtime must know it but i do not know if this available for the program trough any low level trick

Thanks


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Achim Schneider | 1 Nov 14:33 2008
Picon

Re: number of references to a variable

"Alberto G. Corona " <agocorona <at> gmail.com> wrote:

> Is there a way to know the number of memory references for a
> variable?. The runtime must know it but i do not know if this
> available for the program trough any low level trick
> 
Flameproof vests, cheap and safe! Get yours now before it's too late!

--

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.
Andrew Coppin | 1 Nov 14:38 2008

Re: number of references to a variable

Alberto G. Corona wrote:
> Is there a way to know the number of memory references for a variable?. 
> The runtime must know it but i do not know if this available for the 
> program trough any low level trick

More precisely, the GC computes it each time it runs. (And only computes 
it precisely during a "major" pass, not the more frequent "minor" passes.)

You can attach a finaliser to an object, and that'll allow you to know 
when the reference count reaches zero. But beyond that, I don't know.
Bertram Felgenhauer | 1 Nov 15:14 2008

Re: Array bug?

Andrew Coppin wrote:
> Consider the following GHCi session:
>
> GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
> Prelude Data.Array.IO> t <- newArray ((0,0),(5,4)) 0 :: IO (IOUArray (Int,Int) Int)
> Prelude Data.Array.IO> getBounds t
> ((0,0),(5,4))
> Prelude Data.Array.IO>
>
> Is this a known bug? Is it likely to be fixed any time soon? (I'm guessing 
> the bug is as simple is converting indicies to integers and then checking 
> the integers are in-range, rather than the underlying index type.)

Yes, it's a known bug - a conscious choice really. See

    http://hackage.haskell.org/trac/ghc/ticket/2120

It's somewhat ironic that this behaviour was introduced by a patch
that made arrays safer to use in other respects.

Bertram
Andrew Coppin | 1 Nov 15:58 2008

Re: Array bug?

Bertram Felgenhauer wrote:
> Yes, it's a known bug - a conscious choice really. See
>
>     http://hackage.haskell.org/trac/ghc/ticket/2120
>
> It's somewhat ironic that this behaviour was introduced by a patch
> that made arrays safer to use in other respects.
>   

...so it's *not* going to be fixed then?

That's just fantastic. Nice to know that Haskell takes safety seriously...
Miguel Mitrofanov | 1 Nov 16:20 2008
Picon

Re: Re: number of references to a variable


On 1 Nov 2008, at 16:33, Achim Schneider wrote:

> "Alberto G. Corona " <agocorona <at> gmail.com> wrote:
>
>> Is there a way to know the number of memory references for a
>> variable?. The runtime must know it but i do not know if this
>> available for the program trough any low level trick
>>
> Flameproof vests, cheap and safe! Get yours now before it's too late!

Save one for me, please!

Gmane