[go: up one dir, main page]

Menu

[r73]: / client / testdc.cpp  Maximize  Restore  History

Download this file

91 lines (68 with data), 1.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include "dcclient.h"
#include <iostream>
using namespace std;
using namespace cb;
int main(int argc, char** argv)
{
Sector::init(argv[1], atoi(argv[2]));
vector<string> files;
files.insert(files.begin(), "stream.dat");
Stream s;
s.init(files);
Stream temp;
temp.m_strName = "stream_sort_bucket";
temp.init(4);
Process* myproc = Sector::createJob();
if (myproc->run(s, temp, "sorthash", 1) < 0)
{
cout << "failed to find any computing resources." << endl;
return -1;
}
while (true)
{
Result* res;
if (-1 == myproc->read(res, true))
{
if (myproc->checkProgress() == -1)
{
cerr << "all SPEs failed\n";
break;
}
if (myproc->checkProgress() == 100)
break;
continue;
}
}
Stream output;
output.m_strName = "stream_sort_result";
output.init(-1);
if (myproc->run(temp, output, "sort", -1) < 0)
{
cout << "failed to find any computing resources." << endl;
return -1;
}
while (true)
{
Result* res;
if (-1 == myproc->read(res, true))
{
if (myproc->checkProgress() == -1)
{
cerr << "all SPEs failed\n";
break;
}
if (myproc->checkProgress() == 100)
break;
continue;
}
}
cout << "SPE COMPLETED " << output.m_iFileNum << " " << output.m_vFiles[0] << endl;
myproc->close();
Sector::releaseJob(myproc);
Sector::close();
return 0;
}
// user defined process
//int myProc(const char* unit, const int& rows, const int64_t* index, char* result, int& rsize, int& rrows, int64_t* rindex, int& bid, const char* param, const int& psize)
//{
//}