Ignore:
Timestamp:
Feb 14, 2017, 11:30:19 AM (8 years ago)
Author:
meunier
Message:
  • Intégration des modifications de Clément, qui a intégré la version parallélisée de systemcass faite par Manuel.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sources/src/global_functions.cc

    r59 r60  
    246246    pending_write_vector_capacity = get_signal_table_size();
    247247
    248     if (pending_write_vector_capacity == 0) {
    249         pending_write_vector = NULL;
    250     }
    251     else {
    252         pending_write_vector = (pending_write_vector_t) realloc(pending_write_vector, sizeof(pending_write_t) * pending_write_vector_capacity);
    253     }
     248    assert(pending_write_vector_capacity != 0);
     249
     250#ifdef _OPENMP
     251#define LINE_SIZE 128L
     252    int malloc_size = (sizeof (pending_write_t) * (pending_write_vector_capacity + 1) + (LINE_SIZE - 1)) & ~(LINE_SIZE - 1);
     253    assert((sizeof(pending_write_t) * (pending_write_vector_capacity + 1)) <= malloc_size && "bad allocation size");
     254
     255#pragma omp parallel
     256    {
     257        posix_memalign((void **) &pending_write_vector, LINE_SIZE, malloc_size);
     258        pending_write_vector_nb = (int32_t *) &pending_write_vector[0];
     259        pending_write_vector = &pending_write_vector[1];
     260        //printf("malloc 0x%x @%p, idx @0x%x\n", malloc_size, pending_write_vector, pending_write_vector_nb);
     261        *pending_write_vector_nb = 0;
     262    }
     263#else
     264    pending_write_vector = (pending_write_vector_t) malloc(sizeof(pending_write_t) * pending_write_vector_capacity);
     265#endif
     266
    254267
    255268    // create the clock list
     
    267280    }
    268281    // Check if any constructor wrote into registers
    269     if (pending_write_vector_nb != 0) {
     282    if (*pending_write_vector_nb != 0) {
    270283        cerr <<
    271284            "Error : Register/Signal writing is not allowed before sc_initialize.\n"
     
    285298    }
    286299
    287     pending_write_vector_nb = 0;
     300    *pending_write_vector_nb = 0;
    288301
    289302    check_all_ports();
Note: See TracChangeset for help on using the changeset viewer.