Skip to content

Bad performance #67

Open
Open
@ZhaiFeiyue

Description

@ZhaiFeiyue

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)?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ZhaiFeiyue

        Issue actions

          Bad performance · Issue #67 · IntelPython/mkl_fft