开发者

Embed V8 in OpenCL application?

I am using OpenCL to write GPGPU kernels which target the NVidia CUDA runtime. I was recently reading up on V8 and found the page describing V8 embedding techniques:

http://code.google.com/apis/v8/embed.html

Is it possible to 'wrap' all the OpenCL functions in V8 'templates' so that I can write kernel logic in JavaScript?

For reference, links to the OpenCL 1.1 C++ bindings are on the Khronos web site.

My main concern is that开发者_运维技巧 OpenCL relies heavily on OpenGL. Would a V8 OpenCL wrapper entail wrapping large portions of OpenGL (or prohibitively, the closed-source CUDA runtime) as well? Or is it simply impossible to reconcile the V8 virtual machine and CUDA runtimes?


It may be "possible" but most likely infeasible and impractical. Interpreters are inherently serial processors. You would have to spawn an interpreter for each Thread ( or at least each Thread Group using shared memory, but then you would have to deal with threads stomping on each other if they used the same interpreter instance ). Most video cards do not have the memory to do this. I suppose you could map shared Host memory to get around this.

Bottom Line.

Possible yes, But you would defeat the purpose of OpenCL being fast and it would be literally hundreds if not millions of times slower and extremely hard to implement.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜