private ScalarSegments CalculateParallelScalars(ScalarPlan plan, Transceiver[] transceivers)
        {
            var pm = new ParallelManager <Transceiver>(Mpi).WithTasks(transceivers);

            GreenScalars   gs            = null;
            ScalarSegments localSegments = null;

            pm.Run(tasks =>
            {
                using (Profiler?.StartAuto(ProfilerEvent.GreenScalarAtoACalc))
                {
                    gs = _scalarCalc.Calculate(plan, tasks, Profiler);
                }

                using (Profiler?.StartAuto(ProfilerEvent.GreenScalarAtoASegments))
                {
                    localSegments = ScalarSegments.AllocateAndConvert(MemoryProvider, plan, gs);
                }
            });

            using (Profiler?.StartAuto(ProfilerEvent.GreenScalarAtoACommunicate))
            {
                var allSegments1 = ScalarSegments.AllocateScalarSegments(MemoryProvider, plan, gs, transceivers.Length);
                var allSegments2 = ScalarSegments.AllocateScalarSegments(MemoryProvider, plan, gs, transceivers.Length);

                DistributeSegments(plan, pm, gs, localSegments, allSegments1, allSegments2);
                localSegments.Dispose();

                allSegments1.Dispose();
                return(allSegments2);
            }
        }
        private ScalarSegments CalculateLocalScalars(ScalarPlan plan, Transceiver[] transceivers)
        {
            GreenScalars gs;

            using (Profiler?.StartAuto(ProfilerEvent.GreenScalarAtoACalc))
            {
                gs = _scalarCalc.Calculate(plan, transceivers, Profiler);
            }

            using (Profiler?.StartAuto(ProfilerEvent.GreenScalarAtoASegments))
            {
                var segments = ScalarSegments.AllocateAndConvert(MemoryProvider, plan, gs);
                return(segments);
            }
        }
Ejemplo n.º 3
0
        private GreenTensor CalculateGreenTensorAtoOSiteElectric(ObservationSite site)
        {
            var plan             = _plansCreater.CreateForAnomalyToObservationSites(site);
            var transceiver      = TranceiverUtils.CreateAnomalyToObservation(Model.Anomaly, site);
            var scalarCalculator = GreenScalarCalculator.NewAtoOElectricCalculator(Logger, Model);
            var scalars          = scalarCalculator.Calculate(plan, transceiver);

            var calc     = new AtoOSiteGreenTensorCalculator(Logger, Model, MemoryProvider);
            var segments = ScalarSegments.AllocateAndConvert(MemoryProvider, plan, scalars);

            var gt = calc.CalculateAtoOElectric(segments, site, MemoryLayoutOrder.AlongLateral);

            segments.Dispose();

            return(gt);
        }
Ejemplo n.º 4
0
        private GreenTensor CalculateGreenTensorElectric(SourceLayer layer, ObservationLevel level)
        {
            var plan             = _plansCreater.CreateForSourceToObservation(layer, level);
            var transceiver      = TranceiverUtils.CreateSourceToObservations(SourceThickness, layer, level);
            var scalarCalculator = GreenScalarCalculator.NewAtoOElectricCalculator(Logger, Model);
            var scalars          = scalarCalculator.Calculate(plan, transceiver);

            using (var segments = ScalarSegments.AllocateAndConvert(MemoryProvider, plan, scalars))
            {
                var tensorPlan = new TensorPlan(_templateTensorPlan, layer, level);
                _gtc.ResetKnots();
                var gt = _gtc.CalculateAtoOElectric(segments, MemoryLayoutOrder.AlongVertical, tensorPlan);

                PerformGreenTensorFft(gt);
                return(gt);
            }
        }
Ejemplo n.º 5
0
        private unsafe GreenTensor CalculateGreenTensorAtoOLevelElectric(ObservationLevel level)
        {
            using (Solver.Profiler?.StartAuto(ProfilerEvent.AtoOGreenCalc))
            {
                var plan             = _plansCreater.CreateForAnomalyToObservationLevels(level);
                var transceiver      = TranceiverUtils.CreateAnomalyToObservation(Model.Anomaly, level);
                var scalarCalculator = GreenScalarCalculator.NewAtoOElectricCalculator(Logger, Model);
                var scalars          = scalarCalculator.Calculate(plan, transceiver);

                using (var segments = ScalarSegments.AllocateAndConvert(MemoryProvider, plan, scalars))
                {
                    var tensorPlan = new TensorPlan(_templateTensorPlan, level);
                    _gtc.ResetKnots();
                    var gt = _gtc.CalculateAtoOElectric(segments, MemoryLayoutOrder.AlongVertical, tensorPlan);

                    PerformGreenTensorFft(gt);
                    return(gt);
                }
            }
        }