www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D for TensorFlow-like library

reply Muktabh <maco.anshu gmail.com> writes:
Google recently announced a distributed computational graph 
engine called tensorflow 
(https://www.youtube.com/watch?v=90-S1M7Ny_o). They have written 
the backend in C++ and have a Python/C++ frontend. I am a D 
newbie and am reading through Ali's book, but still dont know 
enough about it, hence the question.
Will it be a good idea to develop an opensource implementation in 
D than C++, if I try to write it ? Since I am reading about D, I 
would love if I can apply what I learn here. Sorry if the 
question sounds stupid, I am not a systems programmer and mostly 
work with Python-Numpy stack.
Nov 08 2015
next sibling parent reply Jack Stouffer <jack jackstouffer.com> writes:
On Sunday, 8 November 2015 at 13:48:30 UTC, Muktabh wrote:
 Will it be a good idea to develop an opensource implementation 
 in D than C++, if I try to write it?
I mean, you can if you want to, but it would make more sense to just make bindings to library for D. Rewriting everything for a language in that language doesn't scale. Also, in the future, please post questions like this to the "Learn" page. Thanks.
Nov 08 2015
parent reply Muktabh <maco.anshu gmail.com> writes:
On Sunday, 8 November 2015 at 16:31:44 UTC, Jack Stouffer wrote:
 On Sunday, 8 November 2015 at 13:48:30 UTC, Muktabh wrote:
 Will it be a good idea to develop an opensource implementation 
 in D than C++, if I try to write it?
I mean, you can if you want to, but it would make more sense to just make bindings to library for D. Rewriting everything for a language in that language doesn't scale. Also, in the future, please post questions like this to the "Learn" page. Thanks.
Sorry for posting it in the wrong group, I was not aware about the learn group. We cannot make D bindings to it because it is a closed source project by Google and only a spec like mapreduce will be released, so I thought maybe I might try and come up with an open source implementation. I was just curious if D would be a good choice language for a library like this instead of C++ which is used by Google.
Nov 08 2015
next sibling parent reply TheFlyingFiddle <kurtyan student.chalmers.se> writes:
On Sunday, 8 November 2015 at 17:47:33 UTC, Muktabh wrote:
 We cannot make D bindings to it because it is a closed source 
 project by Google and only a spec like mapreduce will be 
 released, so I thought maybe I might try and come up with an 
 open source implementation. I was just curious if D would be a 
 good choice language for a library like this instead of C++ 
 which is used by Google.
Well, if you are going to write it yourself i see no reason why D would be any worse a language the C++. You can get the same speed, interface with the GPU in pretty much the same way etc. You could probably do a lot in compile time to simplify writing kernels in D. From my point of view D is simpler than C++ as-well so that should help implementation. (no headers, sane meta programming etc.) It does seem to be a huge undertaking however since tensorflow seems to be a very complex library. But if you feel confident in this domain then I would say go for it. It would be very cool to have something like this in D.
Nov 08 2015
parent reply Muktabh <maco.anshu gmail.com> writes:
On Sunday, 8 November 2015 at 18:06:00 UTC, TheFlyingFiddle wrote:
 On Sunday, 8 November 2015 at 17:47:33 UTC, Muktabh wrote:
 We cannot make D bindings to it because it is a closed source 
 project by Google and only a spec like mapreduce will be 
 released, so I thought maybe I might try and come up with an 
 open source implementation. I was just curious if D would be a 
 good choice language for a library like this instead of C++ 
 which is used by Google.
Well, if you are going to write it yourself i see no reason why D would be any worse a language the C++. You can get the same speed, interface with the GPU in pretty much the same way etc. You could probably do a lot in compile time to simplify writing kernels in D. From my point of view D is simpler than C++ as-well so that should help implementation. (no headers, sane meta programming etc.) It does seem to be a huge undertaking however since tensorflow seems to be a very complex library. But if you feel confident in this domain then I would say go for it. It would be very cool to have something like this in D.
Thanks for your answer. It is a huge task and I am not going to achieve it all alone myself. I will start it alone but if my startup (which works on Deep Learning) scales up, we might work on it as a team.
Nov 08 2015
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 11/08/2015 01:36 PM, Muktabh wrote:
 It is a huge task and I am not going to achieve it all alone myself. I
 will start it alone but if my startup (which works on Deep Learning)
 scales up, we might work on it as a team.
If you have an edge regarding design ideas for such an engine, that would be a task well worth tackling, and D is a great language for rapid development of efficient numeric code. I recommend securing the help of D experts here to get you started - e.g. share your code here early and often for feedback. Good luck! -- Andrei
Nov 08 2015
prev sibling parent reply jmh530 <john.michael.hall gmail.com> writes:
On Sunday, 8 November 2015 at 17:47:33 UTC, Muktabh wrote:
 We cannot make D bindings to it because it is a closed source 
 project by Google and only a spec like mapreduce will be 
 released, so I thought maybe I might try and come up with an 
 open source implementation.
The github repository looks pretty open-source to me: https://github.com/tensorflow/tensorflow
Jan 12
parent reply krikru <kristoferkrus hotmail.com> writes:
On Tuesday, 12 January 2016 at 23:18:08 UTC, jmh530 wrote:
 The github repository looks pretty open-source to me: 
 https://github.com/tensorflow/tensorflow
Hm, maybe making D bindings to an already existing library wouldn't be such a bad idea. But how do one create such bindings? Anyone knows of any good resource, like a tutorial, explaining how to do it? Otherwise I thought it could be nice to create a new library in D, partly for myself to practice D programming and partly to bring more people into the D community and make it grow faster. But maybe that's naïve?
Jan 13
parent reply jmh530 <john.michael.hall gmail.com> writes:
On Wednesday, 13 January 2016 at 15:10:13 UTC, krikru wrote:
 Hm, maybe making D bindings to an already existing library 
 wouldn't be such a bad idea. But how do one create such 
 bindings? Anyone knows of any good resource, like a tutorial, 
 explaining how to do it?
It looks like TensorFlow is C++ with a Python front-end. The first thing I would try is using PyD to call the python TensorFlow library. There's work being done on calling C++ libraries from D, but I don't have any experience with it. I just read the Learning D book's section on C bindings. I found it advanced, but a good read. There are some tools that help transforming .h files to .d files (htod and dstep).
Jan 13
parent tsbockman <thomas.bockman gmail.com> writes:
On Wednesday, 13 January 2016 at 15:56:52 UTC, jmh530 wrote:
 On Wednesday, 13 January 2016 at 15:10:13 UTC, krikru wrote:
 Hm, maybe making D bindings to an already existing library 
 wouldn't be such a bad idea. But how do one create such 
 bindings? Anyone knows of any good resource, like a tutorial, 
 explaining how to do it?
It looks like TensorFlow is C++ with a Python front-end. The first thing I would try is using PyD to call the python TensorFlow library. There's work being done on calling C++ libraries from D, but I don't have any experience with it. I just read the Learning D book's section on C bindings. I found it advanced, but a good read. There are some tools that help transforming .h files to .d files (htod and dstep).
For anyone considering working on this, note that the C++ interface docs on dlang.org are very out-of-date at the moment. Check out this pull request if you want docs that are actually useful: https://github.com/D-Programming-Language/dlang.org/pull/1154
Jan 13
prev sibling parent krikru <kristoferkrus hotmail.com> writes:
I could perhaps help out in making this library. I was just 
looking for machine learning libraries for D, in particular for 
doing deep learning, but it doesn't seem like there are any since 
this thread came up at top when I search for it at Google. Or are 
there?

Also, if the library is going to support GPU acceleration, which 
it has if it is to be at least somewhat competitive, it would be 
great if it could use OpenCL to support non-NVIDIA graphics 
cards, since I only have an Intel graphics controller... In fact, 
it might even become the *only* deep leaning library that 
supports non-NVIDIA GPUs natively (by judging from this thread: 
https://community.amd.com/thread/170336), which would be really 
nice :)

Did you start any development on it?
Jan 12