Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: running multiple mathkernel's

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90526] Re: running multiple mathkernel's
  • From: Bob F <deepyogurt at gmail.com>
  • Date: Fri, 11 Jul 2008 05:57:00 -0400 (EDT)
  • References: <g4vjkb$9c3$1@smc.vnet.net> <g54oh9$esa$1@smc.vnet.net>

On Jul 10, 4:33 am, John Jowett <John.M.Jow... at gmail.com> wrote:
> First of all, it should be said that people often want two different
> notebooks to run the same kernel so that's why new notebooks normally
> just run the same default kernel. Speaking for myself, I think that's
> the most common situation.
>

What advantage is there to having two notebooks run sequentially with
one MathKernel? Is there a disadvantage to having two MathKernel's run
the two notebooks?

> Once you have set up a second kernel, its parameters are remembered
> from one Front End session to the next so all you have to do is change
> a given notebook's kernel in the Evaluation menu.  That's really very
> little trouble, in my opinion.
>

I agree it is once you figure it out, but how much time did you spend
doing it and getting it to work the first time you ever tried it?

> I don't set up non-default kernels to launch automatically on startup:
> this would slow down startup and use memory unnecessarily in the
> majority of sessions where I only use one kernel.
>

I agree completely, but when you open up and run a program in that
second notebook, wouldn't it be nice to have it running concurrently
with the other and to have that happen automatically for you without
having to manually fire up another MathKernal? There would be no need
to fire up the second MathKernel until the second notebook was running
and the first one was already busy.

> Personally, I have a few kernels set up (some of them launch on other
> computers) for when I need to run separate or background
> calculations.
>
> Mathematica's Front End + Kernel design is very flexible:   you can
> send expressions from one kernel to another,
> use a different kernel for different cells within the same notebook,
> etc. etc.

But you still have to do this manually. All I'm saying is that what is
the down side for this to happen automatically?

>
> John Jowett
>
> On Jul 8, 1:38 pm, Bob F <deepyog... at gmail.com> wrote:
>
> > Is there a way to automatically have Mathematica v6 run a separate
> > MathKernel for two notebooks so that they could run concurrently? I
> > was running a really long calculation that ended up taking about an
> > hour, and so opened up another notebook to do something else while I
> > waited for the other notebook to finish running. I thought that
> > Mathematica would run the second MathKernel that is available for this
> > second notebook, but the only thing that happened in the second
> > notebook was wait for the first one to finish.
>
> > So I started looking into setting up a second kernel via the
> > "Evaluation/Kernel Configuration Options" menu item, and added a
> > second MathKernel to automatically launch on front end startup,
> > thinking that Mathematica would use this spare MathKernel on the
> > second notebook, but it didn't. I could see the two MathKernel
> > processes running, but only one of them would actually run all the
> > notebooks that I tried to run at the same time.
>
> > What I ended up doing was manually assigning a kernel to the second
> > notebook with the "Evaluation/Notebook's Kernel", and then finally it
> > would run at the same time as the other. I tried this on both Mac and
> > Windows versions of Mathematica V6 with similar behavior and results.
>
> > After spending the time in getting all this done, I thought surely
> > there must be a way for Mathematica to automatically use as many
> > MathKernel's as needed for running more than one notebook at a time,
> > within the limit's of your licenses. With a normal Mathematica license
> > you can run up to two MathKernel processes and one front end
> > Mathematica processor. I even thought that if you had two licenses on
> > two different computers that you could conceivably run 4 MathKernel's,
> > but this is apparently only possible if you have something called
> > network licensing, which costs more money than a normal license. There
> > is also something called PersonalGrid that has up to 5 MathKernals (1
> > master plus 4 computation kernels) but am guessing it would have the
> > same issue of having to manually assign a kernel to a notebook, so
> > each notebook program could conceivably run at the same time. Does
> > anyone know if this is the case or not? If not how does it really
> > work?
>
> > What is the purpose of having two MathKernel processes as part of the
> > license if you have to go thru all the extra work of manual
> > assignment? Why doesn't Mathematica do this automatically for you??  =
I
> > had a suggestion that I should run two copies of Mathematica, but that
> > seemed way to much overhead for what I wanted to do. Is this what most
> > people do who have a similar situation of one really long calculation
> > and wanting to do other work in another notebook while waiting for the
> > long one to finish?
>
> > Does anyone have any suggestions on how to do this association of
> > notebooks to MathKernel processes so that they could be running at the
> > same time in some sort of automatic fashion and avoid having to
> > manually manage it like I did?? It would seem that with multi-core and
> > multi-processor systems becoming more common that this would be of
> > interest to more and more people. Any comments or suggestions of how
> > this works in Mathematica?
>
> > Thanks...
>
> > -Bob

Why wouldn't you want two kernels running for two notebooks if you
have a multiprocessor computer? Wouldn't that result in better use of
your time to have them running concurrently rather than sequentially?

I think the changes required of Mathematica would be pretty minimal,
since you can already easily do it manually if you know how. But it
took a while looking up how to do this and several experiments before
I got it working. But I agree that now that I have done it, it is easy
to do manually, but I think it would be nice if Mathematica took care
of that for you automatically. I would guess it would be fairly
trivial to find out if you have more than one or two or three
processors and run more than one mathkernel program if you are trying
to run two or more notebooks at the same time - and especially if you
have a grid version of Mathematica. Is there a downside to running two
(or more) mathkernel programs at the same time if you have the CPU's
and memory to take advantage of this kind of multi-tasking?

I know it depends on what the two notebooks are doing as I have
noticed that some things happen to take advantage of the multiple
processors automatically as I can watch the CPU usage screen increase
for all the processors for certain things in Mathematica when only
running one program in one notebook. But generally, wouldn't you be
better off if you had multiple notebooks running concurrently rather
than sequentially?

I think Wolfram might want to consider offering another version of
Mathematica that was geared for this kind of user -- someone who has a
multi-processor system like a 4-core or 8-core MacPro and worked in a
multi-tasking mode, but wasn't that interested in doing the PCT
(Parallel Computing Toolkit) type of programming that the Grid
versions of the product are capable of. It would be priced between the
regular Mathematica license and the PersonalGrid version as it would
not include the PCT. Could someone from Wolfram comment about the
possibility of this? Perhaps I am the only one in the world this
appeals to, but I would hope not ;-)

-Bob


  • Prev by Date: Re: How to replace TextListPlot ?
  • Next by Date: Re: VectorFieldPlot scaling
  • Previous by thread: Re: running multiple mathkernel's
  • Next by thread: Re: running multiple mathkernel's