caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocamlp3l and command line options: how?
@ 2007-08-21 21:43 Luca de Alfaro
  2007-08-21 22:21 ` [Caml-list] " Till Varoquaux
  0 siblings, 1 reply; 5+ messages in thread
From: Luca de Alfaro @ 2007-08-21 21:43 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 588 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 661 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] ocamlp3l and command line options: how?
  2007-08-21 21:43 ocamlp3l and command line options: how? Luca de Alfaro
@ 2007-08-21 22:21 ` Till Varoquaux
  2007-08-22  1:30   ` Luca de Alfaro
  0 siblings, 1 reply; 5+ messages in thread
From: Till Varoquaux @ 2007-08-21 22:21 UTC (permalink / raw)
  To: Luca de Alfaro; +Cc: caml-list

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/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] ocamlp3l and command line options: how?
  2007-08-21 22:21 ` [Caml-list] " Till Varoquaux
@ 2007-08-22  1:30   ` Luca de Alfaro
  2007-08-22  6:06     ` Maxence Guesdon
  0 siblings, 1 reply; 5+ messages in thread
From: Luca de Alfaro @ 2007-08-22  1:30 UTC (permalink / raw)
  To: Till Varoquaux; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1721 bytes --]

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...

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/
>

[-- Attachment #2: Type: text/html, Size: 2526 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] ocamlp3l and command line options: how?
  2007-08-22  1:30   ` Luca de Alfaro
@ 2007-08-22  6:06     ` Maxence Guesdon
  2007-08-22  6:21       ` Luca de Alfaro
  0 siblings, 1 reply; 5+ messages in thread
From: Maxence Guesdon @ 2007-08-22  6:06 UTC (permalink / raw)
  To: Luca de Alfaro; +Cc: Till Varoquaux, caml-list

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/
> >


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] ocamlp3l and command line options: how?
  2007-08-22  6:06     ` Maxence Guesdon
@ 2007-08-22  6:21       ` Luca de Alfaro
  0 siblings, 0 replies; 5+ messages in thread
From: Luca de Alfaro @ 2007-08-22  6:21 UTC (permalink / raw)
  To: Maxence Guesdon; +Cc: Till Varoquaux, caml-list

[-- Attachment #1: Type: text/plain, Size: 3347 bytes --]

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/
> > >
>

[-- Attachment #2: Type: text/html, Size: 4744 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-08-22  6:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-21 21:43 ocamlp3l and command line options: how? Luca de Alfaro
2007-08-21 22:21 ` [Caml-list] " Till Varoquaux
2007-08-22  1:30   ` Luca de Alfaro
2007-08-22  6:06     ` Maxence Guesdon
2007-08-22  6:21       ` Luca de Alfaro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).