Skip to content
Browse files

Work done by Anushree

  • Loading branch information...
1 parent e262ea2 commit c50d3814fbf4daf74c3db5dae4c714ec33eebfa1 @anirudhr anirudhr committed
View
0 LICENSE.txt 100644 → 100755
File mode changed.
View
0 README 100644 → 100755
File mode changed.
View
0 TODO 100644 → 100755
File mode changed.
View
BIN bin/bwt.out
Binary file not shown.
View
0 bin/input 100644 → 100755
File mode changed.
View
BIN bin/mtf.out
Binary file not shown.
View
BIN bin/mtf_timing.out
Binary file not shown.
View
0 lib/bwt.a 100644 → 100755
File mode changed.
View
22 lib/bwt.cu 100644 → 100755
@@ -22,8 +22,8 @@ using namespace std;
void rotate(int N, char *word, vector<string> *h_vec)
{
char *str, *rot;
- cudaMalloc((void**)&str, sizeof(char) * (N + 1));
- cudaMalloc((void**)&rot, sizeof(char) * ((N + 1) * (N + 1)));
+ cudaMalloc((void**)&str, /*sizeof(char) * */(N + 1));
+ cudaMalloc((void**)&rot, /*sizeof(char) * */((N + 1) * (N + 1)));
thrust::device_ptr<char> strD(str);
thrust::device_ptr<char> rotD(rot);
@@ -70,15 +70,15 @@ char* bwt( char *word)
{
int N = strlen(word);
vector<string> h_vec;
- char *result = new char(N);
rotate(N, word, &h_vec);
-
+
+ char *result = new char(N);
sort(&h_vec, result);
return result;
}
-/*
+
int main(int argc, char *argv[])
{
if (argc != 2)
@@ -87,11 +87,13 @@ int main(int argc, char *argv[])
exit(1);
}
- char *word = new(char);
- strcpy(word, argv[1]);
- cout << bwt(word) << endl;
-
+// char word[256];
+ int N = strlen(argv[1]);
+// char * word = new char(N);
+// strncpy(word, bwt(argv[1]), N);
+// cout << word << endl;
+ cout << bwt(argv[1]) << endl;
return 0;
}
-*/
+
#endif
View
0 lib/bwt.o 100644 → 100755
File mode changed.
View
0 lib/device_string.a 100644 → 100755
File mode changed.
View
0 lib/device_string.cu 100644 → 100755
File mode changed.
View
0 lib/device_string.o 100644 → 100755
File mode changed.
View
17 src/mtf.cu 100644 → 100755
@@ -54,9 +54,22 @@ void mtf(vector<char> word)
}
}
+ thrust::copy(list.begin(), list.end(), d_list.begin());
+ thrust::copy(word.begin(), word.end(), d_word.begin());
+ for (counter = 0; counter < list.size(); counter++)
+ {
+ iter = thrust::find(d_word.begin(), d_word.end(), d_list[counter]);
+ while (iter != d_word.end())
+ {
+ *iter = counter;
+ iter = thrust::find(d_word.begin(), d_word.end(), d_list[counter]);
+ }
+ }
+ thrust::copy(d_word.begin(), d_word.end(), h_word.begin());
+
for (counter = 0; counter < word.size(); counter++)
{
- ch = list[counter];
+ ch = h_word[counter];
cout << counter << "\t" << ch << endl;
}
}
@@ -73,7 +86,7 @@ int main(int argc, char *argv[])
vector<char> word(argv[1], argv[1] + len);
// time_t begin, end;
// begin = time(NULL);
- for (int i = 0; i < 10000; i++)
+// for (int i = 0; i < 10000; i++)
mtf(word);
// end = time(NULL);
// cout <<difftime(end, begin);
View
0 src/mtf.err 100644 → 100755
File mode changed.
View
19 src/mtf_timing.cu 100644 → 100755
@@ -54,9 +54,22 @@ void mtf(vector<char> word)
}
}
+ thrust::copy(list.begin(), list.end(), d_list.begin());
+ thrust::copy(word.begin(), word.end(), d_word.begin());
+ for (counter = 0; counter < list.size(); counter++)
+ {
+ iter = thrust::find(d_word.begin(), d_word.end(), d_list[counter]);
+ while (iter != d_word.end())
+ {
+ *iter = counter;
+ iter = thrust::find(d_word.begin(), d_word.end(), d_list[counter]);
+ }
+ }
+ thrust::copy(d_word.begin(), d_word.end(), h_word.begin());
+
/* for (counter = 0; counter < word.size(); counter++)
{
- ch = list[counter];
+ ch = h_word[counter];
cout << counter << "\t" << ch << endl;
}*/
}
@@ -73,9 +86,9 @@ int main(int argc, char *argv[])
vector<char> word(argv[1], argv[1] + len);
time_t begin, end;
begin = time(NULL);
- for (int i = 0; i < 10000; i++)
+ for (int i = 0; i < 100; i++)
mtf(word);
end = time(NULL);
- cout <<difftime(end, begin);
+ cout <<"Time taken : " << difftime(end, begin) <<endl;
return 0;
}
View
0 tst/Huffman/CLGeneration.algo 100644 → 100755
File mode changed.
View
0 tst/Huffman/CLGeneration.cu 100644 → 100755
File mode changed.
View
0 tst/Huffman/CWGeneration.algo 100644 → 100755
File mode changed.
View
0 tst/charSearch.cu 100644 → 100755
File mode changed.
View
0 tst/err 100644 → 100755
File mode changed.
View
0 tst/mtf.cu 100644 → 100755
File mode changed.
View
0 tst/old/err 100644 → 100755
File mode changed.
View
0 tst/old/string_sort_try0.0052_21-11-2010.err 100644 → 100755
File mode changed.
View
0 tst/old/string_sort_try0.cu 100644 → 100755
File mode changed.
View
0 tst/string_sort_try0.0052_21-11-2010.err 100644 → 100755
File mode changed.
View
0 tst/string_sort_try0.cu 100644 → 100755
File mode changed.

0 comments on commit c50d381

Please sign in to comment.
Something went wrong with that request. Please try again.