Tricks and Tips – Using omp_set_num_threads and omp_get_num_threads

When programming with OpenMP, it should be noticed that omp_get_num_threads() returns 1 in sequential sections of the code. Accordingly, even if setting, by omp_set_num_threads(), an overall number of threads larger than 1, any call to omp_get_num_threads() will return 1, unless we are in a parallel section. The example on our GitHub website tries to clarify this point.
More

Using OpenMP and CUDA with Visual Studio

To exploit OpenMP under C++ and using Visual Studio 2010 or 2013 you need two steps: 1) #include <omp.h> 2) Project -> Properties -> Configuration Properties -> C/C++ -> Language ->  Open MP Support and then select Yes (/openmp). To exploit OpenMP under CUDA and using Visual Studio 2010 or 2013 you need some more hacking. In particular, you need the additional step: 3) Go to C:Program FilesNVIDIA GPU Computing ToolkitCUDAv5.5bin, open nvcc.profile as Administrator and...
More