Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: deepakraom on May 14, 2010, 12:46:05 pm

Title: Use of OpenMp
Post by: deepakraom on May 14, 2010, 12:46:05 pm
Hi,
 I am interested in parallel programming and I am using Code::Blocks for the same purpose.
 I am using C programming language with OpenMp Directive. I am using Code::Blocks 8.02 with GCC compiler on windows XP platform. While compiling my program given below...
____________________________________________________________________
#include<omp.h>
 #include<stdio.h>


 int main (int argc, char *argv[]) {
   int th_id, nthreads;
   #pragma omp parallel private(th_id)
   {
     th_id = omp_get_thread_num();
     printf("Hello World from thread %d\n", th_id);
     #pragma omp barrier
     if ( th_id == 0 ) {
       nthreads = omp_get_num_threads();
       printf("There are %d threads\n",nthreads);
     }
   }
   return 0;
 }
___________________________________________________________________

i am getting these errors..
C:\Documents and Settings\admin\My Documents\test\hi.c|1|omp.h: No such file or directory|
C:\Documents and Settings\admin\My Documents\test\hi.c||In function `int main(int, char**)':|
C:\Documents and Settings\admin\My Documents\test\hi.c|9|error: `omp_get_thread_num' was not declared in this scope|
C:\Documents and Settings\admin\My Documents\test\hi.c|13|error: `omp_get_num_threads' was not declared in this scope|
||=== Build finished: 3 errors, 0 warnings ===|
__________________________________________________________________
can anyone suggest me a solution in this regard...
I think the GCC version doesn't support the openmp directives. It would be better if someone suggest me to which version of GCC compatible with OpenMp commends to use with Code::Blocks
thanks in advance...
Title: Re: Use of OpenMp
Post by: ollydbg on May 14, 2010, 01:19:59 pm
Code
I think the GCC version doesn't support the openmp directives. It would be better if someone suggest me to which version of GCC compatible with OpenMp commends to use with Code::Blocks

try TDM-GCC, which can be downloaded from:TDM's GCC/mingw32 Builds (http://www.tdragon.net/recentgcc/)

And read it's manual about how to use Openmp.

By the way, your question is not related to Codeblocks.  :D