mardi 18 novembre 2014

openmp is slower than serial for matrix initialization


Vote count:

0




I'm just learning how to use openmp but it becomes slower by doing the following. Basically, I'm just trying to initialize a huge 2 dimensional matrix.



219 int **scoreMatrix = malloc(sizeof(int *) * (strlen(seq1)+1));
220
221 int i,j = 0;
222 omp_set_num_threads(6);
224 #pragma omp parallel private(i,j)
225 {
226 int std = omp_get_thread_num();
227 //Initialize matrix
228 for(i = std; i < strlen(seq1)+1; i=i+nthreads){
229 scoreMatrix[i] = malloc(sizeof(int) * (strlen(seq2)+1));
230 for(j = 0; j < strlen(seq2)+1; j++){
231 scoreMatrix[i][j] = 0;
232 }
233 }
234 }


Please tell me if I am missing any important syntax or concept in OpenMP. Thank you!



asked 57 secs ago







openmp is slower than serial for matrix initialization

Aucun commentaire:

Enregistrer un commentaire