Пример #1
0
        /// <summary>
        /// Starts the runtime thread and all process threads and waits for the
        /// runtime to finish.
        /// </summary>
        /// <exception cref="MiniMPIExecutionException">At least one spawned process thread threw an exception.</exception>
        public static void Execute(int processCount, Action <IMiniMPIStringAPI> processWork)
        {
            if (processCount < 1)
            {
                throw new ArgumentOutOfRangeException("processCount", processCount, "Must be greater than zero.");
            }
            if (processWork == null)
            {
                throw new ArgumentNullException("processWork");
            }

            using (var executor = new MiniMPIProgram(processCount))
                using (var runtime = new MiniMPIStringRuntime(processCount))
                {
                    executor.Runtime          = runtime;
                    executor.CreateProcessAPI = (p) => new MiniMPIStringProcessAPI(runtime, p);
                    executor.Execute(processWork);
                }
        }
Пример #2
0
 internal MiniMPIStringProcessAPI(MiniMPIStringRuntime runtime, MpiProcess process)
     : base(runtime, process)
 {
     this.Runtime = (MiniMPIStringRuntime)base.Runtime;
 }