DEV Community

Hai Tran
Hai Tran

Posted on

Arm Gravition Versus X86 on Fibonaci and FFT Running Time

Summary

According to AWS Graviton2 the Arm Graviton provides 34% better price performance than X86. In some sense, it runs faster 34% compared with X86. So I do a small experiment to check this. AWS CDK and CodeBuild with Arm based instance makes it easy to setup. So the Graviton does run about 30% faster than X86. GitHub

  • Runtime Python 3.8
  • Numpy 1.22.1
  • Lambda memory 2048MB
  • Lambda timeout 10 seconds

CDK Pipeline

CDK make it very friendly to build this pipeline, feeling like pure programming infrastructure.
156108554-8f6f728f-cf18-4a08-b0df-2d9773e860aa

Running time for Fibonaci

def recur_fibo(n):
    if n <= 1:
        return n
    else:
        return(recur_fibo(n-1) + recur_fibo(n-2))
Enter fullscreen mode Exit fullscreen mode

n = 30 used for testing.
123456

Running time for FFT single thread

data = np.random.rand(8192, 8192)
np.fft.fft(data, axis=0)
Enter fullscreen mode Exit fullscreen mode

single_thread_fft

Running time for FFT multi-thread (Lambda memory 10240MB)

data = [np.random.rand(8192, 2048) for k in range(4)]
with ThreadPoolExecutor(max_worker=4) as executor:
  for x in data:
    executor.submit(np.fft.fft, x, axis=0)
Enter fullscreen mode Exit fullscreen mode

multi_thread_fft_1

Top comments (0)