Changeset 62 for sources/src/gen_code.cc


Ignore:
Timestamp:
Feb 16, 2017, 3:46:11 PM (8 years ago)
Author:
meunier
Message:
  • Functional (or supposedly functional) OpenMP support configure must be run with --enable-use-omp and the topcell must define the USE_OPENMP flag before including the .h files of systemcass (if openmp enabled).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sources/src/gen_code.cc

    r61 r62  
    241241
    242242
    243 char * gen_scheduling_code_for_dynamic_link(method_process_list_t &
    244         transition_func_list,
    245         method_process_list_t &
    246         moore_func_list,
    247         strong_component_list_t *
    248         strongcomponents) {
     243char * gen_scheduling_code_for_dynamic_link(method_process_list_t & transition_func_list,
     244        method_process_list_t & moore_func_list,
     245        strong_component_list_t * strongcomponents) {
    249246    if (dump_stage) {
    250247        cerr << "Generating C code for scheduling...\n";
     
    305302
    306303
    307 char * gen_scheduling_code_for_dynamic_link(method_process_list_t &
    308         transition_func_list,
    309         method_process_list_t &
    310         moore_func_list,
    311         ProcessDependencyList &
    312         mealy_func_list) {
     304char * gen_scheduling_code_for_dynamic_link(method_process_list_t & transition_func_list,
     305        method_process_list_t & moore_func_list,
     306        ProcessDependencyList & mealy_func_list) {
    313307    if (dump_stage) {
    314308        cerr << "Generating C code for scheduling...\n";
     
    509503
    510504
    511 void gen_scheduling_code_for_static_func(method_process_list_t &
    512         transition_func_list,
    513         method_process_list_t &
    514         moore_func_list,
    515         ProcessDependencyList &
    516         mealy_func_list) {
     505void gen_scheduling_code_for_static_func(method_process_list_t & transition_func_list,
     506        method_process_list_t & moore_func_list,
     507        ProcessDependencyList & mealy_func_list) {
    517508    if (dump_stage) {
    518509        cerr << "Generating scheduling...\n";
     
    546537    int n = fc.func_number;
    547538    int i;
    548 #pragma omp parallel for
    549539    for (i = 0; i < n; ++i) {
    550540#if 0
     
    578568unsigned int nb_func[2];
    579569static method_process_t **func_list[2];
    580 #pragma omp threadprivate (nb_func, func_list)
    581570static strong_component_list_t quasistatic_list;
    582571
    583572unsigned long long busy_wait_f0, busy_wait_f1, busy_wait_up, busy_wait_ml;
    584573unsigned long long last_wait_f0, last_wait_f1, last_wait_up, last_wait_ml;
     574#ifdef USE_OPENMP
     575#pragma omp threadprivate (nb_func, func_list)
    585576#pragma omp threadprivate (busy_wait_f0, busy_wait_f1, busy_wait_up,busy_wait_ml)
    586577#pragma omp threadprivate (last_wait_f0, last_wait_f1, last_wait_up,last_wait_ml)
     578#endif
    587579
    588580static void Call(const method_process_t & m) {
     
    621613unsigned int expected_globaltime = 0;
    622614volatile unsigned int globaltime __attribute__ ((aligned (128))) = 0;
     615#ifdef USE_OPENMP
     616#pragma omp threadprivate (expected_globaltime)
    623617#pragma omp shared (globaltime)
    624 #pragma omp threadprivate (expected_globaltime)
     618#endif
    625619
    626620unsigned int num_omp_threads;
     
    644638        __asm volatile("lfence");
    645639    }
    646 
    647640#else
    648 #pragma omp barrier
     641    #ifdef USE_OPENMP
     642    #pragma omp barrier
     643    #endif
    649644#endif
    650645
     
    664659    }
    665660#else
    666 #pragma omp barrier
     661    #ifdef USE_OPENMP
     662    #pragma omp barrier
     663    #endif
    667664#endif
    668665    if (!quasistatic_list.empty()) {
     666#ifdef USE_OPENMP
    669667#pragma omp master
     668#endif
    670669        {
    671670            quasistatic_mealy_generation();
     
    682681        }
    683682#else
    684 #pragma omp barrier
    685 #endif
    686     }
    687 
    688 }
    689 
    690 
    691 void gen_scheduling_code_for_quasistatic_func(method_process_list_t &
    692         transition_func_list,
    693         method_process_list_t &
    694         moore_func_list,
    695         strong_component_list_t *
    696         mealy_func_list) {
     683    #ifdef USE_OPENMP
     684    #pragma omp barrier
     685    #endif
     686#endif
     687    }
     688}
     689
     690
     691void gen_scheduling_code_for_quasistatic_func(method_process_list_t & transition_func_list,
     692        method_process_list_t & moore_func_list,
     693        strong_component_list_t * mealy_func_list) {
    697694    if (dump_stage) {
    698695        cerr << "Generating quasi static scheduling...\n";
Note: See TracChangeset for help on using the changeset viewer.