Skip to content

Commit a9b27b6

Browse files
committed
Fixing newDistArray such that it takes axis of PFFT pencil into account
1 parent 8f37fa3 commit a9b27b6

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

azure-pipelines.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
jobs:
22
- job: macOS
3-
displayName: macOS-10.13
3+
displayName: macOS-10.14
44
pool:
5-
vmImage: 'macOS-10.13'
5+
vmImage: 'macOS-10.14'
66
strategy:
77
matrix:
88
Python27:
@@ -11,6 +11,8 @@ jobs:
1111
python.version: '3.6'
1212
Python37:
1313
python.version: '3.7'
14+
Python38:
15+
python.version: '3.8'
1416

1517
steps:
1618
- bash: echo "##vso[task.prependpath]$CONDA/bin"

mpi4py_fft/distarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def newDistArray(pfft, forward_output=True, val=0, rank=0, view=False):
481481
dtype = pfft.forward.input_array.dtype
482482
global_shape = (len(global_shape),)*rank + global_shape
483483
z = DistArray(global_shape, subcomm=p0.subcomm, val=val, dtype=dtype,
484-
rank=rank)
484+
alignment=p0.axis, rank=rank)
485485
return z.v if view else z
486486

487487
def Function(*args, **kwargs): #pragma: no cover

mpi4py_fft/io/generate_xdmf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def generate_xdmf(h5filename, periodic=True, order='paraview'):
114114
order here.
115115
"""
116116
import h5py
117-
f = h5py.File(h5filename)
117+
f = h5py.File(h5filename, 'a')
118118
keys = []
119119
f.visit(keys.append)
120120
assert order.lower() in ('paraview', 'visit')

tests/test_fftw.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def test_fftw():
103103
idct = fftw.idctn(input_array, None, axes, type, threads, iflags, output_array=oa)
104104
A2 = idct(B, implicit=True, normalize=True)
105105
assert allclose(A, A2), np.linalg.norm(A-A2)
106-
if typecode is not 'g' and not type is 4:
106+
if typecode != 'g' and type != 4:
107107
B2 = scipy_dctn(A, axes=axes, type=type)
108108
assert allclose(B, B2), np.linalg.norm(B-B2)
109109

@@ -112,7 +112,7 @@ def test_fftw():
112112
idst = fftw.idstn(input_array, None, axes, type, threads, iflags, output_array=oa)
113113
A2 = idst(B, implicit=True, normalize=True)
114114
assert allclose(A, A2), np.linalg.norm(A-A2)
115-
if typecode is not 'g' and not type is 4:
115+
if typecode != 'g' and type != 4:
116116
B2 = scipy_dstn(A, axes=axes, type=type)
117117
assert allclose(B, B2), np.linalg.norm(B-B2)
118118

@@ -132,7 +132,7 @@ def test_fftw():
132132
M = fftw.get_normalization(kds, input_array.shape, axes)
133133
assert allclose(C2*M, A)
134134
# Test vs scipy for transforms available in scipy
135-
if typecode is not 'g' and not any(f in kds for f in (fftw.FFTW_RODFT11, fftw.FFTW_REDFT11)):
135+
if typecode != 'g' and not any(f in kds for f in (fftw.FFTW_RODFT11, fftw.FFTW_REDFT11)):
136136
for m, ts in enumerate(tsf):
137137
A = eval('scipy.fftpack.'+ts[:-1])(A, axis=axes[m], type=int(ts[-1]))
138138
assert allclose(C, A), np.linalg.norm(C-A)

tests/test_speed.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
N = (64, 64, 64)
1313
loops = 50
1414
axis = 1
15-
threads = 1
15+
threads = 4
1616
implicit = True
1717
flags = (fftw.FFTW_PATIENT, fftw.FFTW_DESTROY_INPUT)
1818

@@ -73,7 +73,7 @@
7373
ifft = fftw.ifftn(output_array, None, axes, threads, flags)
7474
t0 = time()
7575
for i in range(loops):
76-
B2 = ifft(C, normalize_idft=True, implicit=implicit)
76+
B2 = ifft(C, normalize=True, implicit=implicit)
7777
ftime[1].append(time()-t0)
7878
assert np.allclose(B, B2), np.linalg.norm(B-B2)
7979

@@ -140,7 +140,7 @@
140140
t0 = time()
141141
for i in range(loops):
142142
C2[:] = C
143-
D2 = irfft(C2, normalize_idft=True, implicit=implicit)
143+
D2 = irfft(C2, normalize=True, implicit=implicit)
144144
ftime[1].append(time()-t0)
145145
assert np.allclose(D, D2), np.linalg.norm(D-D2)
146146

0 commit comments

Comments
 (0)