Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » chewabob
  • » Profile

Posts

Posts

Jul-10-15 06:14:11
Generated Code is not as expected

Hi,
I am a little bit confused about the c-code I generate with following options

Code:

setDebugFlags("hpcom hpcomDump"); getErrorString(); 

setCommandLineOptions("+n=5 +hpcomScheduler=mcp +hpcomCode=pthreads"); getErrorString();

Nevertheless the following OPENMP define is created in all c-files. However as far as I can see, OpenMP is used nowhere.

Code:

#define HPCOM


#if defined(HPCOM) && !defined(_OPENMP)
  #error "HPCOM requires OpenMP or the results are wrong"
#endif
#if defined(_OPENMP)
  #include <omp.h>
#else
  /* dummy omp defines */
  #define omp_get_max_threads() 1
#endif

pthreads are created as expected:

Code:

...

// number of threads: 5
static int finished; //set to 1 if the hpcom-threads should be destroyed

static pthread_t odeThread_0;
static pthread_t odeThread_1;
...

Also openmp compilerflag is activated in the makefile

Code:

CC=gcc -fopenmp

For me it is not clear why openmp is neccessary when using pthreads? Or is it a bug in the codegeneration template?

Thanks for help

  • Index
  • » Users
  • » chewabob
  • » Profile
You are here: