TCL to CUDA Converting TCL scripts to CUDA


Does anyone knows of a utility that convert TCL scripts to CUDA directly

or we need to use using TCL to C compiler and then CUDA

Thanks for sharing your thoughts :rolleyes:

I very much doubt either strategy would be feasible. CUDA is about as far away from the functional programming model that TCL is based one as you can get.

I’m looking for a method to convert lead into gold; I’ve yet to make much progress on the matter. Does anyone have any suggestions? Also needed: water to wine conversion. Should I look into a direct transmutation or get a mortal to deity conversion and then perform miracle?

In all seriousness, the fact that you’re asking this question likely signals that you do not actually understand what CUDA is, how it works and why it can lead to much faster execution for many problems. I recommend reading any of the introductory materials out there. The programming guide would be a good start or maybe the class at UIUC.

It would be more helpful if you described what the TCL script does and then you might receive more helpful advice as to how to use CUDA to implement it.

Add sugar?

Here are a few reasons why this will never work:

a) Tcl is serialized and operates in a completely different range than CUDA. CUDA deals primarily with taking some data, processing it, and returning it. It has nothing to do with output (except openGL stuff) and nothing to do with the high level stuff that Tcl does. In CUDA you spend time managing bytes, in Tcl you spend time managing… namespaces.

B) No other language has a direct “convert to CUDA” possability, since CUDA really works a LOT differently than any other serial language. There are some codes written to be parallel, but even these require extensive work to run on CUDA and to make them run efficiently on CUDA.

My advise is to take the computationally expensive part, and make a CUDA program from it. (By knowing the algorithm, and writing a CUDA program from scratch). Then call this CUDA program from your Tcl program.

CUDA is not an instant speed up. A lot of work/research/knowledge needs to be done before you can realise great speed advantages.


To get tcl going with using Cuda, see here, to make a parallel implementation of Tcl, which indeed I advocated some time ago, I guess quite some work would be needed. I recall there is an effort for LISP going on and there is SWIG which can convert at language interface level.

I’m sure I’d find it fun to try out some (for me) essential tcl-like things like TAG finding, list operations and such in cuda.

Theo Verelst

Calling a C funtion you wrote which then calls a CUDA kernel you wrote is far cry from running some script that automagically converts tcl into cuda code. Once you can interface with C, you can call CUDA - that isn’t hard. What is hard is auto-parallelization.

People have been working on the auto-parallelizing compiler (which is essentially what a tcl->cuda converter would be) for a very long time and aside from some very limited success with fortran, I’m not aware of anything that has actually turned out to be useful. For example, I’ve never heard of IBM’s “octopiler” for the CELL again after an initial mention when the CELL first came out. I don’t think anyone is using it to write production or even research code.

I’m sure you can figure out how to do some tcl-like things in cuda. But taking as input a legacy tcl code of any appreciable length and generating even remotely decent cuda code is a long way off.