Multithreading with OpenMP
OpenMP is a library used for parallelizing tasks by harnessing all the power of multicore processors by using the multithreading technique. In the context of PyTorch, OpenMP is employed to parallelize operations executed in the training phase and to accelerate preprocessing tasks related to data augmentation, normalization, and so forth.
As multithreading is a key concept here, to see how OpenMP works, follow me to the next section to understand this technique.
What is multithreading?
Multithreading is a technique to parallelize tasks in a multicore system, which, in turn, is a computer system endowed with multicore processors. Nowadays, any computing system has multicore processors; smartphones, notebooks, and even TVs have CPUs with more than one processing core.
As an example, let’s look at the notebook that I’m using right now to write this book. My notebook possesses one Intel i5-8265U processor, which has eight cores, as illustrated...