Created
May 8, 2017 19:26
-
-
Save mikaem/cdcfb6f21962c897fe6cc5bb414cac03 to your computer and use it in GitHub Desktop.
Testing if slab works for mpi4py-fft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import * | |
from mpi4py import MPI | |
from mpi4py_fft.mpifft import PFFT, Function | |
N = array([25, 28, 23], dtype=int) | |
for slab in range(3): | |
fft = PFFT(MPI.COMM_WORLD, N, axes=(0,1,2), collapse=False, slab=slab) | |
u = Function(fft, False) | |
u[:] = random.random(u.shape).astype(u.dtype) | |
u_hat = Function(fft) | |
u_hat = fft.forward(u, u_hat) | |
uj = zeros_like(u) | |
uj = fft.backward(u_hat, uj) | |
assert allclose(uj, u) | |
fft.destroy() | |
MPI.COMM_WORLD.barrier() | |
if MPI.COMM_WORLD.Get_rank() == 0: | |
print('Slab ', slab, ' is ok') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment