Automatic Full Compilation of Julia Programs and ML Models to Cloud TPUs

Julia Computing

Julia Computing
Visit: Julia Computing

Author: Keno Fischer and Elliot Saba

One of the fundamental changes that has enabled the steady progress of machine learning techniques over the past several years has been the availability of vast amounts of compute power to train and optimize machine learning models.


Google’s Cloud TPUs are a promising new hardware architecture for machine learning workloads. They have powered many of Google’s milestone machine learning achievements in recent years. Google has now made TPUs available for general use on their cloud platform and, as of very recently, has opened them up further to allow use by non-TensorFlow frontends. We describe a method and implementation for offloading suitable sections of Julia programs to TPUs via this new API and the Google XLA compiler. Our method is able to completely fuse the forward pass of a VGG19 model expressed as a Julia program into a single TPU executable to be offloaded to the device. Our method composes well with existing compiler-based automatic differentiation techniques on Julia code, and we are thus able to also automatically obtain the VGG19 backwards pass and similarly offload it to the TPU. Targeting TPUs using our compiler, we are able to evaluate the VGG19 forward pass on a batch of 100 images in 0.23s, which compares favorably to the 52.4s required for the original model on the CPU. Our implementation is less than 1000 lines of Julia, with no TPU specific changes made to the core Julia compiler or any other Julia packages.

Read the full paper here:

Automatic Full Compilation of Julia Programs and ML Models to Cloud TPUs

About Julia Computing

Julia is the fastest modern open-source language for data science, machine learning and scientific computing. Julia provides the functionality, ease-of-use and intuitive syntax of R, Python, Matlab, SAS or Stata combined with the speed, capacity and performance of C, C++ or Java. Julia also provides parallel and distributed computing capabilities out of the box, and unlimited scalability with minimal effort.

About the authors: Keno Fischer is Julia Computing co-founder and CTO, and Eliot Saba is the Senior Research Engineer. Keno Fischer can be contacted at <keno at>

Julia Computing provides products, training and consulting to make Julia easy to use, easy to deploy and easy to scale in your organization. Email us:

Disclosure: Interactive Brokers

Information posted on IBKR Traders’ Insight that is provided by third-parties and not by Interactive Brokers does NOT constitute a recommendation by Interactive Brokers that you should contract for the services of that third party. Third-party participants who contribute to IBKR Traders’ Insight are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.

This material is from Julia Computing and is being posted with permission from Julia Computing. The views expressed in this material are solely those of the author and/or Julia Computing and IBKR is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation to buy, sell or hold such security. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

In accordance with EU regulation: The statements in this document shall not be considered as an objective or independent explanation of the matters. Please note that this document (a) has not been prepared in accordance with legal requirements designed to promote the independence of investment research, and (b) is not subject to any prohibition on dealing ahead of the dissemination or publication of investment research.

Any trading symbols displayed are for illustrative purposes only and are not intended to portray recommendations.