Introduction to tasks

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 3

  • @rajeevgupta4058
    @rajeevgupta4058 Год назад

    what about the cache data that is needed in a certain tast? when tast is free to be executed at any time, the caches might not have required data.

  • @shahoodamir3829
    @shahoodamir3829 2 года назад

    please share the source code

    • @SumriseHD
      @SumriseHD 4 месяца назад

      #include
      #define ARR_SIZE 600
      #define STEP_SIZE 100
      #include
      int main() {
      /* Computing Array sum using tasks */
      int i;
      int sum = 0;
      #pragma omp parallel
      {
      int a[ARR_SIZE];
      #pragma omp for
      for (i = 0; i < ARR_SIZE; i += STEP_SIZE) {
      int j, start = i, end = i + STEP_SIZE - 1;
      printf("Computing Sum(%d,%d) in thread %d of %d
      ", start, end,
      omp_get_thread_num(), omp_get_num_threads());
      #pragma omp task
      {
      int psum = 0;
      printf("Task computing Sum(%d,%d) in thread %d of %d
      ", start, end,
      omp_get_thread_num(), omp_get_num_threads());
      for (j = start; j