Archive for the ‘C++’ Category



2
May

[C++] Sorting – Algorithms in C++ and their complexities

Here is the implementation of 10 sorting algorithms : Click to continue…

29
Apr

[Openmp] for schedule static or dynamic

Of course there is a difference between static and dynamic scheduling (every one know that) but if you want to see how it can make a difference look at the example above.

 

Click to continue…

28
Apr

[Cmake] infinite loop with cmake and mpicxx

You fail to set the compiler for mpi with cmake because you get an infinite loop :

You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_CXX_COMPILER= /usr/bin/c++

Click to continue…

6
Apr

[CMake] openmp with CMake

3 lines to use openmp in your cmake code

 

Click to continue…

8
Mar

C++ – Unit test – easy, one file, basic, simple

I few weeks ago I wanted to use unit test. But when I was searching for a framework easy to use, fast, that do not need to be installed 10 libs to make it working etc… Well I did not find anything that satisfy me.

So I make my own lib.

Click to continue…

28
Feb

C++ – Several loops or one big loop – Memcpy performance, memory cache

One week ago a friend asked a question that seemed easy to answer :

“Is it better if I copy 3 arrays into another ones in one loop or in 3 small loops?” (supposing arrays have the same size).

I thought “I suppose one big loop is better because your compiler will manage the cache, and you will have a small part of your arrays in the fast memory” … I was completely wrong…

Click to continue…

20
Jan

[C/C++] OpenMP vs PThread – openmp or posix thread ?

A popular question. Which one to use, which one is faster. Well, I do not really know but this post may help you to make your choice.

Click to continue…

6
Dec

C++ – OpenMP – std::cout – Print with OpenMP

In this post I propose a simple class to print using cout in a program that uses OpenMP.
Of course you can use a mutex to protect the cout stream, but I prefer to use a buffer before printing as I show in this example.

Click to continue…

2
Dec

C++ – OpenMP – Sum reduction example (simple example)

Here is an example of a reduction on a variable to sum the result from each thread.
Click to continue…

29
Nov

C++ – OpenMP – Private, share, copy, contructor, etc. examples

In this post I show quickly what does your program copy when you are using “share” or “private” clause with openMP.
Click to continue…

Celadon theme by the Themes Boutique