time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

desiderata.md (962B)


      1 Instead of
      2 
      3 ```C
      4 #pragma omp parallel private(i, sample_index, split_array_length)
      5 {
      6     #pragma omp for
      7     for (i = 0; i < n_threads; i++) {
      8         split_array_length = split_array_get_length(i, N, n_threads);
      9         for (int j = 0; j < split_array_length; j++) {
     10             results[i][j] = sampler(seeds[i]);
     11         }
     12     }
     13 }
     14 
     15 ```
     16 
     17 Algo como
     18 
     19 ```C
     20 #pragma omp parallel private(i, sample_index, bounds)
     21 {
     22     #pragma omp for
     23     for (i = 0; i < n_threads; i++) {
     24         int bounds[2] = split_array_get_bounds(i, N, n_threads);
     25         for (int j = bound[0]; j < bounds[1] + 1; j++) {
     26             // o j < bounds[1], no se si el +1 va a ser más elegante
     27             // dentro o fuera, aunque algo me dice que dentro
     28             results[j] = sampler(seeds[i]);
     29         }
     30     }
     31 }
     32 
     33 ```
     34 
     35 Por qué? Porque esto hace que la estructura subyacente sea un solo array, 
     36 lo cual implica que no *tengo* que utilizar split_array_functions especializadas 
     37 si no quiero