[Caml-list] Q: type conversion with Gdome

2008-07-16 Thread Yang Shouxun
Hello everyone,

I've been using Gdome for some time now and I always find it difficult to deal 
with the type system. Here is the issue:

The document class has a
 method getElementsByTagName :
  tagname:Gdome.domString - Gdome.nodeList
and from a nodeList object I can only get Gdome.node objects, while we know 
they should be Gdome.element objects.

My question is how to convert from Gdome.node to Gdome.element? 

P.S. Gdome.element can be converted to Gdome.node, but not in the other 
direction as far as I know.

TIA,

shouxun

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Re: thousands of CPU cores

2008-07-16 Thread Gerd Stolpmann

Am Mittwoch, den 16.07.2008, 10:59 +0200 schrieb Michaël Grünewald:
 Gerd Stolpmann wrote:
 
  Well, there's now SFU for Windows (but only for XP Professional and
  Windows 2003, not for XP Home and Vista, AFAIK). That's a cool solution
  when you want to run Win32 and POSIX programs on the same system, and
  maybe an alternative to using virtualization. But it is nothing for
  developing consumer programs on Windows.
  
  Btw, has something tried to compile O'Caml on SFU? It's a 230M free
  download. There seems to be gcc and lots of GNU stuff, too (yes, it's
  from MS...).
 
 I did this a few monthes ago, I followed the NetBSD way, since SFU is 
 supported by NetBSD's `pkgsrc'. This was really *easy*, thanks to the 
 efforts of the `pkgsrc' maintainers. However, I did not play that much 
 with the system, my point was to test SFU by running very Unix-oriented 
 and complex proecdures in it.
 
 See http://www.netbsd.org/docs/software/packages.html
 for general information about NetBSD's pkgsrc; Microsoft SFU is refered 
 to as Interix here, e.g. in the ``Supported Platforms'' section.

Good to know.

 The `pkgsrc' software is a port infrastructure similar to what is found 
 on *BSD and MacPorts, if you have used one of them, you certainly will 
 feel comfortable with `pkgsrc'. Documentation for `pkgsrc' is available 
 at http://www.netbsd.org/docs/pkgsrc/, besides the introduction, see 
 especially sections 3.2 (Bootstrapping) and 4.2 (Installing ports), it 
 shall be enough to get started!

Yes, I know pkgsrc very well. I used it years ago to build software on
Solaris. Later I took it as starting point for GODI.

Gerd
-- 

Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany 
[EMAIL PROTECTED]  http://www.gerd-stolpmann.de
Phone: +49-6151-153855  Fax: +49-6151-997714



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] memory usage

2008-07-16 Thread Jean Krivine
Good news, I just tested the patch and it works great with my application!
I just had to modify the module random since a call to (Random.int
max_int) may raise and exception (it is made for 32 bits integers).
So I guess that modification should be included in the patch.

Thanks a lot Andres.
Jean

On Wed, Jul 16, 2008 at 12:27 PM, Jean Krivine
[EMAIL PROTECTED] wrote:
 Great thanks!

 J

 On Wed, Jul 16, 2008 at 10:16 AM, Andres Varon [EMAIL PROTECTED] wrote:

 On Jul 15, 2008, at 3:38 PM, Jean Krivine wrote:

 I'd be glad to try the patch if you could post it somewhere!

 I have posted it in:

 http://research.amnh.org/~avaron/ocaml/

 best,

 Andres

 J

 On Tue, Jul 15, 2008 at 3:31 PM, Andres Varon [EMAIL PROTECTED] wrote:

 Hello Jean,

 There is no 64-bit native OCaml compiler for Mac OS X intel.  I have a
 patch
 that works in Leopard, but did not compile opt.opt in Tiger, meaning that
 something is not OK,  so I did not offer it to the community. The
 bootstrap
 went fine, findlib and godi compiled OK too. I can post the patches
 somewhere if you want to give it a shot.

 My memory intensive application runs fine in Leopard with this compiler.
 But
 the binaries do not execute in Tiger (I found that other people had the
 same
 trouble copying a 64 bit apps from Leopard to Tiger and the other way
 around, but didn't look into it).

 If you want it ... I can post it, maybe someone can cleanup my job? All
 that
 would be needed after patching is:

 ./configure -host x86_64-apple-darwin -prefix /opt/ocaml/experimental

 (The prefix I always add for my ocaml-modified comilers).

 best,

 Andres

 On Jul 15, 2008, at 1:06 PM, Jean Krivine wrote:

 Dear all

 I downloaded the last version of ocaml (3.10.2) but I must confess I
 don't know what option I should pass to the compiler to make a binary
 that uses 64 bits.
 I tried naively ocamlopt -ccopt -arch -ccopt x86_64 but that doesn't
 work. Any idea?



 On Fri, Jul 11, 2008 at 6:01 PM, Richard Jones [EMAIL PROTECTED] wrote:

 On Fri, Jul 11, 2008 at 03:49:26PM -0400, Jean Krivine wrote:

 I am trying to run a stochastic simulator (written in ocaml) on a huge
 data set and I have the following error message:

 I can confirm that OCaml works fine with huge datasets, on 64 bit
 platforms anyway.

 sim(9595) malloc: *** mmap(size=1048576) failed (error code=12)
 *** error: can't allocate region
 *** set a breakpoint in malloc_error_break to debug
 Fatal error: out of memory.

 My system:

 Mac Pro running OS X 10.5.4
 Processor:  2 x 2.8 GHz Quad-Core Intel Xeon
 Memory:  10 GB 800 MHz DDR2 FB-DIMM

 Does someone know what happened? Do you have any idea of any parameter
 I could tune in order to avoid that?

 Is the compiler 32 bits or 64 bits on this machine?  Try doing:

 $ ocaml
 # Sys.word_size ;;

 It should print out either '32' or '64'.

 Also run your program under whatever the OS X equivalent of 'strace'
 is (ktrace?) to find out exactly why the mmap call fails.

 OCaml = 3.10.2 on Linux suffers a nasty problem with its use of mmap
 and randomized address spaces
 (https://bugzilla.redhat.com/show_bug.cgi?id=445545#c9) but it doesn't
 seem like this is the same issue.

 Rich.

 --
 Richard Jones
 Red Hat

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs


 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs






___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] memory usage

2008-07-16 Thread Andres Varon



On Jul 16, 2008, at 2:07 PM, Jean Krivine wrote:

Good news, I just tested the patch and it works great with my  
application!

I just had to modify the module random since a call to (Random.int
max_int) may raise and exception (it is made for 32 bits integers).
So I guess that modification should be included in the patch.


I don't think that's a good idea. You have to use Random.int64 to get  
a 64 bit random integer. The Random.int function will return an  
integer between 0 and 2^30. Check the Random module documentation here:


http://caml.inria.fr/pub/docs/manual-ocaml/libref/Random.html

I wouldn't play with a random number generator unless I know exactly  
what I'm doing. Your results depend on it! (well, your messed-up-by- 
andres compiler could already have issues ... :-(, for what I use it I  
can verify the result with a 32 bit binary or a 64 bit linux binary,  
if you can, then do the same!).



Andres



Thanks a lot Andres.
Jean

On Wed, Jul 16, 2008 at 12:27 PM, Jean Krivine
[EMAIL PROTECTED] wrote:

Great thanks!

J

On Wed, Jul 16, 2008 at 10:16 AM, Andres Varon [EMAIL PROTECTED]  
wrote:


On Jul 15, 2008, at 3:38 PM, Jean Krivine wrote:


I'd be glad to try the patch if you could post it somewhere!


I have posted it in:

http://research.amnh.org/~avaron/ocaml/

best,

Andres


J

On Tue, Jul 15, 2008 at 3:31 PM, Andres Varon [EMAIL PROTECTED]  
wrote:


Hello Jean,

There is no 64-bit native OCaml compiler for Mac OS X intel.  I  
have a

patch
that works in Leopard, but did not compile opt.opt in Tiger,  
meaning that

something is not OK,  so I did not offer it to the community. The
bootstrap
went fine, findlib and godi compiled OK too. I can post the  
patches

somewhere if you want to give it a shot.

My memory intensive application runs fine in Leopard with this  
compiler.

But
the binaries do not execute in Tiger (I found that other people  
had the

same
trouble copying a 64 bit apps from Leopard to Tiger and the  
other way

around, but didn't look into it).

If you want it ... I can post it, maybe someone can cleanup my  
job? All

that
would be needed after patching is:

./configure -host x86_64-apple-darwin -prefix /opt/ocaml/ 
experimental


(The prefix I always add for my ocaml-modified comilers).

best,

Andres

On Jul 15, 2008, at 1:06 PM, Jean Krivine wrote:


Dear all

I downloaded the last version of ocaml (3.10.2) but I must  
confess I
don't know what option I should pass to the compiler to make a  
binary

that uses 64 bits.
I tried naively ocamlopt -ccopt -arch -ccopt x86_64 but that  
doesn't

work. Any idea?



On Fri, Jul 11, 2008 at 6:01 PM, Richard Jones  
[EMAIL PROTECTED] wrote:


On Fri, Jul 11, 2008 at 03:49:26PM -0400, Jean Krivine wrote:


I am trying to run a stochastic simulator (written in ocaml)  
on a huge

data set and I have the following error message:


I can confirm that OCaml works fine with huge datasets, on 64  
bit

platforms anyway.


sim(9595) malloc: *** mmap(size=1048576) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Fatal error: out of memory.

My system:

Mac Pro running OS X 10.5.4
Processor:  2 x 2.8 GHz Quad-Core Intel Xeon
Memory:  10 GB 800 MHz DDR2 FB-DIMM

Does someone know what happened? Do you have any idea of any  
parameter

I could tune in order to avoid that?


Is the compiler 32 bits or 64 bits on this machine?  Try doing:

$ ocaml
# Sys.word_size ;;

It should print out either '32' or '64'.

Also run your program under whatever the OS X equivalent of  
'strace'

is (ktrace?) to find out exactly why the mmap call fails.

OCaml = 3.10.2 on Linux suffers a nasty problem with its use  
of mmap

and randomized address spaces
(https://bugzilla.redhat.com/show_bug.cgi?id=445545#c9) but it  
doesn't

seem like this is the same issue.

Rich.

--
Richard Jones
Red Hat

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs










___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] memory usage

2008-07-16 Thread Jean Krivine
I agree. I should use Int64 instead of just int, but I still think
that the application (Random.int max_int) should not be exception
prone. Since max_int is architecture dependent, then so should be
Random.int no?

But you point is well taken. Thanks again
J


On Wed, Jul 16, 2008 at 2:44 PM, Andres Varon [EMAIL PROTECTED] wrote:


 On Jul 16, 2008, at 2:07 PM, Jean Krivine wrote:

 Good news, I just tested the patch and it works great with my application!
 I just had to modify the module random since a call to (Random.int
 max_int) may raise and exception (it is made for 32 bits integers).
 So I guess that modification should be included in the patch.

 I don't think that's a good idea. You have to use Random.int64 to get a 64
 bit random integer. The Random.int function will return an integer between 0
 and 2^30. Check the Random module documentation here:

 http://caml.inria.fr/pub/docs/manual-ocaml/libref/Random.html

 I wouldn't play with a random number generator unless I know exactly what
 I'm doing. Your results depend on it! (well, your messed-up-by-andres
 compiler could already have issues ... :-(, for what I use it I can verify
 the result with a 32 bit binary or a 64 bit linux binary, if you can, then
 do the same!).


 Andres


 Thanks a lot Andres.
 Jean

 On Wed, Jul 16, 2008 at 12:27 PM, Jean Krivine
 [EMAIL PROTECTED] wrote:

 Great thanks!

 J

 On Wed, Jul 16, 2008 at 10:16 AM, Andres Varon [EMAIL PROTECTED] wrote:

 On Jul 15, 2008, at 3:38 PM, Jean Krivine wrote:

 I'd be glad to try the patch if you could post it somewhere!

 I have posted it in:

 http://research.amnh.org/~avaron/ocaml/

 best,

 Andres

 J

 On Tue, Jul 15, 2008 at 3:31 PM, Andres Varon [EMAIL PROTECTED] wrote:

 Hello Jean,

 There is no 64-bit native OCaml compiler for Mac OS X intel.  I have a
 patch
 that works in Leopard, but did not compile opt.opt in Tiger, meaning
 that
 something is not OK,  so I did not offer it to the community. The
 bootstrap
 went fine, findlib and godi compiled OK too. I can post the patches
 somewhere if you want to give it a shot.

 My memory intensive application runs fine in Leopard with this
 compiler.
 But
 the binaries do not execute in Tiger (I found that other people had
 the
 same
 trouble copying a 64 bit apps from Leopard to Tiger and the other way
 around, but didn't look into it).

 If you want it ... I can post it, maybe someone can cleanup my job?
 All
 that
 would be needed after patching is:

 ./configure -host x86_64-apple-darwin -prefix /opt/ocaml/experimental

 (The prefix I always add for my ocaml-modified comilers).

 best,

 Andres

 On Jul 15, 2008, at 1:06 PM, Jean Krivine wrote:

 Dear all

 I downloaded the last version of ocaml (3.10.2) but I must confess I
 don't know what option I should pass to the compiler to make a binary
 that uses 64 bits.
 I tried naively ocamlopt -ccopt -arch -ccopt x86_64 but that doesn't
 work. Any idea?



 On Fri, Jul 11, 2008 at 6:01 PM, Richard Jones [EMAIL PROTECTED]
 wrote:

 On Fri, Jul 11, 2008 at 03:49:26PM -0400, Jean Krivine wrote:

 I am trying to run a stochastic simulator (written in ocaml) on a
 huge
 data set and I have the following error message:

 I can confirm that OCaml works fine with huge datasets, on 64 bit
 platforms anyway.

 sim(9595) malloc: *** mmap(size=1048576) failed (error code=12)
 *** error: can't allocate region
 *** set a breakpoint in malloc_error_break to debug
 Fatal error: out of memory.

 My system:

 Mac Pro running OS X 10.5.4
 Processor:  2 x 2.8 GHz Quad-Core Intel Xeon
 Memory:  10 GB 800 MHz DDR2 FB-DIMM

 Does someone know what happened? Do you have any idea of any
 parameter
 I could tune in order to avoid that?

 Is the compiler 32 bits or 64 bits on this machine?  Try doing:

 $ ocaml
 # Sys.word_size ;;

 It should print out either '32' or '64'.

 Also run your program under whatever the OS X equivalent of 'strace'
 is (ktrace?) to find out exactly why the mmap call fails.

 OCaml = 3.10.2 on Linux suffers a nasty problem with its use of
 mmap
 and randomized address spaces
 (https://bugzilla.redhat.com/show_bug.cgi?id=445545#c9) but it
 doesn't
 seem like this is the same issue.

 Rich.

 --
 Richard Jones
 Red Hat

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs


 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs








___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list

[Caml-list] Findlib fails to build on OS X Leopard

2008-07-16 Thread Nathaniel Gray
My colleague is trying to install GODI but it's choking on findlib
1.2.2.  Specifically, the command used to locate the std. lib. in
get_stdlib is not compatible with OS X's sed:

ocamlc -where | sed s/\r// || ...

The version of sed included with Leopard doesn't support
backslash-escapes like \r.  Instead, it treats '\r' just like 'r', so
this turns '/Users/blah/...' into '/Uses/blah/...' and the std. lib.
can't be found.

Until this bug is fixed the workaround is to install gnu sed.

Cheers,
-n8

-- 
-- Nathaniel Gray -- Caltech Computer Science --
-- Mojave Project -- http://mojave.cs.caltech.edu --

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs