テキストファイルの行、行の長さ、読み取った行の量をロードし、正しい方法でキャストして GPU に渡す方法は?
意味:
入力テキスト ファイル:
Line1
Line2
..
LineN
app.cl
#define UP_LIMIT 256
typedef struct {
uint bar; // amount of read lines
} foomatic;
typedef struct {
uint len; // length of line
uchar s[UP_LIMIT]; // line
} foo;
__kernel foobar(__global foo * kernel_in, __global foomatic kernel_in2){
// do something
}
main.cpp
#define LLEN 256
typedef struct {
cl_uint bar; // amount of read lines
} foomatic;
typedef struct {
cl_uint len; // length of line
cl_uchar s[LLEN]; // line
} foo;
int main(){
// load from file
// count lines of file
foo * input = new foo[N]; // N is the amount of lines of source text file
// cast line to cl_uchar
// pass lines, their lengths and number of lines to ocl kernel
delete [] input;
}