RE: link statically with libc?

2003-08-14 Thread Simon Marlow
 
 Is it possible to link libc statically with GHC?  My Linux box has
 been upgraded, and compiled binaries no longer work on older
 systems. :-( 

-optl-static should do the trick.

Cheers,
Simon
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: link statically with libc?

2003-08-14 Thread Ketil Z. Malde
Simon Marlow [EMAIL PROTECTED] writes:

 I don't know how the Ada guys do it.  Perhaps they have an alternate
 set of compiled libraries with bounds-checking turned off?

Me neither, I've just heard the idea discussed, not the actual
technology. 

 I suppose I can do it by wrapping array accesses in a class or
 otherwise, with a safe and an unsafe implementation, and switch when
 I'm satisfied things work.

 Yes, that would do it.

Moving to unsafeAt gained me a couple of percent in my application.
Throwing in a -fliberate-case gave me a miniscule, but possibly
positive gain.

However, linking statically (with -optl-static) causes my program to
stack overflow!?  Sounds very strange to me, but I don't have time to
investigate that further today.  I'll look into it a bit more
tomorrow. 

 Large file support will be in 6.2.

Goodie!

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


link statically with libc?

2003-08-14 Thread Ketil Z. Malde

Hi,

Is it possible to link libc statically with GHC?  My Linux box has
been upgraded, and compiled binaries no longer work on older
systems. :-( 

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


RE: link statically with libc?

2003-08-14 Thread Hal Daume
  I don't know how the Ada guys do it.  Perhaps they have an alternate
  set of compiled libraries with bounds-checking turned off?
 
 Me neither, I've just heard the idea discussed, not the actual
 technology. 

I know O'Caml does this too (-unsafe as a compiler flag gives you unsafe
array accesses).  I've found in that context, I get as much as a 15%
speedup over not having -unsafe.  Admittedly this is on an extremely
array-intensive application, but it certainly can be a win.

On a related note, I know that the IBM Java compiler (I'm blanking on
the name right now) gets a lot of its speedups over Sun by lifting
bounds checks out of loops.  That is, if you have:

  for (int i=0; i1000; i++) {
acc += arr[i];
  }

in traditional Sun javac, you get something that basically looks like:

  for (int i=0; i1000; i++) {
if i outside of arr bounds, throw exception
acc += arr[i];
  }

but the IBM compiler will lift this out (under certain circumstances --
for instance, if 'acc' is not in scope of the catch) to:

  if 0 outside of arr bounds || 999 outside of arr bounds, throw
exception
  for (int i=0; i1000; i++) {
// look ma, no checks
acc += arr[i];
  }

does GHC do anything similar to this, or are we getting hit with array
checks at each and every read/write (modulo, of course, full laziness)?

 - Hal
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


RE: link statically with libc?

2003-08-14 Thread Simon Marlow
 
 I must have misremembered it from somewhere, perhaps confusing it with
 -fliberate-case-threshold mentioned a while ago (which probably
 belongs in the experimental category?)
 
 Turing off bounds checking could be fairly useful, I think, if there
 is a significant speedup to be gained.  My impression is that the
 typical Ada programmer tests the program thoroughly with bounds
 checking, but compiles without for deployment. (Of course, we would
 rather *know* a priori that we're not going out of bounds, rather than
 just test for it, but it seems to work all right for them)

I don't know how the Ada guys do it.  Perhaps they have an alternate set
of compiled libraries with bounds-checking turned off?

  There are array operations that
  avoid bounds checking, however (eg. unsafeRead, unsafeWrite).
 
 I suppose I can do it by wrapping array accesses in a class or
 otherwise, with a safe and an unsafe implementation, and switch when
 I'm satisfied things work.

Yes, that would do it.

 -kzm
 
 PS: is large file support in the vicinity yet?

Large file support will be in 6.2.

Cheers,
Simon
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


RE: link statically with libc?

2003-08-14 Thread Simon Marlow
 
 (PS: Am I looking in the wrong places, or are a lot of GHC options
 undocumented?  I seem to remember options being brandished about (turn
 of array bounds checking, tuning unboxing and stuff) that I'm unable
 to find documented anywhere.)

There might be one or two undocumented optimisation knobs, but I believe
everything that is actually useful is documented.  Anything undocumented
is either broken or experimental.

There isn't a flag to turn off array bounds checking - it would require
compiling against different libraries.  There are array operations that
avoid bounds checking, however (eg. unsafeRead, unsafeWrite).

The flags that affect automatic boxing/unboxing are
-funbox-strict-fields and -fno-strictness.

Cheers,
Simon
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: link statically with libc?

2003-08-14 Thread Ketil Z. Malde
Simon Marlow [EMAIL PROTECTED] writes:

 -optl-static should do the trick.

That worked nicely, thanks!

(PS: Am I looking in the wrong places, or are a lot of GHC options
undocumented?  I seem to remember options being brandished about (turn
of array bounds checking, tuning unboxing and stuff) that I'm unable
to find documented anywhere.)

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: link statically with libc?

2003-08-10 Thread Ketil Z. Malde
Simon Marlow [EMAIL PROTECTED] writes:

 There isn't a flag to turn off array bounds checking - it would require
 compiling against different libraries.  

I must have misremembered it from somewhere, perhaps confusing it with
-fliberate-case-threshold mentioned a while ago (which probably
belongs in the experimental category?)

Turing off bounds checking could be fairly useful, I think, if there
is a significant speedup to be gained.  My impression is that the
typical Ada programmer tests the program thoroughly with bounds
checking, but compiles without for deployment. (Of course, we would
rather *know* a priori that we're not going out of bounds, rather than
just test for it, but it seems to work all right for them)

 There are array operations that
 avoid bounds checking, however (eg. unsafeRead, unsafeWrite).

I suppose I can do it by wrapping array accesses in a class or
otherwise, with a safe and an unsafe implementation, and switch when
I'm satisfied things work.

-kzm

PS: is large file support in the vicinity yet?
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


RE: link statically with libc?

2003-08-09 Thread Simon Marlow
 
 in traditional Sun javac, you get something that basically looks like:
 
   for (int i=0; i1000; i++) {
 if i outside of arr bounds, throw exception
 acc += arr[i];
   }
 
 but the IBM compiler will lift this out (under certain 
 circumstances -- for instance, if 'acc' is not in scope of 
 the catch) to:
 
   if 0 outside of arr bounds || 999 outside of arr bounds, 
 throw exception
   for (int i=0; i1000; i++) {
 // look ma, no checks
 acc += arr[i];
   }
 
 does GHC do anything similar to this, or are we getting hit 
 with array checks at each and every read/write (modulo, of 
 course, full laziness)?

No, we don't do anything that clever.  Some of the bulk array operations
are written in such a way to eliminate obviously-true bound checks (eg.
listArray doesn't do a bound check for every element), but that's about
it.

Cheers,
Simon

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users