Running Node on CUDA

1,709 views
Skip to first unread message

José Moreira

unread,
Sep 2, 2010, 10:14:09 PM9/2/10
to nod...@googlegroups.com
hi,

while i was anxiously waiting for the NodeKO results i was taking a look
at CUDA http://www.nvidia.com/object/cuda_home.html .

I have a MacBook Pro with an Nvidia 330m, which has CUDA support,
downloaded the SDK and docs and was preparing to take a look at it, but
i'm a C newb.


I found a page about GPU computing on Wikipedia which explains the
architecture on http://en.wikipedia.org/wiki/CUDA .

All i know of the node.js internals is what i seen on the node video
conf talk, and if my memory doesn't fail it talks about node having on
process and a single code execution stack? The wikipedia page states:

"Threads should be running in groups of at least 32 for best
performance, with total number of threads numbering in the thousands.
Branches in the program code do not impact performance significantly,
provided that each of 32 threads takes the same execution path; the SIMD
execution model becomes a significant limitation for any inherently
divergent task (e.g. traversing a space partitioning data structure
during raytracing)."

is it worth exploring, what do you think? If so, i call dibs on a
project name, nodeGT ;P

best

--
http://zemanel.eu
http://github.com/zemanel
http://pt.linkedin.com/in/josemoreira
http://djangopeople.net/josemoreira
irc://zem...@irc.freenode.net

Erik Corry

unread,
Sep 3, 2010, 4:02:14 AM9/3/10
to nod...@googlegroups.com
V8 (part of Node) only runs on an x86, x86-64 or ARM CPU so I think
CUDA is a non-starter.

2010/9/3 José Moreira <matrix...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com.
> To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.
>
>

José Moreira

unread,
Sep 3, 2010, 7:01:19 AM9/3/10
to nod...@googlegroups.com
yeah, i thought about that... i'll go knock on google's door. would be great to be able (or not) to offload at least some work to GPU...

anyway i'll go deeper on the cuda docs

2010/9/3 Erik Corry <erik....@gmail.com>

christkv

unread,
Sep 3, 2010, 8:16:48 AM9/3/10
to nodejs
I think there's some confusion here. I don't think you can get node.js
to run code on the GPU now or in the future as it's not meant to be
used as a CPU executing an application.

On the other hand you might be able to wrap CUDA or OpenCL code using C
++ to allow for doing operations on the GPU like matrix calculations
etc. But that's quite a challenge :)

If you do something around this I'll be very interested. Examples
could be encryption/decryption, matrix calculations, graph
analysis ....

On Sep 3, 1:01 pm, José Moreira <matrixowns...@gmail.com> wrote:
> yeah, i thought about that... i'll go knock on google's door. would be great
> to be able (or not) to offload at least some work to GPU...
>
> anyway i'll go deeper on the cuda docs
>
> 2010/9/3 Erik Corry <erik.co...@gmail.com>
>
>
>
>
>
>
>
>
>
> > V8 (part of Node) only runs on an x86, x86-64 or ARM CPU so I think
> > CUDA is a non-starter.
>
> > 2010/9/3 José Moreira <matrixowns...@gmail.com>:
> > > irc://zema...@irc.freenode.net
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "nodejs" group.
> > > To post to this group, send email to nod...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > nodejs+un...@googlegroups.com<nodejs%2Bunsu...@googlegroups.com>
> > .
> > > For more options, visit this group at
> >http://groups.google.com/group/nodejs?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nodejs" group.
> > To post to this group, send email to nod...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nodejs+un...@googlegroups.com<nodejs%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nodejs?hl=en.
>
> --http://zemanel.eu<http://goog_2123512744>http://github.com/zemanel<http://goog_2123512744>http://pt.linkedin.com/in/josemoreirahttp://djangopeople.net/josemoreira<http://goog_2123512744>
> irc://zema...@irc.freenode.net

christkv

unread,
Sep 3, 2010, 8:18:32 AM9/3/10
to nodejs
This looks like a cool lib for CUDA

http://code.google.com/p/thrust/

Serge in Darkness

unread,
Sep 3, 2010, 11:28:33 AM9/3/10
to nodejs
Can we offload hashing to CUDA? Maybe fork hashlib module or
something.

christkv

unread,
Sep 3, 2010, 3:38:03 PM9/3/10
to nodejs
OpenCL is probably a better target long term for this as CUDA is gona
be abandoned at some point being a Nvidia specific solution. Also
remember that on a server you'll have to basically add a gpu card to
do this increasing the deployment process so I'm not sure the
performance is worth it to be honest.

Another possibility for stuff like crypto/hashing is that someone find
and integrates some library that uses the new acceleration support in
core i7 etc

Akzhan Abdulin

unread,
Sep 3, 2010, 3:58:53 PM9/3/10
to nod...@googlegroups.com
José, node.JS is single-threaded, event-driven, application by design.

2010/9/3 José Moreira <matrix...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.

Stephen Belanger

unread,
Sep 3, 2010, 4:38:25 PM9/3/10
to nod...@googlegroups.com
GPU-based super computers are becoming more and more common, I think support for CUDA or OpenCL could actually be pretty handy, but I would support for that is more likely to come in the form of a forked version of node specifically designed for GPU-based super-computing.

José Moreira

unread,
Sep 3, 2010, 7:50:35 PM9/3/10
to nod...@googlegroups.com, Stephen Belanger
Hi,

yeah i was aware it's single process. Was just wondering that, since node.js allows the development of C modules, there could be a chance for integration here.
According to what i read on the Internet, Node.js is not only being used for web apps but also tooling like stress tests and data processing, meaning it's running apps not only on servers but "workstations" also.
Ofc i'm not deep into GPU computing or architectures to make an educated opinion at the moment.

OpenCL, if it is an alternative to CUDA, could be a better bet, since for example i applied as a single interested individual developer on the Nvidia website Developers and was turned down...

Em 10/09/03 21:38, Stephen Belanger escreveu:

José Moreira

unread,
Sep 3, 2010, 7:51:45 PM9/3/10
to nod...@googlegroups.com, christkv
What about streaming 3D "data" in realtime to the browser? ;P

Em 10/09/03 13:16, christkv escreveu:


> I think there's some confusion here. I don't think you can get node.js
> to run code on the GPU now or in the future as it's not meant to be
> used as a CPU executing an application.
>
> On the other hand you might be able to wrap CUDA or OpenCL code using C
> ++ to allow for doing operations on the GPU like matrix calculations
> etc. But that's quite a challenge :)
>
> If you do something around this I'll be very interested. Examples
> could be encryption/decryption, matrix calculations, graph
> analysis ....
>

> On Sep 3, 1:01 pm, Jos� Moreira <matrixowns...@gmail.com> wrote:
>> yeah, i thought about that... i'll go knock on google's door. would be great
>> to be able (or not) to offload at least some work to GPU...
>>
>> anyway i'll go deeper on the cuda docs
>>
>> 2010/9/3 Erik Corry <erik.co...@gmail.com>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> V8 (part of Node) only runs on an x86, x86-64 or ARM CPU so I think
>>> CUDA is a non-starter.

>>> 2010/9/3 Jos� Moreira <matrixowns...@gmail.com>:

irc://zem...@irc.freenode.net

José Moreira

unread,
Sep 3, 2010, 8:56:03 PM9/3/10
to nod...@googlegroups.com, christkv
Just to ad to the subject that i also found this:


http://mathema.tician.de/software/pycuda


Em 10/09/03 13:18, christkv escreveu:


> This looks like a cool lib for CUDA
>
> http://code.google.com/p/thrust/
>
> On Sep 3, 2:16 pm, christkv <chris...@gmail.com> wrote:
>> I think there's some confusion here. I don't think you can get node.js
>> to run code on the GPU now or in the future as it's not meant to be
>> used as a CPU executing an application.
>>
>> On the other hand you might be able to wrap CUDA or OpenCL code using C
>> ++ to allow for doing operations on the GPU like matrix calculations
>> etc. But that's quite a challenge :)
>>
>> If you do something around this I'll be very interested. Examples
>> could be encryption/decryption, matrix calculations, graph
>> analysis ....
>>

>> On Sep 3, 1:01 pm, Jos� Moreira <matrixowns...@gmail.com> wrote:
>>
>>
>>
>>
>>
>>
>>
>>> yeah, i thought about that... i'll go knock on google's door. would be great
>>> to be able (or not) to offload at least some work to GPU...
>>> anyway i'll go deeper on the cuda docs
>>> 2010/9/3 Erik Corry <erik.co...@gmail.com>
>>>> V8 (part of Node) only runs on an x86, x86-64 or ARM CPU so I think
>>>> CUDA is a non-starter.

>>>> 2010/9/3 Jos� Moreira <matrixowns...@gmail.com>:

irc://zem...@irc.freenode.net

Astro

unread,
Sep 3, 2010, 9:24:29 PM9/3/10
to nod...@googlegroups.com
José Moreira wrote:
> yeah i was aware it's single process. Was just wondering that, since
> node.js allows the development of C modules, there could be a chance for
> integration here.

Node does not allow the development of C modules. Node consists of v8
extensions written in C++ and JavaScript. JavaScript is what Node is
about.

GPUs are used for highly-parallelizable math-intensive tasks. Node is
single-threaded because IO isn't easily parallelizable. If processing
speed is your problem you will need to write algorithms in compiled
languages or for CUDA. Nothing of that is related to JavaScript or Node.

christkv

unread,
Sep 4, 2010, 7:12:53 AM9/4/10
to nodejs
Hi Astro

I think he is talking about being able to use the GPU for some
calculations like the python library he is pointing to. Also using a C
lib is trivial as you can wrap it in C++. Node is a combination of C+
+, C and JS :)

Cheers

Miguel Coquet

unread,
Sep 4, 2010, 7:32:12 AM9/4/10
to nod...@googlegroups.com
Hello José,

I'm not familiar with the existing CUDA and OpenCL C/C++ libs that exist right now, but off the top of my head, a module for this would certainly be interesting.

At first glance though, you would have your work cut out for you. Sounds like the kind of thing you would need to generate and manage your own thread pool for. Probably at the C/C++ module's end . That said, other than that, it should be a straight path to just porting the API as you see fit.

As a side note: I don't see Node being restricted to the server. I could really get into developing local apps with it, and don't see any reason why this would ever be a bad idea.

Cheers

José Moreira

unread,
Sep 14, 2010, 9:57:33 PM9/14/10
to nod...@googlegroups.com
found out that GPU computing supports "even driven development", executing code on teh GPu while the main process continues, which fits on the node.js "model" 

2010/9/4 Miguel Coquet <mco...@gmail.com>

Evan Larkin

unread,
Sep 14, 2010, 10:11:43 PM9/14/10
to nod...@googlegroups.com
It's also somewhat dangerous for NodeJS.

Currently, two contiguous lines of Javascript can be treated as if they will be atomic (because JS is single threaded). Giving it multiple threads stops us from being able to do that. It may even cause problems with V8 itself.

In short, while it might look to fit the node model, it poorly fits the javascript model (in general).

-Evan

Stephen Belanger

unread,
Sep 14, 2010, 10:19:01 PM9/14/10
to nod...@googlegroups.com
Well, considering that most browser vendors have been working on hardware acceleration for their Javascript engines, I don't think it's that unlikely to eventually see V8 add CUDA support. I wouldn't exactly expect that to be "soon" though.

Eugene Lazutkin

unread,
Sep 14, 2010, 10:20:42 PM9/14/10
to nod...@googlegroups.com
Why? Perfectly fits the worker model --- memory is not shared. From the
point of view of Node it is just an asynchronous process, which is
finished when an event is signaled. Both OS services (e.g., I/O) and
external computers (via network I/O) are treated the same way.

Cheers,

Eugene Lazutkin
http://lazutkin.com/

On 09/14/2010 09:11 PM, Evan Larkin wrote:
> It's also somewhat dangerous for NodeJS.
>
> Currently, two contiguous lines of Javascript can be treated as if they
> will be atomic (because JS is single threaded). Giving it multiple
> threads stops us from being able to do that. It may even cause problems
> with V8 itself.
>
> In short, while it might look to fit the node model, it poorly fits the
> javascript model (in general).
>
> -Evan
>

> On Sep 14, 2010, at 8:57 PM, Jos� Moreira wrote:
>
>> found out that GPU computing supports "even driven development",
>> executing code on teh GPu while the main process continues, which fits
>> on the node.js "model"
>>
>> 2010/9/4 Miguel Coquet
>> <mco...@gmail.com

>> <mailto:mco...@gmail.com>>
>>
>> Hello Jos�,


>>
>> I'm not familiar with the existing CUDA and OpenCL C/C++ libs that
>> exist right now, but off the top of my head, a module for this
>> would certainly be interesting.
>>
>> At first glance though, you would have your work cut out for you.
>> Sounds like the kind of thing you would need to generate and
>> manage your own thread pool for. Probably at the C/C++ module's
>> end . That said, other than that, it should be a straight path to
>> just porting the API as you see fit.
>>
>> As a side note: I don't see Node being restricted to the server. I
>> could really get into developing local apps with it, and don't see
>> any reason why this would ever be a bad idea.
>>
>> Cheers
>>
>> On Sep 4, 2010, at 12:12 PM, christkv wrote:
>>
>> > Hi Astro
>> >
>> > I think he is talking about being able to use the GPU for some
>> > calculations like the python library he is pointing to. Also
>> using a C
>> > lib is trivial as you can wrap it in C++. Node is a combination
>> of C+
>> > +, C and JS :)
>> >
>> > Cheers
>> >
>> > On Sep 4, 3:24 am, Astro <as...@spaceboyz.net

>> <mailto:as...@spaceboyz.net>> wrote:


>> >> Jos� Moreira wrote:
>> >>> yeah i was aware it's single process. Was just wondering that,
>> since
>> >>> node.js allows the development of C modules, there could be a
>> chance for
>> >>> integration here.
>> >>
>> >> Node does not allow the development of C modules. Node consists
>> of v8
>> >> extensions written in C++ and JavaScript. JavaScript is what
>> Node is
>> >> about.
>> >>
>> >> GPUs are used for highly-parallelizable math-intensive tasks.
>> Node is
>> >> single-threaded because IO isn't easily parallelizable. If
>> processing
>> >> speed is your problem you will need to write algorithms in compiled
>> >> languages or for CUDA. Nothing of that is related to JavaScript
>> or Node.
>> >
>> > --
>> > You received this message because you are subscribed to the
>> Google Groups "nodejs" group.
>> > To post to this group, send email to
>> nod...@googlegroups.com

>> <mailto:nod...@googlegroups.com>.


>> > To unsubscribe from this group, send email to
>> nodejs+un...@googlegroups.com

>> <mailto:nodejs%2Bunsu...@googlegroups.com>.


>> > For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to
>> nod...@googlegroups.com

>> <mailto:nod...@googlegroups.com>.


>> To unsubscribe from this group, send email to
>> nodejs+un...@googlegroups.com

>> <mailto:nodejs%2Bunsu...@googlegroups.com>.


>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en.
>>
>>
>>
>>
>> --

>> http://zemanel.eu <http://goog_2123512744/>
>> http://github.com/zemanel <http://goog_2123512744/>
>> http://pt.linkedin.com/in/josemoreira
>> http://djangopeople.net/josemoreira <http://goog_2123512744/>


>> irc://zem...@irc.freenode.net
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to
>> nod...@googlegroups.com

>> <mailto:nod...@googlegroups.com>.


>> To unsubscribe from this group, send email to
>> nodejs+un...@googlegroups.com

>> <mailto:nodejs+un...@googlegroups.com>.

Evan Larkin

unread,
Sep 15, 2010, 12:16:12 AM9/15/10
to nod...@googlegroups.com
Perhaps my understanding of CUDA is lacking, but I understood it to be all about large numbers of parallel executing threads. If instead you can use it to parallelize processes, that's a different story.

Many processes: Good
Many threads: Bad

At least, Brendan Eich is against concurrency through threads (and I'm inclined to agree with him in a language with mutable variables):

http://developer.yahoo.com/yui/theater/video.php?v=eich-yuiconf2009-harmony

Brendan Eich: I think the frontrunner is event loop concurrency with promises, sometimes called futures, sometimes people make pedantic distinctions. It preserves a single-threaded view of JavaScript and it allows you, nevertheless, to write concurrent code.

http://weblogs.mozillazine.org/roadmap/archives/2007/02/threads_suck.html (link to his blog)

-Evan

Forgive me if I'm taking these quotes out of context, but I don't believe I am.

On Sep 14, 2010, at 9:20 PM, Eugene Lazutkin wrote:

> Why? Perfectly fits the worker model --- memory is not shared. From the
> point of view of Node it is just an asynchronous process, which is
> finished when an event is signaled. Both OS services (e.g., I/O) and
> external computers (via network I/O) are treated the same way.
>
> Cheers,
>
> Eugene Lazutkin
> http://lazutkin.com/
>
> On 09/14/2010 09:11 PM, Evan Larkin wrote:
>> It's also somewhat dangerous for NodeJS.
>>
>> Currently, two contiguous lines of Javascript can be treated as if they
>> will be atomic (because JS is single threaded). Giving it multiple
>> threads stops us from being able to do that. It may even cause problems
>> with V8 itself.
>>
>> In short, while it might look to fit the node model, it poorly fits the
>> javascript model (in general).
>>
>> -Evan
>>

>> On Sep 14, 2010, at 8:57 PM, José Moreira wrote:
>>
>>> found out that GPU computing supports "even driven development",
>>> executing code on teh GPu while the main process continues, which fits
>>> on the node.js "model"
>>>
>>> 2010/9/4 Miguel Coquet
>>> <mco...@gmail.com
>>> <mailto:mco...@gmail.com>>
>>>

>>> Hello José,


>>>
>>> I'm not familiar with the existing CUDA and OpenCL C/C++ libs that
>>> exist right now, but off the top of my head, a module for this
>>> would certainly be interesting.
>>>
>>> At first glance though, you would have your work cut out for you.
>>> Sounds like the kind of thing you would need to generate and
>>> manage your own thread pool for. Probably at the C/C++ module's
>>> end . That said, other than that, it should be a straight path to
>>> just porting the API as you see fit.
>>>
>>> As a side note: I don't see Node being restricted to the server. I
>>> could really get into developing local apps with it, and don't see
>>> any reason why this would ever be a bad idea.
>>>
>>> Cheers
>>>
>>> On Sep 4, 2010, at 12:12 PM, christkv wrote:
>>>
>>>> Hi Astro
>>>>
>>>> I think he is talking about being able to use the GPU for some
>>>> calculations like the python library he is pointing to. Also
>>> using a C
>>>> lib is trivial as you can wrap it in C++. Node is a combination
>>> of C+
>>>> +, C and JS :)
>>>>
>>>> Cheers
>>>>
>>>> On Sep 4, 3:24 am, Astro <as...@spaceboyz.net
>>> <mailto:as...@spaceboyz.net>> wrote:

Eugene Lazutkin

unread,
Sep 15, 2010, 12:56:10 AM9/15/10
to nod...@googlegroups.com
Heh, I am not going into religious topics. My understanding is that Jos�
Moreira already decided that it'll be impossible to run Node on GPU (or
JS on GPU) for many technical and architectural reasons. Now he is
talking about bridging existing C/C++ libraries, which can load GPU,
with Node, so that the power of GPU can be easily harnessed from JS, if
needed.

Usually GPU is programmed in a specialized language (look for
"shaders"), which fits better its unique computing environment, not a
general-purpose language.

In this schema, GPU is effectively a massively parallel specialized
coprocessor, which you can use to offload some specific computationally
intensive tasks to, and which signals back when the task is done.

Cheers,

Eugene Lazutkin
http://lazutkin.com/

>>> On Sep 14, 2010, at 8:57 PM, Jos� Moreira wrote:
>>>
>>>> found out that GPU computing supports "even driven development",
>>>> executing code on teh GPu while the main process continues, which fits
>>>> on the node.js "model"
>>>>
>>>> 2010/9/4 Miguel Coquet
>>>> <mco...@gmail.com
>>>> <mailto:mco...@gmail.com>>
>>>>

>>>> Hello Jos�,


>>>>
>>>> I'm not familiar with the existing CUDA and OpenCL C/C++ libs that
>>>> exist right now, but off the top of my head, a module for this
>>>> would certainly be interesting.
>>>>
>>>> At first glance though, you would have your work cut out for you.
>>>> Sounds like the kind of thing you would need to generate and
>>>> manage your own thread pool for. Probably at the C/C++ module's
>>>> end . That said, other than that, it should be a straight path to
>>>> just porting the API as you see fit.
>>>>
>>>> As a side note: I don't see Node being restricted to the server. I
>>>> could really get into developing local apps with it, and don't see
>>>> any reason why this would ever be a bad idea.
>>>>
>>>> Cheers
>>>>
>>>> On Sep 4, 2010, at 12:12 PM, christkv wrote:
>>>>
>>>>> Hi Astro
>>>>>
>>>>> I think he is talking about being able to use the GPU for some
>>>>> calculations like the python library he is pointing to. Also
>>>> using a C
>>>>> lib is trivial as you can wrap it in C++. Node is a combination
>>>> of C+
>>>>> +, C and JS :)
>>>>>
>>>>> Cheers
>>>>>
>>>>> On Sep 4, 3:24 am, Astro <as...@spaceboyz.net
>>>> <mailto:as...@spaceboyz.net>> wrote:

Fillano Feng

unread,
Sep 15, 2010, 1:29:15 AM9/15/10
to nod...@googlegroups.com
I agreed. But in this manner, the subject should not be "running node on CUDA" but assigning tasks to CUDA. GPU is not designed for general purpose usage. And I don't think Node can really "run" on GPU.


Fillano

2010/9/15 Eugene Lazutkin <eugene....@gmail.com>
Heh, I am not going into religious topics. My understanding is that José
>>>>    Hello José,

>>>>
>>>>    I'm not familiar with the existing CUDA and OpenCL C/C++ libs that
>>>>    exist right now, but off the top of my head, a module for this
>>>>    would certainly be interesting.
>>>>
>>>>    At first glance though,  you would have your work cut out for you.
>>>>    Sounds like the kind of thing you would need to generate and
>>>>    manage your own thread pool for. Probably at the C/C++ module's
>>>>    end . That said, other than that, it should be a straight path to
>>>>    just porting the API as you see fit.
>>>>
>>>>    As a side note: I don't see Node being restricted to the server. I
>>>>    could really get into developing local apps with it, and don't see
>>>>    any reason why this would ever be a bad idea.
>>>>
>>>>    Cheers
>>>>
>>>>    On Sep 4, 2010, at 12:12 PM, christkv wrote:
>>>>
>>>>> Hi Astro
>>>>>
>>>>> I think he is talking about being able to use the GPU for some
>>>>> calculations like the python library he is pointing to. Also
>>>>    using a C
>>>>> lib is trivial as you can wrap it in C++. Node is a combination
>>>>    of C+
>>>>> +, C and JS :)
>>>>>
>>>>> Cheers
>>>>>
>>>>> On Sep 4, 3:24 am, Astro <as...@spaceboyz.net
>>>>    <mailto:as...@spaceboyz.net>> wrote:



--
AUFKLÄRUNG ist der Ausgang des Menschen aus seiner selbstverschuldeten Unmündigkeit. Unmündigkeit ist das Unvermögen, sich seines Verstandes ohne Leitung eines anderen zu bedienen. Selbstverschuldet ist diese Unmündigkeit, wenn die Ursache derselben nicht am Mangel des Verstandes, sondern der Entschließung und des Mutes liegt, sich seiner ohne Leitung eines andern zu bedienen. Sapere aude! Habe Mut, dich deines eigenen Verstandes zu bedienen! ist also der Wahlspruch der Aufklärung.

Tim

unread,
Sep 15, 2010, 8:54:47 AM9/15/10
to nodejs

On Sep 15, 5:29 pm, Fillano Feng <fillano.f...@gmail.com> wrote:
> I agreed. But in this manner, the subject should not be "running node on
> CUDA" but assigning tasks to CUDA. GPU is not designed for general purpose
> usage. And I don't think Node can really "run" on GPU.
>
> Fillano
>
> --
> AUFKLÄRUNG ist der Ausgang des Menschen aus seiner selbstverschuldeten
> Unmündigkeit. Unmündigkeit ist das Unvermögen, sich seines Verstandes ohne
> Leitung eines anderen zu bedienen. Selbstverschuldet ist diese Unmündigkeit,
> wenn die Ursache derselben nicht am Mangel des Verstandes, sondern der
> Entschließung und des Mutes liegt, sich seiner ohne Leitung eines andern zu
> bedienen. Sapere aude! Habe Mut, dich deines eigenen Verstandes zu bedienen!
> ist also der Wahlspruch der Aufklärung.

+1. Running Node on a GPU is a bad idea, or maybe even unfeasible.
Offloading work to the GPU from Node with ECMAScript however is
somewhat more sane.

A really basic API could be something like:

cuda.do(some_computation, function (error, results) { ... });

For networking servers it would have limited use, but if Node wants to
start doing system level stuff, then it wouldn't be such a bad idea...

Tim.

José Moreira

unread,
Sep 15, 2010, 9:41:36 AM9/15/10
to nod...@googlegroups.com, nod...@googlegroups.com
Touchée

Sent from your iPhone

No dia 15 de Set de 2010, às 05:56, Eugene Lazutkin <eugene....@gmail.com> escreveu:

> Heh, I am not going into religious topics. My understanding is that José

>>>>> Hello José,


>>>>>
>>>>> I'm not familiar with the existing CUDA and OpenCL C/C++ libs that
>>>>> exist right now, but off the top of my head, a module for this
>>>>> would certainly be interesting.
>>>>>
>>>>> At first glance though, you would have your work cut out for you.
>>>>> Sounds like the kind of thing you would need to generate and
>>>>> manage your own thread pool for. Probably at the C/C++ module's
>>>>> end . That said, other than that, it should be a straight path to
>>>>> just porting the API as you see fit.
>>>>>
>>>>> As a side note: I don't see Node being restricted to the server. I
>>>>> could really get into developing local apps with it, and don't see
>>>>> any reason why this would ever be a bad idea.
>>>>>
>>>>> Cheers
>>>>>
>>>>> On Sep 4, 2010, at 12:12 PM, christkv wrote:
>>>>>
>>>>>> Hi Astro
>>>>>>
>>>>>> I think he is talking about being able to use the GPU for some
>>>>>> calculations like the python library he is pointing to. Also
>>>>> using a C
>>>>>> lib is trivial as you can wrap it in C++. Node is a combination
>>>>> of C+
>>>>>> +, C and JS :)
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>> On Sep 4, 3:24 am, Astro <as...@spaceboyz.net
>>>>> <mailto:as...@spaceboyz.net>> wrote:

José Moreira

unread,
Sep 15, 2010, 9:46:28 AM9/15/10
to nod...@googlegroups.com, nod...@googlegroups.com
Youre right. Initially when i created the post i was thinking on the possibility of running node itself. Which is not viable. Perhaps i should have rezearched deeper first. 


Now im wondering about a C++ module to offload computing async to the gpu. Been reading the cuda docs and code examples

Sent from your iPhone

Renato Elias

unread,
Sep 15, 2010, 11:21:19 AM9/15/10
to nod...@googlegroups.com
But the next version of  Chorme will use Accelerated Graphics right? 
Not Chormium that controls this process?

Fillano Feng

unread,
Sep 15, 2010, 1:15:26 PM9/15/10
to nod...@googlegroups.com
I think that Accelerated Graphics is for rendering htmls, images, video, canvas etc.

Besides, I just take a look the introduction from wikipedia: http://en.wikipedia.org/wiki/CUDA

The way to use CUDA is just giving them some data, instructing them to process data and then collect the result. I really don't think there would be anything related to accelerating javascript.


Fillano

2010/9/15 Renato Elias <renato...@gmail.com>

José Moreira

unread,
Sep 15, 2010, 1:24:41 PM9/15/10
to nod...@googlegroups.com
Ye. On a 1st stage my goal atm is to create a simple math api (vectors/matrices?) ...

2010/9/15 Fillano Feng <fillan...@gmail.com>



--

Renato Elias

unread,
Sep 15, 2010, 1:40:07 PM9/15/10
to nod...@googlegroups.com
Yes,

Look this: http://blog.chromium.org/2010/08/chromium-graphics-overhaul.html is the uses exactly your think.

But in my opinion is cool and useful use of (cuda/opengl es) for processes math event, and the context system of the js it allows an elegant use of gpu.

Jorge

unread,
Sep 16, 2010, 4:14:21 AM9/16/10
to nod...@googlegroups.com
Evan,

The whole point in providing a callback to say fs.read(params, callback), is just not to block the JS (single) thread.

But whether the task at hand (the file read above) is performed in a separate thread (as is currently being done in Node), or even in a separate process, or in a GPU provided by a CUDA library, or even on a remote computer at the other end of the world, doesn't matter.

It fits perfectly in Node's scheme, istm: cuda.execute(sourceCode, callback);

Why not ?
-- 
Jorge.

Akzhan Abdulin

unread,
Sep 16, 2010, 4:45:58 AM9/16/10
to nod...@googlegroups.com
Nobody restricts You from running GPU threads from node.js at this time.
You can use CUDA now, but node.js and operatng system itself ran on CPU.
By the way, GPU has no access to general meory, ports, file system etc.
2010/9/16 Jorge <jo...@jorgechamorro.com>

Jorge Chamorro

unread,
Sep 16, 2010, 4:49:49 AM9/16/10
to nod...@googlegroups.com
And wrt to "event driven", if a cuda instance were an EventEmitter in Node's JS context, it would be fine too:

var cudaTask= cuda.newInstance(srcProgram);
cudaTask.addListener("onGotSomethingForU", function gladToKnow (it) { ... });

Why not ?

Just like a worker that runs on a specialized cpu (a GPU).
-- 
Jorge.

christkv

unread,
Sep 16, 2010, 5:36:26 AM9/16/10
to nodejs
I would hope it would be OpenCL instead of CUDA as I think it has more
momentum and is more standardized than CUDA (CUDA being Nvidia tech).

Just my five cents.

Cheers

Christian

On Sep 16, 10:49 am, Jorge Chamorro <jo...@jorgechamorro.com> wrote:
> And wrt to "event driven", if a cuda instance were an EventEmitter in Node's JS context, it would be fine too:
>
> var cudaTask= cuda.newInstance(srcProgram);
> cudaTask.addListener("onGotSomethingForU", function gladToKnow (it) { ... });
>
> Why not ?
>
> Just like a worker that runs on a specialized cpu (a GPU).
> --
> Jorge.
>
> On 16/09/2010, at 10:14, Jorge wrote:
>
>
>
>
>
>
>
> > Evan,
>
> > The whole point in providing a callback to say fs.read(params, callback), is just not to block the JS (single) thread.
>
> > But whether the task at hand (the file read above) is performed in a separate thread (as is currently being done in Node), or even in a separate process, or in a GPU provided by a CUDA library, or even on a remote computer at the other end of the world, doesn't matter.
>
> > It fits perfectly in Node's scheme, istm: cuda.execute(sourceCode, callback);
>
> > Why not ?
> > --
> > Jorge.
>
> > On 15/09/2010, at 04:11, Evan Larkin wrote:
>
> >> It's also somewhat dangerous for NodeJS.
>
> >> Currently, two contiguous lines of Javascript can be treated as if they will be atomic (because JS is single threaded). Giving it multiple threads stops us from being able to do that. It may even cause problems with V8 itself.
>
> >> In short, while it might look to fit the node model, it poorly fits the javascript model (in general).
>
> >> -Evan
>
> >> On Sep 14, 2010, at 8:57 PM, José Moreira wrote:
>
> >>> found out that GPU computing supports "even driven development", executing code on teh GPu while the main process continues, which fits on the node.js "model"
>
> >>> 2010/9/4 Miguel Coquet <mcoq...@gmail.com>
> >>> > For more options, visit this group athttp://groups.google.com/group/nodejs?hl=en.
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups "nodejs" group.
> >>> To post to this group, send email to nod...@googlegroups.com.
> >>> To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
> >>> For more options, visit this group athttp://groups.google.com/group/nodejs?hl=en.
> >>> irc://zema...@irc.freenode.net
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups "nodejs" group.
> >>> To post to this group, send email to nod...@googlegroups.com.
> >>> To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
> >>> For more options, visit this group athttp://groups.google.com/group/nodejs?hl=en.

Evan Larkin

unread,
Sep 16, 2010, 9:38:31 AM9/16/10
to nod...@googlegroups.com
I still think that running javascript in many threads is like opening pandora's box. The language designers have resisted threads for so long, it's not wise to just go ahead and add them.

That said, running jobs in a separate thread or a separate process is fine, as long as that job has absolutely zero access to the javascript runtime. If it's an eventemitter, that's fine, but that wasn't my understanding of this thread.

-Evan
Message has been deleted

José Moreira

unread,
Sep 16, 2010, 7:14:14 PM9/16/10
to nod...@googlegroups.com, Ricardo Tomasi
yeah i think you're right on both. I'm sticking at NVIDIA at the moment
due do it having good documentation and, as far as i read somewhere
else, better features bu the goal would be to support OpenCL which seems
closer to being an open standard.

currently i'm interested in testing all this developing a simple math
api, something like:

var math = require('gpu').math;
math.multiplyMatrix(matrixA, matrixB, callback)
...

Or porting something like Python's Numpy/Scipy.

In other news, i'm also wondering how much server-side geo location (a
recent trend) could benefit from this,
something like "sending" a list of coordinates to a GPU and getting
back, for example, all the points in a 1 mile radius from point X.
Investigating the PostGis API came to mind.

Em 10/09/16 19:59, Ricardo Tomasi escreveu:
> +1 OpenCL
>
> Would it be feasible to create a JS API on top of it? It's kind of
> weird to pass a string of foreign code as an argument. The most
> practical use I can think for that is speeding up loops for things
> like filtering data or image processing, that would be great.

>>>>> On Sep 14, 2010, at 8:57 PM, Jos� Moreira wrote:
>>>>>> found out that GPU computing supports "even driven development", executing code on teh GPu while the main process continues, which fits on the node.js "model"
>>>>>> 2010/9/4 Miguel Coquet <mcoq...@gmail.com>

>>>>>> Hello Jos�,


>>>>>> I'm not familiar with the existing CUDA and OpenCL C/C++ libs that exist right now, but off the top of my head, a module for this would certainly be interesting.
>>>>>> At first glance though, you would have your work cut out for you. Sounds like the kind of thing you would need to generate and manage your own thread pool for. Probably at the C/C++ module's end . That said, other than that, it should be a straight path to just porting the API as you see fit.
>>>>>> As a side note: I don't see Node being restricted to the server. I could really get into developing local apps with it, and don't see any reason why this would ever be a bad idea.
>>>>>> Cheers
>>>>>> On Sep 4, 2010, at 12:12 PM, christkv wrote:
>>>>>>> Hi Astro
>>>>>>> I think he is talking about being able to use the GPU for some
>>>>>>> calculations like the python library he is pointing to. Also using a C
>>>>>>> lib is trivial as you can wrap it in C++. Node is a combination of C+
>>>>>>> +, C and JS :)
>>>>>>> Cheers
>>>>>>> On Sep 4, 3:24 am, Astro <as...@spaceboyz.net> wrote:

irc://zem...@irc.freenode.net

Stephen Belanger

unread,
Sep 16, 2010, 7:27:28 PM9/16/10
to nod...@googlegroups.com
It would be pretty handy for finding geographical points based on ranges. There is plenty of awesome stuff that node could gain from a module for OpenCL/CUDA offloading.

2010/9/16 José Moreira <matrix...@gmail.com>
>>>>> On Sep 14, 2010, at 8:57 PM, José Moreira wrote:
>>>>>> found out that GPU computing supports "even driven development", executing code on teh GPu while the main process continues, which fits on the node.js "model"
>>>>>> 2010/9/4 Miguel Coquet <mcoq...@gmail.com>
>>>>>> Hello José,

>>>>>> I'm not familiar with the existing CUDA and OpenCL C/C++ libs that exist right now, but off the top of my head, a module for this would certainly be interesting.
>>>>>> At first glance though,  you would have your work cut out for you. Sounds like the kind of thing you would need to generate and manage your own thread pool for. Probably at the C/C++ module's end . That said, other than that, it should be a straight path to just porting the API as you see fit.
>>>>>> As a side note: I don't see Node being restricted to the server. I could really get into developing local apps with it, and don't see any reason why this would ever be a bad idea.
>>>>>> Cheers
>>>>>> On Sep 4, 2010, at 12:12 PM, christkv wrote:
>>>>>>> Hi Astro
>>>>>>> I think he is talking about being able to use the GPU for some
>>>>>>> calculations like the python library he is pointing to. Also using a C
>>>>>>> lib is trivial as you can wrap it in C++. Node is a combination of C+
>>>>>>> +, C and JS :)
>>>>>>> Cheers
>>>>>>> On Sep 4, 3:24 am, Astro <as...@spaceboyz.net> wrote:

José Moreira

unread,
Sep 16, 2010, 7:32:51 PM9/16/10
to nod...@googlegroups.com, Stephen Belanger
The coordinate ranges was just an example. Anyway i borrowed a C book from a friend today and i'm gonna try to get some code out in the next couple of weeks :p

my repo for this is at http://github.com/zemanel/node-gt

Em 10/09/17 00:27, Stephen Belanger escreveu:

Fillano Feng

unread,
Sep 17, 2010, 1:40:12 AM9/17/10
to nod...@googlegroups.com
for multi-threading support, i do think this would be a good solution:


fillano

2010/9/16 Evan Larkin <evan.la...@gmail.com>



--

Tim Smart

unread,
Sep 17, 2010, 2:30:23 AM9/17/10
to nodejs
On 17 September 2010 17:40, Fillano Feng <fillan...@gmail.com> wrote:
for multi-threading support, i do think this would be a good solution:


fillano
 
Peter Griess has come up with a 'blessed' Web Workers library. I would recommend using his if you want to scale across multiple CPU cores.

Tim.

Fillano Feng

unread,
Sep 17, 2010, 3:09:16 AM9/17/10
to nod...@googlegroups.com
Wow, Thank you Tim. I'll try on this.

Fillano

2010/9/17 Tim Smart <t...@fostle.com>

--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.
Reply all
Reply to author
Forward
0 new messages