ramalhovfc / lcsAlgorithmOpenMp

Parallel implementation of a LCS (largest common subsequence) algorithm using C and Open MP
0 stars 0 forks source link

Survey Question on the For loop in source file /readFileUtils.c line 35 #1

Open pdhung3012 opened 2 years ago

pdhung3012 commented 2 years ago

Hello Sir/ Madam We are from a research group at Iowa State University, USA. We want to do a survey on Github developers on the methods they used for paralleling their code. To do the survey, We want to ask three questions about this for loop:

  1. Can you briefly explain the purpose of using pragma for this case? If the pragma contained reduction and private clauses, can you briefly mention the purposes of variables in those clauses?

  2. How much confidence do you have about the correctness of this implementation? You can choose from 1-5 with 1 as the lowest confidence score and 5 as the highest confidence score.

  3. (Optional) Do you actually run (interpret the code with compilation and pass input/get output) the code and see the optimization of parallelization? Yes/No

    • If yes, can you provide the information of what are the input and expected output of this program (the input that caused the program to run through this for-loop).

The for loop is from line 35 of file https:/github.com/ramalhovfc/lcsAlgorithmOpenMp/blob/master//readFileUtils.c Here is a part of the code:

omp parallel for schedule(dynamic) private(i) for (i = 0; i < (lcs->lines + 1); i++) { lcs->mtx[i] = (int ) calloc(lcs->cols + 1, sizeof(int )); checkNullPointer(lcs->mtx[i]); }

Sincerely thanks

ramalhovfc commented 2 years ago
  1. This is the easiest form of parallelization. All iterations of the for-loop are independent so we can straight out divide them dynamically to each thread. Iteration variable i is kept private to each thread.
  2. High confidence (5). This was an educational exercise and did output the correct result.
  3. Attached are some input output files. input.zip