Skip to content

PyTorch Performance : MacBook Pro vs Surface Book in 2024

  • Python

For those starting with machine learning using PyTorch or considering switching from a desktop to a laptop, one common question is: which laptop should I choose? More specifically, is a MacBook or a Windows PC better suited for the task? It’s a tough decision, especially since cheaper laptops often don’t offer the performance you need, while those with better specs can be quite expensive. However, just because a laptop is pricey doesn’t necessarily mean it will perform better for machine learning. There are specific hardware configurations that are more suitable for this type of workload.

Generally, the performance of machine learning tasks is heavily dependent on the GPU, with most machine learning setups relying on NVIDIA GPUs and CUDA libraries for acceleration. This makes it easier to predict performance based on the specific NVIDIA product lineup in your laptop. However, in recent years, Apple’s custom silicon processors, the M1 and M2, have been receiving high praise for their unexpectedly strong machine learning capabilities. These new processors not only consume significantly less power compared to Intel CPUs but also deliver impressive performance, which has caught many by surprise.

In this blog post, I will share a performance comparison between two laptops often considered for machine learning tasks: the Microsoft Surface Book 3, which is equipped with an NVIDIA GPU, and the Apple MacBook Pro with the M2 Pro chip. Both machines ran the same PyTorch-based machine learning program, and I’ll be discussing the results.

For those interested in using PyTorch’s MPS acceleration on MacBooks, I’ve also written a post detailing how to enable this feature, which could be useful if you’re working in the Apple ecosystem.

If you are interested in implementing systems where programs in C++ and in Python communicates with each other, you might want to check out my other post introducing a great way to do it.



macsurf

Surface Book 3 vs. MacBook Pro – A Comparison of Specs

Before diving into the actual performance test, let’s first take a quick look at the specs of both laptops. When it comes to machine learning performance, the most critical factors can be ranked as GPU > CPU > RAM. However, the GPU is by far the most crucial element.

Although the Surface Book 3 has been on the market for a few years now, it was part of Microsoft’s high-end lineup at the time of its release and still holds up reasonably well. That said, the more recent Surface Laptop Studio 2 comes equipped with a more advanced GPU, offering superior performance in this regard. According to general GPU benchmarking comparisons, the newer Surface Laptop Studio 2 is about 60% faster than the Surface Book 3.

On the other hand, there are some comparison reviews between the latest Surface Laptop Studio 2 and the MacBook Pro with the M2 Pro chip. Interestingly, these reviews often conclude that the M2 Pro outperforms in terms of GPU rendering capabilities, showcasing Apple’s advancements in their silicon architecture. [reference]

This highlights how important it is to evaluate not just the specs on paper but the real-world performance when considering a machine for machine learning tasks. [reference]

Surface Book 3 (i7)

GPUNVIDIA GeForce GTX 1660 TI
GPU RAM6GB GDDR6
CPUIntel Core i7-1065G7 Quad-core
RAM32GB DDR4
Microsoft Surface Book 3

MacBook Pro (M2 Pro)

GPU16-core GPU (16 Neural Engine Core)
GPU RAM16GB LPDDR5 (Unified Memory)
CPUM2 Pro
RAM16GB LPDDR5 (Unified Memory)
Apple MacBook Pro M2

With the release of its new processors, Apple has shifted away from the traditional architecture where the processor and memory are separate components, opting instead for a unified resource-sharing architecture. This makes direct spec comparisons with other PCs more challenging. In a typical PC, the RAM used by the CPU is distinct from the RAM used by the GPU. However, with Apple’s processors, nearly all computing resources—CPU, GPU, and RAM—are integrated into a single chip, allowing for more efficient resource sharing.

When it comes to the CPU, clock speeds have already become less meaningful as a sole indicator of performance, and Apple’s approach has further minimized the relevance of clock speed figures. For instance, while the M2 Pro’s clock speed is listed at 1.4 GHz, it outperforms many CPUs running at over 3 GHz in terms of actual processing power.

In machine learning, the role of the CPU is largely limited to preprocessing data before handing it over to the GPU for computation. As a result, the CPU does not have a significant impact on the overall performance of machine learning tasks.

What remains particularly impressive, and well-documented, is the power efficiency of Apple’s chips. The 10th-generation Intel i7 processor in the Surface Book 3 has a maximum power consumption of 25W, and this doesn’t even account for the additional power used by the GPU. In contrast, the M2 Pro’s total power consumption is just 15W, encompassing both the CPU and GPU. Of course, the difference in release timelines and process technologies plays a role in these efficiency gains, but it’s clear that Apple’s approach has pushed the boundaries of both performance and energy efficiency.

PyTorch Training Performance Comparison

Setting aside the specs, let’s dive into the actual training performance. For this comparison, we used identical Python code that runs on both systems, specifically using the Convolutional Neural Network (CNN) example from the official PyTorch documentation for classifying the MNIST dataset. The testing environment details are as follows: [Link to test code]

VersionsSurface Book 3MacBook Pro
Python Version3.9.133.9.6
PyTorch Version2.1.22.3.0
GPU AccelerationCUDA 11.8MPS
Testing Setup

The default number of epochs for the example is set to 14, but for this test, we adjusted it to 10 epochs. We measured and recorded the training time and testing time for each epoch separately to provide a clear breakdown of the performance on each system.

pytorch 맥북 서피스북 비교

Training Time Comparison

The training times for each epoch showed that the M2 Pro MacBook significantly outperformed the Surface Book, with the MacBook being more than twice as fast. On average, the Surface Book’s training time was approximately 18.05 seconds per epoch, while the MacBook averaged around 8.11 seconds per epoch.

Testing Time Comparison

Interestingly, the gap in testing time was even more pronounced than during training. The Surface Book averaged about 5.21 seconds for testing, whereas the MacBook took only 0.56 seconds on average. This difference is particularly striking given that the same dataset was used for both systems.

While it’s hard to pinpoint the exact reason for such a dramatic disparity in testing time, one plausible explanation could be related to how Apple’s unified architecture handles data processing. Since all resources (CPU, GPU, and memory) are integrated into a single chip on Apple Silicon, the M2 Pro might have a significant advantage in efficiently processing and transferring data during the testing phase, particularly for tasks like data preprocessing and inference, where the bottleneck is often in data transfer between components.

Power Consumption During Training

In addition to the performance differences, I observed a significant disparity in power consumption between the two laptops during the training process. According to the Surface Book’s specifications, its CPU and GPU have a listed power consumption of 25W and 60W respectively. However, when running the actual training process, it seems that the Surface Book dynamically adjusts its power usage to lower levels than the maximum specified.

Below is the data I collected from monitoring the Surface Book’s load and power consumption during the training process. This data gives insight into how efficiently the Surface Book manages its power under load, especially when handling machine learning tasks using PyTorch.

In comparison, Apple’s M2 Pro, which has a much lower total power consumption of around 15W, including both CPU and GPU, provides a notable advantage in energy efficiency. This power difference plays a major role in long-term use, especially when working on extended machine learning training sessions, as it directly impacts both battery life and heat generation.

power cons
Brown: GPU Power Consumption Green: CPU Power Consumption

During the training process, the GPU power consumption of the Surface Book was consistently around 21W, while the CPU consumed approximately 17W. Combining these, we get a total power consumption of about 38W. In comparison, the M2 Pro’s maximum power consumption is around 15W—less than half of the Surface Book’s consumption, despite the fact that the M2 Pro delivered twice the performance. This stark contrast in both power efficiency and performance suggests that, at least for machine learning tasks, the M2 Pro clearly outperforms the Surface Book, making further comparisons unnecessary.

Naturally, this significant difference in power consumption also impacts battery life. To verify this, I conducted a battery test where both laptops were fully charged, then disconnected from their power sources, and ran the same training and testing tasks. To ensure accuracy, I disconnected the internet, closed all unnecessary processes, and set the screen brightness to the lowest level on both laptops.

At the end of the test, the Surface Book’s battery had dropped to 96%, whereas the MacBook still displayed 100%. While machine learning workloads are typically performed while plugged in, this test demonstrates that in scenarios where you need to run these tasks on battery power—perhaps in an external setting—the difference between the two devices could be quite significant.

This comparison highlights the MacBook’s superior power efficiency, which could be a deciding factor for those prioritizing battery life along with machine learning performance.

Thoughts on the Results

As mentioned earlier, the clock speed of modern CPUs and GPUs seems to be losing its relevance when it comes to actual performance results. Despite being a few years old, the Surface Book 3 is still considered a powerful laptop based on its specs, with relatively high power consumption to match. However, seeing how easily the M2 Pro MacBook outperforms it, it’s clear that Apple’s optimizations have really set them apart in recent years.

If you’re considering purchasing a new laptop, it may be more reasonable to look at newer high-end options, such as the Surface Laptop Studio 2, rather than the Surface Book 3. The Surface Laptop Studio 2, priced similarly to the Surface Book 3 at launch, comes equipped with the mobile version of the RTX 4050. While the benchmark performance of the RTX 4050 surpasses that of the GTX 1660 Ti Max-Q in the Surface Book 3, it still doesn’t seem to reach the level of the M2 Pro MacBook. As noted in the overseas reviews I’ve shared, the M2 Pro performs better in GPU rendering tasks.

Moreover, the RTX 4050’s maximum power consumption is around 80W, which is even higher than the 60W of the GTX 1660 Ti Max-Q. This means that while the Surface Laptop Studio 2 may offer better performance than the Surface Book 3, it still doesn’t come close to the power efficiency or the overall performance of the M2 Pro MacBook.

In conclusion, Apple’s unified architecture and optimization strategies, along with its impressive balance of performance and power efficiency, make the M2 Pro MacBook the clear winner, especially for tasks like machine learning and rendering. While newer Windows laptops may close the gap in performance, they often lag behind in power efficiency, making the MacBook a compelling choice for users who need high performance on the go.

Conclusion

In this post, I compared the PyTorch training performance between the MacBook Pro with the M2 Pro processor and the high-end Windows PC, the Surface Book 3, which is equipped with an NVIDIA GPU. It was almost shocking to see how easily the MacBook Pro, which often appears to be a lightweight, design-focused laptop, outperformed the Surface Book in terms of raw performance.

To summarize, if you’re looking for a laptop for machine learning and don’t specifically need a Windows-based system, I would strongly recommend choosing the MacBook Pro. With that, I conclude this post.

Leave a Reply

Your email address will not be published. Required fields are marked *