Category Archives: Linux

How to Build and Install The Latest TensorFlow without CUDA GPU and with Optimized CPU Performance on Ubuntu

In this post, we are about to accomplish something less common: building and installing TensorFlow with CPU support-only on Ubuntu server / desktop / laptop. We are targeting machines with older CPU, as for example those without Advanced Vector Extensions (AVX) support. This kind of setup can be a choice when we are not using TensorFlow to build a new AI model but instead only for obtaining the prediction (inference) served by a trained AI model. Compared with model training, the model inference is less computational intensive. Hence, instead of performing the computation using GPU acceleration, the task can be simply handled by CPU.

tl;dr The WHL file from TensorFlow CPU build is available for download from this Github repository.

Since we will build TensorFlow with CPU support only, the physical server will not need to be equipped with additional graphics card(s) to be mounted on the PCI slot(s). This is different with the case when we build TensorFlow with GPU support. For such case, we need to have at least one external (non built-in) graphics card that supports CUDA. Naturally, running TensorFlow with CPU pertains to be an economical approach to deep learning. Then how about the performance? Some benchmark results have shown that GPU performs better than CPU when performing deep learning tasks, especially for model training. However, this does not mean that TensorFlow CPU cannot be a feasible option. With proper CPU optimization, TensorFlow can exhibit improved performance that is comparable to its GPU counterpart. When cost is a more serious issue, let’s say we can only do the model training and inference in the cloud, leaning towards TensorFlow CPU can be a decision that also makes more sense from financial standpoint. Continue reading

Installing CUDA Toolkit 9.2 on Ubuntu 16.04: Fresh Install, Install by Removing Older Version, Install and Retain Old Version

In the previous post, we’ve proceeded with CUDA 9.1 installation on Ubuntu 16.04 LTS. As with other software that evolves, NVIDIA released CUDA 9.2 back in May. It is also safe to assume that CUDA 9.2 will not be final version. Newer version will may come soon or later and here we are left with the bogging question: “How can we upgrade safely without clobbering the currently working system?” Moreover, we may also wonder if there is a mechanism to rollback the change and live with current setup while recognizing that it’s not yet the time to upgrade.

This post will cover three scenarios of CUDA 9.2 installation: 1) fresh installation, 2) install to upgrade by removing old version, 3) install to upgrade and keep multiple versions. Continue reading

Command Cheatsheet: Checking Versions of Installed Software / Libraries / Tools for Deep Learning on Ubuntu 16.04

In the previous posts, we’ve walked through the installations and configurations for various components and libraries required for doing deep learning / artificial intelligence on a Ubuntu 16.04 box. The next step is to be productive, crunching codes and solving problems by applying various algorithms. At this stage, visits to StackOverflow, Github or other similar sites become more frequent. And here is when the problem may arise. Not all codes or snippets copied and pasted from such online references can immediately work. One of the reasons is that the code was indeed written for same software, library, or tool but at different version.

Interestingly, software components for machine learning present different way to obtain the versions. These variations can sometimes result in additional time spent to query “ubuntu get xyz version” on the search engine. This is okay for one component, but when the system becomes complex enough (for example machine learning meets big data for ETL), this can turn into a productivity killer due to unjustifiable time taken for navigating the search engine.

Why not build a list for that?

This post summarizes the shell commands used for obtaining the versions of machine learning-related software and libraries. Commands are embodied in categories that reflect the logical / functional unit the software component belongs to. Continue reading

ReactJS: Changing Default Port 3000 in create-react-app

Last update: January 15, 2022

If you are doing frontend development nowadays, you may have heard about ReactJS or may be actively using it in your projects. Introduced to the public five years ago, React has transformed into a library of choice for a lot of frontend developers that is easily certified by the enormous stars at its Github page (more than 100,000 stars). React was relicensed into MIT license almost a year ago, which only catapulted its popularity into a new high. The MIT license is a more commercial friendly license compared to the BSD + patents license that was previously used by React.

Creating a frontend project is easy with the help of scaffolding tools and boilerplates. Among the available choices is create-react-app, a React bootstrapping utility that takes care the laborious tasks of setting up a React project without much intervention about how the project should be structured. Given this nature, create-react-app is less assumed a boilerplate and more of a toolkit. Continue reading

How to Install Jupyter Notebook as Service for Tensor Flow and Deep Learning on Ubuntu 16.04

When developing a deep-learning system, especially during the modeling stage, a lot of trials and errors can be involved in evolving the codebase. The easy remedy to reduce errors will be by using a robust IDE that provides productivity-boosting features such as code completion, method definition, codestyle suggestion, advanced debugging, user-friendly UI, and so forth.

Another element for better development experience is interactivity. Instead of writing the whole source code and evaluate everything, it is arguably more productive to write the code in small steps, with one line as the smallest unit, and evaluate the code up to the last line written. This kind of mechanism is possible for scripting language where the codes are interpreted. Node JS for example has a feature named Read-Eval-Print Loop (REPL) that enables someone to write Javascript code with Node JS and has it evaluated on the go. Deep learning algorithms and systems are often developed in Python, another interpreted language. Similar initiative also exists for Python in the forms of interactive shell and “notebook”. A notebook is an interactive environment, normally with web GUI support, where someone can combine code execution, text, rich media, charting and other types of data visualization. A popular notebook for Python is Jupyter Notebook, which was formerly known as IPython Notebook.

In this article, we will go into more details about Jupyter Notebook installation and configuration on Ubuntu 16.04. However, it’s important to note that the configuration depends on some pre-requisites. This article is the continuation of the previous article about TensorFlow installation. Please make sure you have read the article to understand the pre-requisites, otherwise some steps explained in this article may not work. Continue reading