Skip to content

Commit a95ce7b

Browse files
make sure to set F/B scales in the descriptor to match what is happening in Python
1 parent e6ccebd commit a95ce7b

8 files changed

Lines changed: 51 additions & 2 deletions

File tree

‎native/fft2_cdp-in-c.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ int main() {
8686
status = DftiCommitDescriptor(hand);
8787
assert(status == 0);
8888

89+
status = DftiSetValue(hand, DFTI_FORWARD_SCALE, 1.0);
90+
assert(status == 0);
91+
92+
status = DftiSetValue(hand, DFTI_BACKWARD_SCALE, 1.0/(N1 * N2));
93+
assert(status == 0);
94+
8995
// status = DftiSetValue(hand, DFTI_COMPLEX_STORAGE, DFTI_COMPLEX_COMPLEX);
9096
// assert(status == 0);
9197

‎native/fft2_cdp-in-nc.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ int main() {
6868

6969
warm_up_threads();
7070

71-
for(si=0; si < samps; time_tot=0, si++) {
71+
for(si=0; si < samps; si++) {
7272

73-
for(it = -1; it <reps; it++) {
73+
for(time_tot=0, it = -1; it <reps; it++) {
7474

7575
cblas_zcopy(N, (void *) x, 1, (void *) buf, 1); /* buf = x */
7676
/* memcpy(buf, x, N*sizeof(MKL_Complex16)); */
@@ -88,6 +88,12 @@ int main() {
8888
status = DftiSetValue(hand, DFTI_INPUT_STRIDES, strides);
8989
assert(status == 0);
9090

91+
status = DftiSetValue(hand, DFTI_FORWARD_SCALE, 1.0);
92+
assert(status == 0);
93+
94+
status = DftiSetValue(hand, DFTI_BACKWARD_SCALE, 1.0/(N1 * N2));
95+
assert(status == 0);
96+
9197
status = DftiCommitDescriptor(hand);
9298
assert(status == 0);
9399

‎native/fft2_cdp-out-c.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ int main() {
8787
status = DftiSetValue(hand, DFTI_OUTPUT_STRIDES, strides);
8888
assert(status == 0);
8989

90+
status = DftiSetValue(hand, DFTI_FORWARD_SCALE, 1.0);
91+
assert(status == 0);
92+
93+
status = DftiSetValue(hand, DFTI_BACKWARD_SCALE, 1.0/(N1 * N2));
94+
assert(status == 0);
95+
9096
status = DftiCommitDescriptor(hand);
9197
assert(status == 0);
9298

‎native/fft2_cdp-out-nc.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ int main() {
8989
status = DftiSetValue(hand, DFTI_OUTPUT_STRIDES, strides);
9090
assert(status == 0);
9191

92+
status = DftiSetValue(hand, DFTI_FORWARD_SCALE, 1.0);
93+
assert(status == 0);
94+
95+
status = DftiSetValue(hand, DFTI_BACKWARD_SCALE, 1.0/(N1 * N2));
96+
assert(status == 0);
97+
9298
status = DftiCommitDescriptor(hand);
9399
assert(status == 0);
94100

‎native/fft3_cdp-in-c.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ int main() {
7979
status = DftiSetValue(hand, DFTI_INPUT_STRIDES, strides);
8080
assert(status == 0);
8181

82+
status = DftiSetValue(hand, DFTI_FORWARD_SCALE, 1.0);
83+
assert(status == 0);
84+
85+
status = DftiSetValue(hand, DFTI_BACKWARD_SCALE, 1.0/(N1 * N2 * N3));
86+
assert(status == 0);
87+
8288
status = DftiCommitDescriptor(hand);
8389
assert(status == 0);
8490

‎native/fft3_cdp-in-nc.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ int main() {
8989
status = DftiSetValue(hand, DFTI_INPUT_STRIDES, strides);
9090
assert(status == 0);
9191

92+
status = DftiSetValue(hand, DFTI_FORWARD_SCALE, 1.0);
93+
assert(status == 0);
94+
95+
status = DftiSetValue(hand, DFTI_BACKWARD_SCALE, 1.0/(N1 * N2 * N3));
96+
assert(status == 0);
97+
98+
9299
status = DftiCommitDescriptor(hand);
93100
assert(status == 0);
94101

‎native/fft3_cdp-out-c.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ int main() {
8383
status = DftiSetValue(hand, DFTI_OUTPUT_STRIDES, strides);
8484
assert(status == 0);
8585

86+
status = DftiSetValue(hand, DFTI_FORWARD_SCALE, 1.0);
87+
assert(status == 0);
88+
89+
status = DftiSetValue(hand, DFTI_BACKWARD_SCALE, 1.0/(N1 * N2 * N3));
90+
assert(status == 0);
91+
8692
status = DftiCommitDescriptor(hand);
8793
assert(status == 0);
8894

‎native/fft3_cdp-out-nc.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ int main() {
9090
status = DftiSetValue(hand, DFTI_OUTPUT_STRIDES, strides);
9191
assert(status == 0);
9292

93+
status = DftiSetValue(hand, DFTI_FORWARD_SCALE, 1.0);
94+
assert(status == 0);
95+
96+
status = DftiSetValue(hand, DFTI_BACKWARD_SCALE, 1.0/(N1 * N2 * N3));
97+
assert(status == 0);
98+
9399
status = DftiCommitDescriptor(hand);
94100
assert(status == 0);
95101

0 commit comments

Comments
 (0)