Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Loop-worksharing
#include <omp.h> #include <stdio.h> #include <stdlib.h> #define CHUNKSIZE 10 #define N 100 int main () { int nthreads, tid, i, chunk; float a[N], b[N], c[N]; for (i=0; i< N; i++) a[i] = b[i] = i* 1.0; chunk = CHUNKSIZE; #pragma omp parallel shared(a,b,c,nthreads,chunk) private(i,tid) { tid= omp_get_thread_num(); if (tid== 0) { nthreads= omp_get_num_threads(); printf("Number of threads = %d\n", nthreads); } printf("Thread %d starting...\n",tid); #pragma ompfor schedule(dynamic, chunk) for (i=0; i<N; i++) { c[i] = a[i] + b[i]; printf("Thread %d: c[%d]= %f\n",tid,i,c[i]); } } /* end of parallel section */ }
run
|
edit
|
history
|
help
0
linear_search.c
Witout goto
tom grey wolf
avance pregunta 2 guía 4 de módulo 3
2.3 Comparision with Matrix Multiplication Execution Time
ele709 3.5 finished
fgets and basic string manipulation
ptr_to_ptr
C_141210_Funciones
Lab 7 blackjack v0.5