From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL,HTML_MESSAGE autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 2D99BBC69 for ; Wed, 22 Aug 2007 08:21:26 +0200 (CEST) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.178]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l7M6LMwj008946 for ; Wed, 22 Aug 2007 08:21:25 +0200 Received: by py-out-1112.google.com with SMTP id u52so140448pyb for ; Tue, 21 Aug 2007 23:21:20 -0700 (PDT) Received: by 10.143.166.3 with SMTP id t3mr12147wfo.1187763679437; Tue, 21 Aug 2007 23:21:19 -0700 (PDT) Received: by 10.142.80.4 with HTTP; Tue, 21 Aug 2007 23:21:19 -0700 (PDT) Message-ID: <28fa90930708212321m363cd16j1d2c4455db6ee1ad@mail.gmail.com> Date: Tue, 21 Aug 2007 23:21:19 -0700 From: "Luca de Alfaro" To: "Maxence Guesdon" Subject: Re: [Caml-list] ocamlp3l and command line options: how? Cc: "Till Varoquaux" , caml-list@yquem.inria.fr In-Reply-To: <20070822080627.3d267b2c@tintin.inria.fr> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_146123_27240206.1187763679419" References: <28fa90930708211443n6ad5a549u74c6d0117717ba69@mail.gmail.com> <9d3ec8300708211521tb3c8fdo5a93d914f6264429@mail.gmail.com> <28fa90930708211830r28a22dc0q82e4b480c312df87@mail.gmail.com> <20070822080627.3d267b2c@tintin.inria.fr> X-Miltered: at concorde with ID 46CBD5E2.004 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; command-line:01 foo:01 foo:01 -thread:01 camlp:01 command-line:01 maxence:01 guesdon:01 maxence:01 guesdon:01 runtime:01 iter:01 cheers:01 beginner's:01 ocaml:01 ------=_Part_146123_27240206.1187763679419 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks! I tried it, but to no avail. I have not only options, but also command-line arguments: what I am trying to do is run something like foo -max_cores 4 -foovalue 3 file1 file1 file3 ... I am trying to run, in ocamlp3l, foo --p3lroot -max_cores 4 -foovalue 3 file1 file1 file3 ... but the program seems to get stuck forever with no computation happening... (I am compiling with the -thread mode). In the camlp3l manual, it does not say anything about what happens to command-line arguments; reading a bit of the ocamlp3l code it seems it expects "processors" to be specified (even in the thread mode? It would be a single processor... and just how are processors supposed to be specified? only in the root process, or in all of them? ). Is there some up-to-date information about command-line processing in ocamlp3l avaliable anywhere? Many thanks for the help, Luca On 8/21/07, Maxence Guesdon wrote: > > On Tue, 21 Aug 2007 18:30:52 -0700 > "Luca de Alfaro" wrote: > > > Thanks, but the problem seems to be the opposite one.... ocamlp3l also > > uses Args, and once I tell it to parse the command-line options, the > > options such as -rootp3l do not seem to work any more. The problem is > > not that I need to avoid -rootp3l; the problem seems to be that the > > ocamlp3l runtime doesn't see its own options any more... > > Hello, > > You can add options with the Command_options.add function. > Exemple: > > let my_options = [ > "-nl", Arg.Unit print_newline, "just print a newline" ; > (* other options ... *) > ] > in > List.iter (fun (o,spec,s) -> Command_options.add o spec s) my_options; > > They will be handled when ocamlp3l analyzes the command line. > > Maxence > > > > Luca > > > > On 8/21/07, Till Varoquaux wrote: > > > > > > The Arg module use a cursor to know which argument it is is currently > > > parsing. You can therefor ignore the first argument like this: > > > > > > incr Arg.current > > > > > > before calling Arg.parse > > > > > > Cheers, > > > Till > > > > > > On 8/21/07, Luca de Alfaro wrote: > > > > I am trying to use ocamlp3l to parallelize some code. Using the > > > skeleton > > > > paradigm was a lot of fun and quite easy, but I am stumbling on the > > > easiest > > > > of issues... > > > > > > > > My code needs some command-line options, and I am processing them > with > > > the > > > > Arg package. The ocamlp3l manual does not anything about what to do > > > > for command-line options. > > > > > > > > I cannot simly run: > > > > > > > > ./foo -p3lroot -i blah -o boink > > > > > > > > because Arg tells me that it doesn't know what to do with -p3lroot. > > > > Fine, but, then how do I do? It's not really feasible for me to do > > > without > > > > command-line options... > > > > > > > > Many thanks in advance, > > > > > > > > Luca > > > > > > > > _______________________________________________ > > > > 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 > > > > > > > > > > > > > > > > > -- > > > http://till-varoquaux.blogspot.com/ > > > > ------=_Part_146123_27240206.1187763679419 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks!   I tried it, but to no avail. I have not only options, but also command-line arguments: 
what I am trying to do is run something like

foo -max_cores 4 -foovalue 3 file1 file1 file3 ...

I am trying to run, in ocamlp3l,

foo --p3lroot -max_cores 4 -foovalue 3 file1 file1 file3 ...

but the program seems to get stuck forever with no computation happening... (I am compiling with the -thread mode).  In the camlp3l manual, it does not say anything about what happens to command-line arguments; reading a bit of the ocamlp3l code it seems it expects "processors" to be specified (even in the thread mode? It would be a single processor...  and just how are processors supposed to be specified?  only in the root process, or in all of them? ).
Is there some up-to-date information about command-line processing in ocamlp3l avaliable anywhere?

Many thanks for the help,

Luca

On 8/21/07, Maxence Guesdon <maxence.guesdon@inria.fr> wrote:
On Tue, 21 Aug 2007 18:30:52 -0700
"Luca de Alfaro" <luca@dealfaro.org> wrote:

> Thanks, but the problem seems to be the opposite one.... ocamlp3l also
> uses Args, and once I tell it to parse the command-line options, the
> options such as -rootp3l do not seem to work any more.  The problem is
> not that I need to avoid -rootp3l; the problem seems to be that the
> ocamlp3l runtime doesn't see its own options any more...

Hello,

You can add options with the Command_options.add function.
Exemple:

let my_options = [
  "-nl", Arg.Unit print_newline, "just print a newline" ;
  (* other options ... *)
]
in
List.iter (fun (o,spec,s) -> Command_options.add o spec s) my_options;

They will be handled when ocamlp3l analyzes the command line.

Maxence
>
> Luca
>
> On 8/21/07, Till Varoquaux <till.varoquaux@gmail.com> wrote:
> >
> > The Arg module use a cursor to know which argument it is is currently
> > parsing. You can therefor ignore the first argument like this:
> >
> > incr Arg.current
> >
> > before calling Arg.parse
> >
> > Cheers,
> > Till
> >
> > On 8/21/07, Luca de Alfaro <luca@dealfaro.org> wrote:
> > > I am trying to use ocamlp3l to parallelize some code.  Using the
> > skeleton
> > > paradigm was a lot of fun and quite easy, but I am stumbling on the
> > easiest
> > > of issues...
> > >
> > > My code needs some command-line options, and I am processing them with
> > the
> > > Arg package.  The ocamlp3l manual does not anything about what to do
> > > for command-line options.
> > >
> > > I cannot simly run:
> > >
> > > ./foo -p3lroot -i blah -o boink
> > >
> > > because Arg tells me that it doesn't know what to do with -p3lroot.
> > > Fine, but, then how do I do?  It's not really feasible for me to do
> > without
> > > command-line options...
> > >
> > > Many thanks in advance,
> > >
> > > Luca
> > >
> > > _______________________________________________
> > > 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
> > >
> > >
> >
> >
> > --
> > http://till-varoquaux.blogspot.com/
> >

------=_Part_146123_27240206.1187763679419--