예제 #1
0
 protected virtual void DistributedTranspose(CustomFftPlan data, UnsafeArray src, UnsafeArray dst)
 {
     FftwMpi.ExecuteR2r(data.TransposePlan.Handler, new IntPtr(src.Ptr), new IntPtr(dst.Ptr));
     //int size = data.NumberOfLocalFftsAlongSecondDimension * data.LocalNx;
     //_mpi.AllToAll(data.Output.Ptr, size, data.Input.Ptr, size);
     //All2All
 }
예제 #2
0
        public CustomDistributedFft(Mpi mpi, IProfiler profiler = null)
        {
            _mpi      = mpi;
            _profiler = profiler;

            Fftw.InitThreads();
            FftwMpi.Init();
            Fftw.PlanWithNthreads(MultiThreadUtils.MaxDegreeOfParallelism);
        }
예제 #3
0
        public FftwPlan CreatePlan(IntPtr memory, int fullNx, int fullNy, int nz, Direction direction, Flags flags)
        {
            var n = new[] { new IntPtr(fullNx), new IntPtr(fullNy), };

            var plan = FftwMpi.PlanManyDft(2, n, new IntPtr(nz), FFTW_MPI_DEFAULT_BLOCK, FFTW_MPI_DEFAULT_BLOCK,
                                           memory, memory, Mpi.CommWorld, (int)direction, (uint)flags);

            return(new FftwPlan(fullNx, fullNy, nz, plan));
        }
예제 #4
0
        public int GetLocalN0(int fullNx, int fullNy, int nz)
        {
            var    n = new[] { new IntPtr(fullNx), new IntPtr(fullNy), };
            IntPtr localN0;
            IntPtr localN0Start;

            long localSize = FftwMpi.LocalSizeMany(2, n, new IntPtr(nz),
                                                   FFTW_MPI_DEFAULT_BLOCK, Mpi.CommWorld, out localN0, out localN0Start).ToInt64();

            return(localN0.ToInt32());
        }
예제 #5
0
        private void CreateTransposePlan(CustomFftPlan data, uint flags)
        {
            var n   = new IntPtr(2 * data.NumberOfLocalFftsAlongSecondDimension * data.LocalNx);
            var np  = new IntPtr(data.NumberOfMpiProcesses);
            var one = new IntPtr(1);

            var input  = new IntPtr(data.Input.Ptr);
            var output = new IntPtr(data.Output.Ptr);

            var handler = FftwMpi.PlanManyTranspose(np, np, n, one, one, input, output, _mpi.Communicator, flags);

            data.TransposePlan = new FftwPlan(np.ToInt32(), np.ToInt32(), n.ToInt32(), handler);
        }
예제 #6
0
 public void Dispose()
 {
     FftwMpi.Cleanup();
 }
예제 #7
0
 public void ExecutePlan(FftwPlan plan, IntPtr src, IntPtr dst)
 => FftwMpi.ExecuteDft(plan.Handler, src, dst);