Re: Invoking External Batch Program on Multiple Core Machine



On Wed, 16 May 2007 01:35:57 -0700, Luc The Perverse <sll_noSpamlicious_z_XXX_m@xxxxxxxxxx> wrote:

Hello! You may remember me as the guy who's trying to learn C# and using
that old version 2003 of visual studio. (Although free version of command line .NET compiler is available, so if some new feature would greatly
simplify my life, then I am not opposed)

A free version of the *IDE* is available, not just the command line compiler. You should upgrade, VS 2005 is very nice (I haven't used 2003, but I have a friend who is using it now and every time I mention "well, VS does this for me" he always finds himself saying "really? VS 2003 doesn't do that"...I gather it's a pretty significant upgrade, and frankly I was surprised at how much was left usable in the Express version, considering it's free).

I currently have an application that is single threaded that does batch work (you pass it a file in the command line, it runs for 2-45 minutes and spits out another file). I do not own the application and do not know what it is written in.

This is very annoying since I have a dual core machine and would like to get my work done as quickly as possible.

So long as you remember that "dual core" does not mean "dual hard drive" or "dual RAM". :) Depending on what that application is actually doing, you may or may not realize benefits by having it run in the background while you try to get something else done.

Is there a way to invoke a foreign application from C# to run on a specified core? (If so, can you point me to an example?)

You can use the Process class to start a new process with a specific command, and you can even set the ProcessorAffinity on the class instance to control what CPUs it runs on. However, why would you want to set a specific CPU? Windows is smart enough to distribute the workload fairly across whatever CPUs are available. There's no need to assign the process to a specific one.

Right now we do our work, click "compile" and then wait. Eventually I would like to try to implement some form of distributed computing on all our
office computers, so that someone needing to compile 4-5 items can occupy
the same number of idle cores accross the network.

The idea is sound. So sound, in fact, that I'm pretty sure I've read of implementations that already exist to do this sort of thing. I think there are even general-purpose solutions that you might be able to use off-the-shelf. That said, depending on what exactly you're trying to do, it may not be very hard to do it. Use some sort of peer-to-peer architecture to control workload requests (.NET remoting? Socket? WCF? Whatever...), run the process (capturing the output if you like).

Just keep in mind the caveat I mentioned at the outset: just because a CPU core is available, that doesn't mean that running a process on the computer won't impact whatever work someone else is already doing on the computer.

Pete
.



Relevant Pages

  • 64 bit Dual-Core Moron
    ... if you just do a 'make' then one core is mostly going to ... Since you have a dual core cpu, then each of those cpus may ... I see you have twice the RAM as I do. ... -j 4) your compiler processes are only using up a small portion of the ...
    (Debian-User)
  • TIP #257: Object Orientation for Tcl
    ... designed specifically to allow classic XOTcl to be built on top. ... the time has come for the core to provide OO support. ... definition is to be moved to a separate utility command, ... every class and every object has an associated namespace. ...
    (comp.lang.tcl)
  • [Fwd: TIP #257: Object Orientation for Tcl]
    ... designed specifically to allow classic XOTcl to be built on top. ... the time has come for the core to provide OO support. ... definition is to be moved to a separate utility command, ... every class and every object has an associated namespace. ...
    (comp.lang.tcl)
  • Re: [OT] Re: Whats the name for this?
    ... I need to point out that the older CPUs ... > step from the earlier dedicated computing devices. ... > in cases where the programmers themselves are more comfortable in a CISC ... > who programs with no knowledge of how a compiler works. ...
    (comp.programming)
  • Re: gfortran iso c bindings - capabilities
    ... free to pick any companion processor it chooses. ... invoked with different command line options. ... if %errorlevel% NEQ 0 goto errorexit ... The compiler is supposed to incorporate the information about the ...
    (comp.lang.fortran)