Opt-Studio (mini PyTorch) - Shell, Plotter, BLAS in C++


About final project at King Abdullah University of Science and Technology for the course CS 380 GPU and GPGPU Programming, 2020, Fall.

Links:

Motivation

Optimization methods have a long history, and in some way, they have formed a field of Applied Mathematics. The motivation was to assist researchers in creating new algorithms which may be nearer to the hardware metal and decrease the lag time once algorithms come into products, typically written in C++. This project is a small step to providing needed infrastructure in the C++ language.

Computation

We live in an era when computation assists in developing different fields. People create specific general-purpose or DSL languages like Matlab, R, and Python.

What is circular is that all programming languages infrastructure for Matlab, R, Python, Java, and C# is developed in C++. In some sense, these are only an extra level of abstraction. I think it’s time to forget to some extent about Matlab, R, and Python as not necessary levels.

We can think about Matlab as a domain-specific language for Mathematic. But in 21 century, each area of Mathematics is so developed that it requires separate treatment at a fundamental level with computation support. B.Stroustroup put into C++ language in 1994 the following deep principles:


a. No implicit violation of static type-system. Work with user types so effectively as with built-in things. b. What you don’t use - you should not pay for. c. If something is built-in in the language, then it’s impossible to write it better by hand


Unfortunately, C++ is a pretty low-level language.

Components

Shell

The project has an interactive shell like a Python interpreter (or BASH, or R) which allow manipulation with variables and expressions. The shell will enable one to look into available variables (vectors, matrices, scalars) and print them (similar to Matlab, R studio), differentiating numerically algebraic expressions.

Formulas plotter

Visualizing expressions (formulas) that represent explicit functions in the form of Y=F(X), where F is constructed with the available algebraic expressions, is possible.

Graph plotter

An extra plotter tool allows obtaining information from the shell remotely via TCP/IP. It’s located in a separate repository: https://github.com/burlachenkok/plotter_plusplus. In Framework, there is a need for abstraction to send data over TCP/IP network.

Framework

The internal infrastructure of the project allows working with filesystem, network, regular expression, serializing into the filesystem, and the various day-to-day thing which is primarily absent by design in C++.

Credits and references

Original author: Konstantin Burlachenko. Email: konstantin.burlachenko@kaust.edu.sa


Written on July 30, 2021