2,940 karma · joined Oct 16, 2020 (6y ago) · 2,890 submissions
----------------------------------------------------
comment 5y ago · link · parent
Python's performance is sufficient when the bottleneck is actually the computation done in the accelerator. In my flavour of ML, we use small models, think 3 layer NN 64 neuron wide and in some cases a small CNN. During training, most of the models reported using <150MB.
Most of the community finds python sufficient because they do not need to interleave training and simulating.
> For ML purposes, if your model isn't running on the GPU, it doesn't matter if you're using Swift, Rust, or whatever, your stuff is gonna be slow. Like it or not, Python is one of the best glue languages out there, and the reason why libraries like TensorFlow and Torch are not used in their native languages (C++) [0] is because they're significantly simpler to use in Python and the performance overhead is usually one function call (e.g run_inference(...)) and not billions.
You don't know in what I am running/doing, hence your comment comes off as ignorant.
This is the setup:
Run X number of simulated steps on CPU, collect X samples, store them in a buffer of size either X, or Z>>X, train for Y number of steps sampling from buffer, copy model to CPU, repeat for total of 1M steps, repeat 10+ times to get a good average of the performance.
All of that without any hyper parameter tuning.
Now, you also need to note that a non trivial amount of work is also done in python to augment the inputs as necessary. If the work is done in numpy, there's usually little overhead, but, it is often the case that the environment I am simulating is wrapped in wrapper functions that modify the behavior, e.g. I may need to remember the last 4 instances created by the environment, and so on. All these modifications quickly accumulate and for a single experiment of 1M steps, you end up with billions of python calls. The community uses more or less the same package/framework as the intermediary between simulations and models.
The issue is so prominent, that the community as a whole moved away from running in single core the simulations, to having multiple parallel actors to collect transitions/data points, this also requires new theory. Furthermore, there have been many proposed architectures for distributed and asynchronous training because the bottleneck is not the GPU or the model, but rather, how fast you can collect transitions. Infact, there was a distributed architecture by google that literally sends the transitions over the network into a few GPUs, the reason is that the network cost is amortized because you get to run hundreds of simulations concurrently.
IIRC, a maintainer of a popular project/framework that I contribute saw improvements upwards of 2x when using C++ over python.
comment 5y ago · link · parent
I do not. Unfortunately, high performance and python do not go hand in hand. Yes, I know the heavy lifting is done by C/C++/Rust/Cuda/Blas/Numba and so on, but, when you run simulations for millions of steps, you end up with billions of python function calls.
Afaik only Jax actually performs any optimizations because it constructs an analytical gradient. Zygote seems to be able to that and more on the LLVM IR level which, I think should enable more optimizations.
2676.
High Speed Hashing for Integers and Strings (2015)(arxiv.org ↗)
28 points · by PartiallyTyped · 5y ago · 13 comments
comment 5y ago · link · parent
We are not taught about the atrocities of our ancestors and how the Greece the 'mother of all cultures' was infact filled with traitors and slavery, especially Athens.
Our 'great' past is ,beat, almost literally into our heads. We named one of the worst warlords in history 'Great' and instead of talking about the slavery and death he brought, we call it 'liberation of the barbarians', with 'barbarians' meaning all who are not greeks (::winky face::).
When it came to the Romans, we were still the winners because conquered them with our culture.
The worst of all is that this becomes so ingrown, even in young people, that for many it becomes a corner-store of their identity; any critical discussion is met with attacks because it literally shakes the foundation of their world.
comment 5y ago · link · parent
Why is it that nearly every company that puts first the shareholders ends up pooping the bed? Because the shareholders don't know jack except what the other people in the 1% want.
comment 5y ago · link · parent
https://web.archive.org/web/20210211144406/https://blog.rust...
comment 5y ago · link · parent
comment 5y ago · link · parent
I have been burnt by this. As much as I like python's "expressiveness" so to speak, it is too slow for my needs; the ML community gravitated towards that because it is simple to implement and test large models because C++/C/Cuda are doing the lifting. However, in my flavour/field of ML, python is often the bottleneck because the sampling/simulations are glued with it and the need to sample 10s of millions of steps ends up with possibly billions of function calls in python.
comment 5y ago · link · parent
In other words:
x = "foo"
y = "foo"
x == y and x is y
Both strings point to the same exact memory. Hence, 'is' works.
But it isn't always true: x = "foo"
y = f"{x} "[:-1] # get everything but the space
x == y # True
y is x # Falsecomment 5y ago · link · parent
@numba.jit
def fib(n):
if n == 1 or n == 0:
return 1
return fib(n - 1) + fib(n - 2)
first run:498.46601486206055 ms.
second run:
89.19310569763184 ms.
For completeness, with njit:
@numba.njit
def fib(n):
if n == 1 or n == 0:
return 1
return fib(n - 1) + fib(n - 2)
first run:152.62889862060547 ms
second run:
86.35592460632324 ms