My Journey to learn Modern Code

By Abhishek Nandy,

Published:02/18/2016   Last Updated:02/18/2016

 

When I first saw a session at IDF where masters of the Modern Code were discussing it got me intrigued to think more. Fellow Black Belt Gaston Hillar gave me good insight into it. I had a quick chat also with our Black Belt Program Manager Kathy(Always filled with Energy) she also explained about how cool Code modernization is.

Hence now I started learning about Code Modernization and trying to experiment and learn more.

after a brief stint it came to my picture that Modernization of the code is very useful for our CPU processors because they are multicored and rarely do we use all the cores of CPU and it impacts the way we utilize our program. Now with Code Modernization we can resourcefully use all the cores of the CPU.

 

To Start with Code Modernization the most important thing or basic thing is knowing the CPU Utilization formula.

U = 100% - (%of time spent in idle task)

% time in idle task = (average period of background task with no load) * 100%/(avg.period of background task with some load)

%time in idle task =(BG loop count measured during 25 ms) *100%/(BG loop count expected in an unloaded CPU)

Actual % = Scaled Percent * (100%)/max value 8 bit value

These formulas are the basis for using your CPU cores and should be given importance.

Lets take a look at Multicore Utilization.

 

 

 

 

 

 

 

 

 

 

 

There is already a good article describing the laws in Intel Developer Zone

/content/www/us/en/develop/articles/predicting-and-measuring-parallel-performance.html

OpenMP

OpenMP is an interface that helps  shared memory multiprocessing in Languages C,C++ and Fortran.

A normal for loop in C

for (i=0; i < 5; i++)

{

    for (j=0;j<=i;j++)

    {

        printf("@”);

    }

}

Just add

#include<omp.h>

and add

#pragma omp parallel

you are good to go

Where to get OpenMP

https://www.openmprtl.org/download

Intel TBB

It is a C++ based libray used for Task Parallelism

https://www.threadingbuildingblocks.org/download

Now the entire package can be found at Intel Parallel Studio

https://software.intel.com/en-us/intel-advisor-xe/

Time to time you get access to courses organised by Colfax International and during the course you get remote access to instances of Intel Xeon Machines for practice and trust me as I was a newbie to Modern Code I came to know more accessing the sessions.

http://colfaxresearch.com/

After the end of getting the course done we get a certificate.Its a cool one.

The training sessions are just awesome you will get the crunch of the subject. As I have just learnt a bit of Modern Code its now asking questions in my mind to know more .The path to start modern code just keeps you going because there are lot of Modern Operating System questions that gets resolved.

There has been a new dedicated Intel Modern Code Section at Intel Developer Zone plus a new initiative added to Software Innovator Track for Modern Code as we learn more we share come lets grow the Modern Code Section together.

/content/www/us/en/develop/modern-code.html

 

 

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804