167
edits
Changes
ParaCode
,→Assignment 2
We can see, there're two for loop in grep() function. In loop is inside another. Which mean it's kind of O(n^m) runtime function. That's why it cost a lot of time to run.<br>
The idea of grep is very simple. The inside loop make a temporary string from input string with the length of keyword length. Then it compare the temp string to keyword. If they equal, means this temp string is the same as keyword string. It increases the counter by 1. <br>
[[File:GrepIdea.JPG|650px]]
Simple? But to parallel it is not that simple...<br>
If we put the character array to CUDA kernel to run, those characters will run individually in different threads. It will look like this:<br>
[[File:LineInThreads.JPG|650px]]
=== Assignment 3 ===