Sign in

Synchronisation techniques in OpenMP

Ugghhh !! DATA DEPENDENCIES and RACE CONDITIONS !! These concepts are the most hated by a parallel programmer because it takes quite a effort to parallelize sections with dependencies and debug race conditions and sometimes its impossible overcome these conditions. So, there needs to be methods of synchronisation to take care of these problems so that we can use parallel regions safely and get our desired output. Some of the synchronisation techniques provided by OpenMP are Atomic, Critical and Master.

Let’s take a look at an example to understand the above scenario.

Example 1:int sum = 1; omp_set_num_threads(20); #pragma…

Interested in compilers? Want to explore more but you are still a beginner? Higher Order Calculator might be just what you are looking for.

Higher order calculator or just simply hoc is a programming language first introduced by Brian Kernighan and Rob Pike in their infamous book “The Unix Programming Environment”. The book closes with a tutorial on hoc and demonstrates how to build interpreters using Yacc.

Hoc’s basic functionality is to evaluate floating-point numerical expressions, e.g., “1+2*sin(0.7)”. Then, variables were added, conditionals, loops, user-defined functions, simple IO, and more, using a syntax resembling C. …

Ever wondered what happens to the program when you hit the enter button on your keyboard ? What is meant by compilation of a program ? This blog explains varies steps or processes involved in the conversion of a C code to the execution of the executable code.


Preprocessor directives

The first process which our Hello_World.c encounters is preprocessing where the preprocessor replaces #define (macro), #include (files), conditional codes like #if and #endif, and other directives like #pragma by their respective values & source codes in source files.

Converts Hello_World.c to Hello_World.i


The compiler can be divided into two parts : the…

WARNING! The free lunch is over.

“The free lunch is over” is a famous article written by Herb Sutter which reminds us that microprocessor serial-processing speed is reaching a physical limit and it is time to focus on multi-threading and products that better support multi-threading such as multi-core processors.

Prior to the concept of parallelism or concurrency, CPU designers have achieved and concentrated on performance gains in three main areas

  1. Clock speed
  2. Execution Optimisation
  3. Cache

But the performance gains in these areas is diminishing. According to (Intel) CPU trends before 2003, we should have had 10GHz chips by 2006 but a quick check around us tells…

Kausthub TM

NITK - IT undergrad

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store