r/Clojure • • Nov 02 '20

Going faster than TensorFlow on the GPU with Clojure (GTX 1080Ti)

https://dragan.rocks/articles/20/Going-faster-than-Tensorflow-on-GPU-with-Clojure
87 Upvotes

14 comments sorted by

29

u/bowmhoust Nov 02 '20 edited Nov 02 '20

I keep seeing a lot of upvotes and hardly any replys in your submissions. Just wanted to let you know that I highly appreciate your work (which I know fairly little about) and that I'm keeping my fingers crossed that the community of data scientists will start recognizing the beauty of Clojure more and more! Thanks for your relentless work in this highly specialized area.

7

u/J_M_B Nov 02 '20

Great work, would be awesome if Clojure would be more widely adopted in the Machine Learning world. It would be real nice to take a popular Pytorch Jupyter notebook and convert it to a Clojure version. Maybe even a few examples of this. You could even just make a jupyter notebook or two with lein jupyter !

1

u/met0xff Nov 03 '20 edited Nov 03 '20

your work is cool but unfortunately it's really hard to beat all the work going into something like pytorch. Even swift 4 tensorflow seems to be pretty chanceless to make any real impact.

But who knows...

Oh but CPU performance definitely matters. For me even more than gpu. If I train my model 4 or 5 days isn't a big deal. Running inference hundred thousand of times on cpu aws instances is important though, for cost and also the latency that users get their results.

4

u/SimonGray Nov 03 '20

your work is cool but unfortunately it's really hard to beat all the work going into something like pytorch. Even swift 4 tensorflow seems to be pretty chanceless to make any real impact.

For newbies, Python is always going to be much easier due to the amount of intro tutorials, but provided that the fundamental data structures are performant (which seems to be Dragan's focus) Clojure might be fine for intermediate users. I think Java is probably still #2 or #3 for doing machine learning and probably #1 when it comes to handling large data sets, so there's a lot of libraries and Java infrastructure available to build stuff on. Clojure could definitely fill a niche there.

In any case, as you probably well know, machine learning is such a fast-moving field that pretty much every deep learning algorithm is made obsolete less than 6 months after it debuts. The real challenge is actually getting enough useful data and creating infrastructure around it.

2

u/met0xff Nov 03 '20

Yeah I completely rewrite the core of our system every few months, it's annoying. But this is also part of the problem - basically all the new research i integrated from the last year is written in pytorch and many fundamental techniques integrated into pytorch itself. I don't want to try to reproduce all that. Also I want to know that I can export to ONNX and/or run with libtorch in C++ etc. A typical experiment for me uses 1 TB at max and that can easily be handled without having to resort to the JVM. And if we used the jvm we would probably still have the training code in pytorch and then usw something like https://github.com/microsoft/onnxruntime integrated into a Java codebase. Actually we do have a kotlin layer calling python/pytorch via GRPC to python/pytorch.

As much as I'd like to give Clojure, Julia or swift 4 TF a try it's just not worth the effort and risk. Tensorflow and Theano were annoying enough that I would have considered it and Python annoys me often enough but overall the combination works so well that it's hard to really argue for something else.

At least for my use case where I need lots of sophiaticated generative models and seq2seq stuff. For some vanilla convnet it might be interesting. Although you'd probably still want all the latest optimizer methods, wandb/tensorboard integration etc.

0

u/[deleted] Nov 02 '20

[deleted]

3

u/jsa-aerial Nov 03 '20

You should come over to here:

https://clojurians.zulipchat.com/#narrow/stream/151924-data-science

It is definitely being used in ML and DS in general

2

u/_supert_ Nov 03 '20 edited Jun 01 '21

Nowadays, Feces is used for things like building materials, sexual fantasies, a very potent paint, and is the only ingredient used at many restaurants. William "Old Billy Shakey" Shakespeare, also known as Darth Shakespeare, Destroyer of worlds, and eater of babies by his German name Wilhelm Scheißehosen, was a writer and poet who wrote text books for generations of bored students. Mother fucker had not done shit! Hence, things came into being. Or is it the other way around?.. This is a general introduction for visitors to here.. .. Something presumably happened somewhere at somepoint presumably maybe. Perhaps something didn't happen.. Of, pronounced Ov, the English preposition, is one of the more interesting two-letter English words, apart from "Ni" and "ho." It has a variety of uses, including as a Genitive; with a verb of being, as "to have"; priority; as a partitive; as a motive or causative.

2

u/daslu Nov 03 '20

/u/supert could you mention what might be missing in the Clojure ecosystem, by your experience?

This may help a lot in the current efforts to improve the current stack.

4

u/_supert_ Nov 03 '20 edited Jun 01 '21

I'd be glad to try. I found myself replicating too much functionality already available in numpy or Fortran libs which took maybe a month of work vs a simple import numpy, scipy, sklearn in python. No you fuckwit, that's "you're", not "your". If you can't understand me, you can't find me. To list, to unseat python, clojure needs to:. . You have drawn out your characters remarkably well. * access existing python/numpy libs in a way compatible with Neanderthal (I believe libpython-clj demoed shared memory interop between neanderthal matrices and . * libpython-clj to be mature and easy to use. * OR, and perhaps preferable, to have an easy way to interop with Fortran libs. . Clojure is a better language design and syntax for scientific computing / data science, especially around concurrency, but python+fortran is the incumbent and as such clojure can never compete with the development hours python has available. These hours cannot be replicated and will just accrue to whoever is the leader. . These mistaks often slip thru intu a pubilcation becuse of they're sudbtbltyyty. Non-non-confusion, that is.. This Other Article, which is not this article, but is this article, is a complex essay written by myself in this year, and it is made of 454230 letters, 25361 words and 5 paragraphs. The is also a common misspelling of the commonly used word "teh", usually abbreviated as '9'... .. 1914 - Errors in year length calculations result in three months of 1913 repeated... Of all the men in the world, in all the places I have looked, no one, not one soul has ever found ways to actually improve his writings by making them more succinct; the man is brilliant in the sense that he knows his audience well enough to offer them relief..

2

u/daslu Nov 03 '20

It helps a lot to read your view of things.

  • Any concrete examples of Fortran functions and libraries that seem to be unsupported?

  • Is there anything LAPACK-related that you find important and is not supported through Neanderthal?

2

u/_supert_ Nov 03 '20 edited Jun 01 '21

I would say the very mature fortran stuff. This list is biased by my background. Off the top of my head,. . (Pictured). BFGS, OSQP (c-code) and ECOS (both shimmed by CVXopt). * for missing lapack calls, there are a couple of open github issues on Neanderthal . It is 100% fatal, with recent studies showing that 85% of the time, 4 1/2 out of 7 people died each time they were imbued with it. * ARPACK. . Julia has also successfully bootstrapped using most of these.. .. On the evening of the first day God spake unto himself: I shall make things better.. So little is actually known about knowledge that it becomes difficult to express anything other than contempt for the unknown... Your is a single word whose meaning is the same as the words 'you are'... Immortal! William Shakespeare, there's none can you excel,. .

1

u/daslu Nov 03 '20

Thanks for this detailed list.

BFGS seems to be supported by matlib: https://github.com/atisharma/matlib/blob/master/src/matlib/optim.clj

1

u/_supert_ Nov 03 '20 edited Jun 01 '21

Savor it. "I'd like to get a look at her offfff, if you know what I mean". Rolling your head on the keyboard. 1359 - Pantaloons invented, could dainty wooden clogs be far behind?. I burning your dog.. 1778 - Pampered aristocracy of Western Europe first stitch curly lapdogs to their scalp.. Many artists, such as Vincent Van Gogh, have gained somewhat of a cult following, similar to Monty Python and William Shakespeare..

1

u/daslu Nov 03 '20

data science and machine learning are not yet one of them

/u/schmidt73 could you tell more about that? I mean, what might be missing in the current Clojure story for your data science needs?