Ejemplo n.º 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
 }
Ejemplo n.º 2
0
        public CustomDistributedFft(Mpi mpi, IProfiler profiler = null)
        {
            _mpi      = mpi;
            _profiler = profiler;

            Fftw.InitThreads();
            FftwMpi.Init();
            Fftw.PlanWithNthreads(MultiThreadUtils.MaxDegreeOfParallelism);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 6
0
 public void Dispose()
 {
     FftwMpi.Cleanup();
 }
Ejemplo n.º 7
0
 public void ExecutePlan(FftwPlan plan, IntPtr src, IntPtr dst)
 => FftwMpi.ExecuteDft(plan.Handler, src, dst);