Open main menu

CDOT Wiki β

Changes

ParaCode

72 bytes added, 11:56, 6 April 2018
Assignment 2
Through the profile, we can see that the most cost of the runtime is 'grep()' and 'convert_char_to_string()' functions. <br>
 
''' Basic Variables '''
First, I look at function 'convert_char_to_string()'. I think it's no necessary to use this function, so I remove it.<br>
[[File:StringremoveJPG.JPG|650px]]
 
'''Serial grep method'''
 
Then, we start working in grep function. As file size growing up, which means more characters in file, the runtime of 'grep()' grows much more faster than the other functions. So we are going to work on 'grep()' function.<br>
Simple? But to parallel it is not that simple...<br>
 
'''Parallel grep idea'''
 
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]]
Although we cannot compare a whole string, it is possible to compare by one character. For example, it is possible to find just 'h' in input string. <br>
[[File:FindH.JPG|650px]]
 
With the same idea, we can find 'a':<br>
[[File:FindA.JPG|650px]]
=== Assignment 3 ===
167
edits