Loading ...
Sorry, an error occurred while loading the content.

Concurrent programming

Expand Messages
  • Marco Pedeira
    Hello , I have created a program that computes a (rather complicated) function f defined over the integers. I noticed that when trying to compute the values of
    Message 1 of 6 , Nov 17, 2003
    • 0 Attachment
      Hello ,

      I have created a program that computes a
      (rather complicated) function f defined over
      the integers. I noticed that when trying to
      compute the values of f(i) for i=1 to N (say)
      ocaml does it more quickly if we open several
      sessions and in each we ask ocaml to compute
      f(i) for i in interval I_k, where we have
      partitioned [1,N] into several intervals I_k,
      rather than asking him directly to compute
      f(i) for i in [1,N].
      Now is there a way to make this division
      directly in just one session without having
      to repeat the same instruction several times ?
      thanks in advance for any kind of help.

      Ewan





      ______________________________________________________________________

      Yahoo! Mail: 6MB, anti-spam e antivĂ­rus gratuito! Crie sua conta agora:
      http://mail.yahoo.com.br
    • Stalkern 2
      ... It sounds like you re playing with stack space. Is your function tail-recursive? If it is, such a behaviour should NOT show up, because such functions use
      Message 2 of 6 , Nov 17, 2003
      • 0 Attachment
        Il Tuesday 18 November 2003 07:42, Marco Pedeira ha scritto:
        > I have created a program that computes a
        > (rather complicated) function f defined over
        > the integers. I noticed that when trying to
        > compute the values of f(i) for i=1 to N (say)
        > ocaml does it more quickly if we open several
        > sessions and in each we ask ocaml to compute
        > f(i) for i in interval I_k, where we have
        > partitioned [1,N] into several intervals I_k,
        > rather than asking him directly to compute
        > f(i) for i in [1,N].
        > Now is there a way to make this division
        > directly in just one session without having
        > to repeat the same instruction several times ?
        > thanks in advance for any kind of help.
        >
        > Ewan

        It sounds like you're playing with stack space. Is your function
        tail-recursive? If it is, such a behaviour should NOT show up, because such
        functions use constant stack space.

        Ciao

        Ernesto
      • roparzhhemon
        No, it is essentially imperative indeed (the computation of f(i) is independent from the computation of f(j), although the program computing f(i) uses some
        Message 3 of 6 , Nov 18, 2003
        • 0 Attachment
          No, it is essentially imperative indeed (the computation
          of f(i) is independent from the computation of
          f(j), although the program computing f(i) uses some recursive
          auxiliary programs)



          Ewan



          --- In ocaml_beginners@yahoogroups.com, Stalkern 2 <stalkern2@t...> wrote:
          > Il Tuesday 18 November 2003 07:42, Marco Pedeira ha scritto:
          > > I have created a program that computes a
          > > (rather complicated) function f defined over
          > > the integers. I noticed that when trying to
          > > compute the values of f(i) for i=1 to N (say)
          > > ocaml does it more quickly if we open several
          > > sessions and in each we ask ocaml to compute
          > > f(i) for i in interval I_k, where we have
          > > partitioned [1,N] into several intervals I_k,
          > > rather than asking him directly to compute
          > > f(i) for i in [1,N].
          > > Now is there a way to make this division
          > > directly in just one session without having
          > > to repeat the same instruction several times ?
          > > thanks in advance for any kind of help.
          > >
          > > Ewan
          >
          > It sounds like you're playing with stack space. Is your function
          > tail-recursive? If it is, such a behaviour should NOT show up,
          because such
          > functions use constant stack space.
          >
          > Ciao
          >
          > Ernesto
        • harigato2002
          Hi, what about garbage collector? If there s some memory leak, the program can slow down while running, but if you start it in smaller blocks, the problem can
          Message 4 of 6 , Nov 18, 2003
          • 0 Attachment
            Hi,

            what about garbage collector?
            If there's some memory leak, the program
            can slow down while running, but if you
            start it in smaller blocks, the problem
            can remain hidden.

            bye


            --- In ocaml_beginners@yahoogroups.com, Marco Pedeira
            <roparzhhemon@y...> wrote:
            >
            > Hello ,
            >
            > I have created a program that computes a
            > (rather complicated) function f defined over
            > the integers. I noticed that when trying to
            > compute the values of f(i) for i=1 to N (say)
            > ocaml does it more quickly if we open several
            > sessions and in each we ask ocaml to compute
            > f(i) for i in interval I_k, where we have
            > partitioned [1,N] into several intervals I_k,
            > rather than asking him directly to compute
            > f(i) for i in [1,N].
            > Now is there a way to make this division
            > directly in just one session without having
            > to repeat the same instruction several times ?
            > thanks in advance for any kind of help.
            >
            > Ewan
            >
            >
            >
            >
            >
            > ______________________________________________________________________
            >
            > Yahoo! Mail: 6MB, anti-spam e antivĂ­rus gratuito! Crie sua conta agora:
            > http://mail.yahoo.com.br
          • Stalkern 2
            ... Do a profiling then. Start understanding which function fools you. The Garbage Collector should take no more than 1/3 of the overall resources Ciao Ernesto
            Message 5 of 6 , Nov 18, 2003
            • 0 Attachment
              Il Tuesday 18 November 2003 10:43, roparzhhemon ha scritto:
              > No, it is essentially imperative indeed (the computation
              > of f(i) is independent from the computation of
              > f(j), although the program computing f(i) uses some recursive
              > auxiliary programs)


              Do a profiling then. Start understanding which function fools you.
              The Garbage Collector should take no more than 1/3 of the overall resources

              Ciao

              Ernesto
            • Richard Jones
              ... Very odd. Is it an SMP machine? Each subtask might be being assigned to separate processors when you run them individually. Is the machine swapping during
              Message 6 of 6 , Nov 19, 2003
              • 0 Attachment
                On Tue, Nov 18, 2003 at 03:42:06AM -0300, Marco Pedeira wrote:
                >
                > Hello ,
                >
                > I have created a program that computes a
                > (rather complicated) function f defined over
                > the integers. I noticed that when trying to
                > compute the values of f(i) for i=1 to N (say)
                > ocaml does it more quickly if we open several
                > sessions and in each we ask ocaml to compute
                > f(i) for i in interval I_k, where we have
                > partitioned [1,N] into several intervals I_k,
                > rather than asking him directly to compute
                > f(i) for i in [1,N].
                > Now is there a way to make this division
                > directly in just one session without having
                > to repeat the same instruction several times ?
                > thanks in advance for any kind of help.

                Very odd.

                Is it an SMP machine? Each subtask might be being assigned to separate
                processors when you run them individually.

                Is the machine swapping during the calculation? (Try 'vmstat 1' and
                have a look at the si/so fields).

                Anyway, it sounds like you need to be using threads.

                Rich.

                --
                Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj
                Merjis Ltd. http://www.merjis.com/ - improving website return on investment
                MAKE+ is a sane replacement for GNU autoconf/automake. One script compiles,
                RPMs, pkgs etc. Linux, BSD, Solaris. http://www.annexia.org/freeware/makeplus/
              Your message has been successfully submitted and would be delivered to recipients shortly.