もっと詳しく

Until now, Pytorch only supported CPU training on Mac. Just now, Pytorch officially announced that its latest version v1.12 can support GPU acceleration. As long as it is a Mac with an M1 series chip.

This also means that it will be more convenient to use Pytorch “alchemy” on the Mac!

Training speed can be increased by about 7 times

This feature was introduced by Pytorch in collaboration with Apple’s Metal engineering team.itUse Apple’s Metal Performance Shaders (MPS) as a PyTorch backend to enable GPU-accelerated training.

To optimize compute performance, MPS also fine-tunes each core for the unique characteristics of the Metal GPU family.

Metal is a framework similar to OpenGL, except that OpenGL is suitable for mobile GPU rendering and computing on various platforms. Dedicated to the iOS / MacOS platform, but also takes into account performance and ease of use.

MPS is a set of libraries based on the Metal framework, which can be directly invoked to use the high performance of the GPU for graphics processing, construction of convolutional neural networks, and other tasks.

Apple officially tested it on a Mac Studio equipped with an M1 Ultra, 20-core CPU, 64-core GPU, 128GB RAM, and 2TB SSD. (This lineup is almost a luxury configuration).

They trained ResNet50 with batch size 128, HuggingFace BERT with batch size 64, and VGG16 with batch size=64, respectively.

From the figure below we can see that compared to using CPU acceleration,Model training about 7x faster with GPUthe evaluation speed can be improved by a maximum of about 20 times.

Seeing this, some netizens began to wonder how it performs compared to laptops equipped with Nvidia GPUs.

Some people say that althoughThe raw computing performance of the current M1 is not as good as that of NVIDIA’s products,butPower consumption is good. In the future, Apple is likely to slowly catch up with performance. Overall, Mac Studio looks really good right now.

He further explained: “After all, it is the cheapest machine you can buy for $4,800 with 128GB of GPU memory. Now with GPU-accelerated PyTorch support, it can be used to train large models and configure large batches. size. For the kind of DL work I do, data loading is more likely to be the bottleneck than the actual raw computing power.”

You heart it? Try it now?

OnlyMake sure your macOS operating system is version 12.3 and above,andArm64 native Python installedand then go to the official website to download the latest Pytorch preview version.

address:

https://pytorch.org/blog/introducing-accelerated-pytorch-training-on-mac/

.
[related_posts_by_tax taxonomies=”post_tag”]

The post More than CPU, Apple M1 Mac now supports GPU acceleration in PyTorch training appeared first on Gamingsym.