views:

42

answers:

2

I have a script execution engine in which the end users write scripts to run their test. Now we want to run about 40 tests in parallel. I was wondering if I should convert all the scripts(in Perl or VBA) to C# code and then parallelism it or try to control the scripting engine from C# to run all those scripts in parallel? Any suggestion or ideas would be helpful. One advantage I found with still using the script is that end users will be able to code their own test rather than coming to me for every change if it is in C#.

Also is it possible to run code in parallel across multiple PC and control it from one master PC using C#? I am new to C# parallel programming.

+1  A: 

Everything is possible! It is the question of time and effort and right approach.

Parallel programming is a new paradigm in C# 4.0 for running tasks in parallel in the same AppDomain (almost same as process but not always true as sometimes there can be more than one AppDomain per process). So you cannot run it on several machines using Parallel programming but you can implement your mini-GRID computing to run it on serveral machines.

If your tests can run in parallel - which they seem they can - you can run them in parallel with a few lines of code.

// not a real code
foreach(Test t in myTetsts.AsParallel())
{
   t.run();
}
Aliostad
This is the only time I would suggest c++ over other languages - Parallel programming. ^_^
Byron Cobb
A: 

I am assuming that you wish to run the tests in parallel to use all your CPUs and speed up the tests.

If the tests are standalone, why not just split the tests into a 4 sets of 10 tests each and then run 4 test executors at the same time. This will give you 4 processes that will be spread over your CPUs.

Not as good as controlling it at the thread level, but writing a batch file to start the 4 test runner is likely to be a lot less work.

Ian Ringrose