Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad performance #67

Open
ZhaiFeiyue opened this issue Aug 27, 2021 · 0 comments
Open

Bad performance #67

ZhaiFeiyue opened this issue Aug 27, 2021 · 0 comments

Comments

@ZhaiFeiyue
Copy link

hi all, I have tested torch.fft.fftn and mkl_fft.fftn, the performance is below measure in python

  • input size: 1,3,2160, 3840
  • axes = (-2, -1)
  • OMP_NUM_THREADS=10
  • mkl_fft.fftn cost: 0:00:05.664933
  • torch.fft.fftn cost: 0:00:00.404621
import torch
import numpy as np
from mkl_fft import fftn, fft2

import datetime

def numpy_fft(x):
    for i in range(10):
        y = fftn(x, axes=(-2,-1))
    return y

def torch_fft(x):
    for i in range(10):
        y = torch.fft.fftn(x, dim=(-2,-1))
    
    return y

data = np.random.uniform(0, 10, (1,3,2160, 3840))

torch_data = torch.from_numpy(data)

s = datetime.datetime.now()
y1 = numpy_fft(data)
e = datetime.datetime.now()


y2 = torch_fft(torch_data)
k = datetime.datetime.now()

print(np.max(y2.numpy() - y1))
print(e-s, k-e)

could anyone explains why mkl_fft is slow than torch.fft (almost 10x)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant