### ARM on AWS for R

##### June 15, 2020

Amazon AWS has been recommending ARM Graviton2 as a cost-effective alternative to Intel/AMD instances. So I tried it out.

I have been running a lot of embarrassingly parallel R jobs on AWS, using mclapply on Ubuntu 18.04. All on the same type of x86 based instances I've been using for years. Then I read about ARM Graviton2 and gave it a try. For good measure, I included my Mac laptop.

Below I show the timings for a typical job, on 16 vCPU instances and on demand prices.

Machine Hourly cost Processor maker Processor type R version Cores and time
16 8 4 2 1
c5a.4xlarge $0.6880 AMD Zen 3.6.3 03:41 04:24 08:11 16:09 24:54 c5a.4xlarge$0.6880 AMD Zen 4.0.1 03:54 04:39 08:40 17:23 27:01
c6g.4xlarge \$0.6144 ARM Graviton2 4.0.1 03:38 06:26 11:53 23:31 36:11
mac pro   Intel 2.4 GHz 8-Core Intel Core i9 3.6.3 04:23 04:45 07:06 12:41 18:12
mac pro   Intel 2.4 GHz 8-Core Intel Core i10 4.0.1 04:23 04:45 07:06 12:41 18:12

I didn't quite get the 40% cost-per-performance Amazon promises, but the ARM is 20% cheaper than x86 (14% if I use R 3.6).

But that only holds if one uses all 16 cores. Since x86 has hyperthreading, by doing a 16 core run on the x86 16 vCPU machine we don't have 16 real cores, but 8. And the x86 is faster per real core.

So ARM is better if one keeps all cores fully engaged at all times, else x86 has the cost advantage.

I did not expect the old R 3.6.3 to be faster than the latest 4.0.1 on Ubuntu (but not the mac) but here we are.