示例#1
0
        static void Main(string[] args)
        {
            MPIController mpiController = new MPIController();

            using (new MPI.Environment(ref args))
            {
                if (Communicator.world.Rank == 0)
                {
                    //master process

                    mpiController.grayScaleMaster("../../../InputPhotos/cat-800x600.jpg", "../../../OutputPhotos/gray-cat-800x600");
                    mpiController.grayScaleMaster("../../../InputPhotos/cat-1600x1200.jpg", "../../../OutputPhotos/gray-cat-1600x1200");
                    mpiController.grayScaleMaster("../../../InputPhotos/cat-4096x2160.jpg", "../../../OutputPhotos/gray-cat-4096x2160");

                    Console.WriteLine("\n");

                    mpiController.gaussianBlurMaster("../../../InputPhotos/cat-800x600.jpg", "../../../OutputPhotos/blur-cat-800x600");
                    mpiController.gaussianBlurMaster("../../../InputPhotos/cat-1600x1200.jpg", "../../../OutputPhotos/blur-cat-1600x1200");
                    mpiController.gaussianBlurMaster("../../../InputPhotos/cat-4096x2160.jpg", "../../../OutputPhotos/blur-cat-4096x2160");
                }
                else
                {
                    //child process

                    mpiController.grayScaleWorker();
                    mpiController.grayScaleWorker();
                    mpiController.grayScaleWorker();

                    mpiController.gaussianBlurWorker();
                    mpiController.gaussianBlurWorker();
                    mpiController.gaussianBlurWorker();
                }
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            MPIController mpiController = new MPIController();

            using (new MPI.Environment(ref args))
            {
                if (Communicator.world.Rank == 0)
                {
                    //master process

                    mpiController.grayScaleMaster("../../../../data/pexels-photo-640x336.jpeg", "../../../data/gray_img640x336");
                    mpiController.grayScaleMaster("../../../../data/pexels-photo-1280x733.jpeg", "../../../data/gray_img1280x733");
                    mpiController.grayScaleMaster("../../../../data/animal-beagle-canine-2048x1174.jpg", "../../../data/gray_img2048x1174");

                    Console.WriteLine("\n");

                    mpiController.gaussianBlurMaster("../../../../data/pexels-photo-640x336.jpeg", "../../../data/blur_img640x336");
                    mpiController.gaussianBlurMaster("../../../../data/pexels-photo-1280x733.jpeg", "../../../data/blur_img1280x733");
                    mpiController.gaussianBlurMaster("../../../../data/animal-beagle-canine-2048x1174.jpg", "../../../data/blur_img2048x1174");
                }
                else
                {
                    //child process

                    mpiController.grayScaleWorker();
                    mpiController.grayScaleWorker();
                    mpiController.grayScaleWorker();

                    mpiController.gaussianBlurWorker();
                    mpiController.gaussianBlurWorker();
                    mpiController.gaussianBlurWorker();
                }
            }
        }