Ignore:
Timestamp:
Feb 16, 2017, 3:46:11 PM (7 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/schedulers.cc

    r61 r62  
    6464method_process_list_t * transition_func_list;
    6565method_process_list_t * moore_func_list;
     66#ifdef USE_OPENMP
    6667#pragma omp threadprivate(transition_func_list, moore_func_list)
     68#endif
    6769method_process_list_t combinational_func_list;
    6870/* ***************************** */
     
    120122void sort_functions() {
    121123    method_process_list_t::const_iterator m;
     124#ifdef USE_OPENMP
    122125#pragma omp parallel
    123126#pragma omp critical
     127#endif
    124128    {
    125129        transition_func_list = new method_process_list_t;
    126130        moore_func_list = new method_process_list_t;
    127131        for (m = method_process_list.begin(); m != method_process_list.end(); ++m) {
    128 #ifdef _OPENMP
     132#ifdef USE_OPENMP
    129133            if ((*m)->omp_threadnum == omp_get_thread_num())
    130134#endif
     
    189193        exit (24092004);
    190194    }
     195    delete s;
    191196    return sig_graph;
    192197}
     
    229234
    230235    sort_functions();
     236#ifdef USE_OPENMP
    231237#pragma omp parallel
    232238#pragma omp critical
     239#endif
    233240    {
    234241        if (dump_funclist_info) {
    235 #ifdef _OPENMP
     242#ifdef USE_OPENMP
    236243            cerr << "Thread " << omp_get_thread_num() << "\n";
    237244#endif
    238245            cerr << "  Transition functions : " << *transition_func_list << "\n";
    239246            cerr << "  Moore generation functions : " << *moore_func_list << "\n";
     247#ifdef USE_OPENMP
    240248#pragma omp master
     249#endif
    241250            {
    242251                if (!combinational_func_list.empty()) {
     
    247256
    248257    /* Schedule */
    249     switch (scheduling_method) {
    250         case BUCHMANN_SCHEDULING :
    251         {
    252             // Generate the scheduled code, compile and link.
    253             // Buchmann's thesis explains this scheduling method.
    254             // Uses port dependancies like Dr. Mouchard.
    255             ProcessDependencyList * process_list = BuchmannScheduling();
    256             if (dynamic_link_of_scheduling_code) {
    257                 base_name = gen_scheduling_code_for_dynamic_link(*transition_func_list, *moore_func_list, *process_list);
    258             }
    259             else {
    260                 gen_scheduling_code_for_static_func(*transition_func_list, *moore_func_list, *process_list);
    261             }
    262             break;
     258        switch (scheduling_method) {
     259            case BUCHMANN_SCHEDULING :
     260            {
     261                // Generate the scheduled code, compile and link.
     262                // Buchmann's thesis explains this scheduling method.
     263                // Uses port dependancies like Dr. Mouchard.
     264                ProcessDependencyList * process_list = BuchmannScheduling();
     265                if (dynamic_link_of_scheduling_code) {
     266                    base_name = gen_scheduling_code_for_dynamic_link(*transition_func_list, *moore_func_list, *process_list);
     267                }
     268                else {
     269                    gen_scheduling_code_for_static_func(*transition_func_list, *moore_func_list, *process_list);
     270                }
     271                break;
     272            }
     273
     274            case MOUCHARD_SCHEDULING :
     275            {
     276                // Generate the scheduled code, compile and link.
     277                // Mouchard's thesis explains this scheduling method.
     278                // Uses port dependancies like Dr. Mouchard.
     279                // CAUTION : unlike FastSysC, this scheduling is totally static
     280                // and does not use an event-driven scheduler.
     281                ProcessDependencyList * process_list = MouchardScheduling();
     282                if (dynamic_link_of_scheduling_code) {
     283                    base_name = gen_scheduling_code_for_dynamic_link(*transition_func_list, *moore_func_list, *process_list);
     284                }
     285                else {
     286                    gen_scheduling_code_for_static_func (*transition_func_list, *moore_func_list, *process_list);
     287                }
     288                break;
     289            }
     290
     291            case CASS_SCHEDULING :
     292            {
     293                // Generate the scheduled code, compile and link
     294                // Hommais's thesis explains this scheduling method (like CASS strategy)
     295                // Doesn't use port dependancies
     296                strong_component_list_t * strong_list = NULL;
     297#ifdef USE_OPENMP
     298#pragma omp master
     299#endif
     300                {
     301                    Graph * g = makegraph (&combinational_func_list);
     302                    if (dump_all_graph && g) {
     303                        graph2dot("module_graph", *g);
     304                    }
     305                    strong_list = strong_component(g);
     306                }
     307                if (dynamic_link_of_scheduling_code) {
     308                    base_name = gen_scheduling_code_for_dynamic_link(*transition_func_list, *moore_func_list, strong_list);
     309                }
     310                else {
     311                    gen_scheduling_code_for_quasistatic_func (*transition_func_list, *moore_func_list, strong_list);
     312                }
     313                // free the void_lists in strong_list
     314                //for ( strong_component_list_t::iterator i = strong_list->begin(); i < strong_list->end(); i++) {
     315                //    delete *i;
     316                //}
     317#ifdef USE_OPENMP
     318#pragma omp master
     319#endif
     320                {
     321                    delete strong_list;
     322                }
     323                break;
     324            }
     325            default :
     326                cerr << "Error : Unable to schedule SystemC process."
     327                    "Please select a scheduling method.\n";
     328                exit (35);
    263329        }
    264 
    265         case MOUCHARD_SCHEDULING :
    266         {
    267             // Generate the scheduled code, compile and link.
    268             // Mouchard's thesis explains this scheduling method.
    269             // Uses port dependancies like Dr. Mouchard.
    270             // CAUTION : unlike FastSysC, this scheduling is totally static
    271             // and does not use an event-driven scheduler.
    272             ProcessDependencyList * process_list = MouchardScheduling();
    273             if (dynamic_link_of_scheduling_code) {
    274                 base_name = gen_scheduling_code_for_dynamic_link(*transition_func_list, *moore_func_list, *process_list);
    275             }
    276             else {
    277                 gen_scheduling_code_for_static_func (*transition_func_list, *moore_func_list, *process_list);
    278             }
    279             break;
    280         }
    281 
    282         case CASS_SCHEDULING :
    283         {
    284             // Generate the scheduled code, compile and link
    285             // Hommais's thesis explains this scheduling method (like CASS strategy)
    286             // Doesn't use port dependancies
    287             strong_component_list_t * strong_list = NULL;
    288 #pragma omp master
    289             {
    290                 Graph * g = makegraph (&combinational_func_list);
    291                 if (dump_all_graph && g) {
    292                     graph2dot("module_graph", *g);
    293                 }
    294                 strong_list = strong_component(g);
    295             }
    296             if (dynamic_link_of_scheduling_code) {
    297                 base_name = gen_scheduling_code_for_dynamic_link(*transition_func_list, *moore_func_list, strong_list);
    298             }
    299             else {
    300                 gen_scheduling_code_for_quasistatic_func (*transition_func_list, *moore_func_list, strong_list);
    301             }
    302             break;
    303         }
    304         default :
    305             cerr << "Error : Unable to schedule SystemC process."
    306                     "Please select a scheduling method.\n";
    307             exit (35);
    308     }
    309330    }
    310331    return base_name;
Note: See TracChangeset for help on using the changeset viewer.