A Beginner’s Guide to High-Performance Computing in Python

Ever since the Python programming language was born, its core philosophy has always been to maximize the readability and simplicity of code. In fact, the reach for readability and simplicity is so deep within Python's root that, if you type import this in a Python console, it will recite a little poem:

    Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. The complex is better than complicated. The flat is better than nested. Sparse is better than dense. Readability counts...

Simple is better than complex. Readability counts. No doubt, Python has indeed been quite successful at achieving these goals: it is by far the most friendly language to learn, and an average Python program is often 5 to 10 times shorter than equivalent C++ code. Unfortunately, there is a catch: Python's simplicity comes at the cost of reduced performance. In fact, it is almost never surprising for a Python program to be 10 to 100 times slower than its C++ counterpart. It thus appears that there is a perpetual trade-off between speed and simplicity, and no programming language shall ever possess both.

But, don't you worry, all hope is not lost.

Taichi: Best of Both Worlds

The Taichi Programming Language is an attempt to extend the Python programming language with constructs that enable general-purpose, high-performance computing. It is seamlessly embedded in Python, yet can summon every ounce of computing power in a machine -- the multi-core CPU, and more importantly, the GPU.

We'll show an example program written using taichi. The program uses the GPU to run a real-time physical simulation of a piece of cloth falling onto a sphere and simultaneously renders the result.

Writing a real-time GPU physics simulator is rarely an easy task, but the Taichi source code behind this program is surprisingly simple. The remainder of this article will walk you through the entire implementation, so you can get a taste of the functionalities that taichi provides, and just how powerful and friendly they are.

Before we begin, take a guess of how many lines of code this program consists of. You will find the answer at the end of the article.

Algorithmic Overview

Our program will model the piece of cloth as a mass-spring system. More specifically, we will represent the piece of cloth as an N by N grid of point-masses, where adjacent points are linked by springs. The following image, provided by Matthew Fisher, illustrates this structure:

The motion of this mass-spring system is affected by 4 factors:
  • Gravity
  • Internal forces of the springs
  • Damping
  • Collision with the red ball in the middle
For the simplicity of this blog, we ignore the self-collisions of the cloth. Our program begins at the time t = 0. Then, at each step of the simulation, it advances time by a small constant dt. The program estimates what happens to the system in this small period of time by evaluating the effect of each of the 4 factors above, and updates the position and velocity of each mass point at the end of the timestep. The updated positions of mass points are then used to update the image rendered on the screen.

Getting Started

Although Taichi is a programming language in its own right, it exists in the form of a Python package and can be installed by simply running pip install taichi.

To start using Taichi in a python program, import it under the alias ti:

import taichi as ti

The performance of a Taichi program is maximized if your machine has a CUDA-enabled Nvidia GPU. If this is the case, add the following line of code after the import: ti.init(arch=ti.cuda)

If you don't have a CUDA GPU, Taichi can still interact with your GPU via other graphics APIs, such as ti.metal, ti.vulkan, and ti.opengl. However, Taichi's support for these APIs is not as complete as its CUDA support, so, for now, use the CPU backend: ti.init(arch=ti.cpu)And don't worry, Taichi is blazing fast even if it only runs on the CPU. Having initialized Taichi, we can start declaring the data structures used to describe the mass-spring cloth. We add the following lines of code:

Python
 
 
    N = 128
    x = ti.Vector.field(3, float, (N, N)) 
    v = ti.Vector.field(3, float, (N, N))


Node.js Vs. Python: Pros, Cons, and Use Cases

When choosing a programming language for the backend development, your choice determines how the product will operate, scale, and fulfill user demands.

One of the most common is the dilemma of Node.js vs. Python. The two options are hugely popular and have their pros and cons. We work with both and are here to compare their advantages and disadvantages and help you to decide which one is better for your project.

The Reports of Perl’s Death Have Been Greatly Exaggerated

Look, I get it. You don't like the Perl programming language or have otherwise disregarded it as "dead." (Or perhaps you haven't, in which case please check out my other blog posts!) It has weird noisy syntax, mixing regular expressions, sigils on variable names, various braces and brackets for data structures, and a menagerie of cryptic special variables. It's old: 34 years in December, with a history of (sometimes amateur) developers that have used and abused that syntax to ship code of questionable quality. Maybe you grudgingly accept its utility but think it should die gracefully, maintained only to run legacy applications.

But you know what? Perl's still going. It's had a steady cadence of yearly releases for the past decade, introducing new features and fencing in bad behavior while maintaining an admirable level of backward compatibility. Yes, there was a too-long adventure developing what started as Perl 6, but that language now has its own identity as Raku and even has facilities for mixing Perl with its native code or vice versa.

Choose a Technology Stack for Web Application Development

For developing a web application that is robust, performance-driven, and agile, you need to pick the right technology stack. Whether you need to develop an enterprise application or a web application for your customers, it has to be quick and interactive.

If you are searching for the best technology stack for web application development, then we have you covered. In this post, we will have a look at the vital technologies that you need to have for developing your bespoke application. First, let's begin with what exactly is a technology stack?

97 Things Every Java Programmer Should Know with Kevlin Henney [Podcast]

In 2020, Java celebrated its 25th anniversary. Despite being more than 2 and a half decades old, it still remains one of the most popular programming languages in the world, dominating enterprise application development.

In this episode, we’re joined by the co-author of the recently released “97 Things Every Java Programmer Should Know”. He shares with us his experience in collecting the various voices, advice, and even contradicting opinions that make up the book, its relevance in the “low-code, no-code space”, and why some programming languages, like Java, will never die.

Low Code and No-Code Considerations

Low-code and no-code development platforms have been the trending IT topic for some time now. Experts in this field speculate as to how they could change the future of the industry. Some publications predict the gradual decline of traditional IT, as low-code and no-code products continue to reshape the very approach to solutions development. But, before we get into a discussion on the future of low-code and no-code, let’s define what these terms actually mean.

What Is Low-Code/No-Code?

Low-code and no-code tools help scale and maximize software delivery. The grid below explains, defines, and differentiates low-code vs. no-code tools.

Top Automation Programming Languages of 2021

Introduction

In today’s highly competitive world, software development and automation play a significant role in creating robust software applications for businesses. Additionally, emerging technologies like artificial intelligence and blockchain have given a competitive edge to enterprises. For gaining maximum benefits out of automation testing, testers require hands-on experience in a minimum of one automation programming language. There are numerous programming languages available today, with new ones continuously emerging. No matter which phase you are in, whether starting with automation testing or being an experienced tester planning to learn a new programming language, deciding which language to choose is very critical.

Which Automation Programming Language Is the Best for Testing?

The following list is prepared after considering metrics like recent trends, language popularity, career prospects, open-source projects, and more. As per TIOBE Index 2021 and IEEE Spectrum Magazine, Java, C, and Python are the top three automation programming languages on the list. Following are some of the most preferred languages on the whole entire list.

Perl Can Do That Now!

Last week saw the release of Perl 5.34.0 (you can get it here), and with it comes a year's worth of new features, performance enhancements, bug fixes, and other improvements. It seems like a good time to highlight some of my favorite changes over the past decade and a half, especially for those with more dated knowledge of Perl. You can always click on the headers below for the full releases' perldelta pages.

Perl 5.10 (2007)

This was a big release, coming as it did over five years after the previous major 5.8 release. Not that Perl developers were idle—but it wouldn't be until version 5.14 that the language would adopt a steady yearly release cadence.

SKP’s Java/Java EE Gotchas: Clash of the Titans, C++ vs. Java!

As a Software Engineer, the mind is trained to seek optimizations in every aspect of development and ooze out every bit of available CPU Resource to deliver a performing application. This begins not only in designing the algorithm or coming out with efficient and robust architecture but right onto the choice of programming language. Most of us, as we spend years in our jobs — tend to be proficient in at least one of these.  
 
Recently, I spent some time checking on the Performance (not a very detailed study) of the various programming languages. One, by researching on the Internet; Two, by developing small programs and benchmarking. The legacy languages — be it ASM or C still rule in terms of performance. But these are definitely ruled out for enterprise applications due to the complexity in development, maintainability, need for object orientation, and interoperability. They still will win for mission-critical or real-time systems, which need performance over these parameters. There were languages I briefly read about, including other performance comparisons on the internet. These include Python, PHP, Perl, and Ruby. Considering all aspects and needs of current enterprise development, it is C++ and Java which outscore the other in terms of speed. According to other comparisons [Google for 'Performance of Programming Languages'] spread over the net, they clearly outshine others in all speed benchmarks. So much for my blog title :-) So when these titans are pit against each other in real-time, considering all aspects of memory and execution time — Java is floored. Though I have spent the last ~17 years (In 2021) of my life coding and perfecting my Java and J2EE skill — I suddenly feel... Ahem, Slow! One of the problem statements to verify this is given below (along with the associated code) and the associated execution parameters. 
 


[Disclaimer: Problem Statement given below is the property of www.codechef.com

In Byteland they have a very strange monetary system. Each Bytelandian gold coin has an integer number written on it. A coin n can be exchanged in a bank into three coins: n/2, n/3, and n/4. But these numbers are all rounded down (the banks have to make a profit). You can also sell Bytelandian coins for American dollars. The exchange rate is 1:1. But you can not buy Bytelandian coins. You have one gold coin. What is the maximum amount of American dollars you can get for it? Input The input will contain several test cases (not more than 10). Each test case is a single line with a number n, 0 <= n <= 1 000 000 000. It is the number written on your coin. 
 
JAVA SOLUTION (Will Be Uploaded Later)
C++ SOLUTION (Will Be Uploaded Later)
 
RESULTS

TIME

JavaScript vs Other Popular Languages of the 21st Century

The trends in the programming industry have changed so much in the past decade. One such evolution was seen in the web development industry. In the earlier days, web development originally just dealt with the development of web pages and websites for the intranet and internet. 

As time has passed, it has become more focused on creating complex and detailed web, mobile, and desktop applications. 

Fortran and the ”Old Guard” of Programming Languages

“You’re using Fortran? Seriously? Listen, 1982 called, and they want their leg warmers back.” - Every developer since 2008

Every once in a while, I run across someone who’s working with Fortran, or COBOL, or Ada, or (if I’m lucky) LISP. These are the old guard of programming languages, and with the exception of LISP*, that is not said with a lot of aspiration. For most developers, jobs that list “3+ years of Fortran” are laughed at (at best).

Top 11 Programming Languages for Blockchain Development

Blockchain technology is a very fast, secure, and decentralized technology that is currently causing a paradigm shift in many industries today. The development of this technology has brought about improvements in many industries even though it has many skeptics and is not a mainframe technology yet. To develop this technology, the following programming languages are used. 

C++ 

C++ is an old programming language developed during the 70s and 80s. It is a high speed, compiled, object-oriented, and strongly static programming language. This language is highly efficient. As stated in many professional writing services, it was created as a C language extension but is a more difficult language to learn and more complicated. So, it really is not for beginners. 

Top 6 New Programming Languages Born in the Last Decade

When it comes to programming languages, progress does not standstill. While the most influential ones like Python, C, Java were created a long time ago, new valuable coding languages appear all the time. In many use cases, it is the new programming language that is driving innovations and helps build truly amazing software. Let’s look at the most promising ones that were born in the last decade.

What Is Rust Programming Language?

Rust is a system programming language, created by Mozilla, which was announced in 2010. Rust is positioned as an incredibly fast language, that prevents memory violations and guarantees thread safety. Rust is syntactically similar to C ++ and in terms of speed, it can be compared to C or C ++. This means that the applications written in Rust can be just as fast as those written in C or C ++ and faster than those written in other dynamic languages. 

Top 6 Programming Languages for Mobile App Development

Mobile application development industry in the last five years has multiplied in leaps and bounds, changing the way businesses function worldwide. With enterprises aligning mobile apps to their productivity in recent times, and with the rapid innovation in mobile devices across platforms, it calls for mobile app developers to write several versions of an application for many different platforms using a single language and many pieces of reusable code. Are you game for that?

Once you intend to realize your mobile app idea, it's time to validate it, understand the target market, and narrow down the platform on which you ideally would like to build your mobile application. As soon as that is decided, it’s time to select a programming language, keeping in mind your business strategy to make either native, hybrid, or cross-platform apps.

Most Popular Programming Languages in 2020

With a forecast for 2018 and 2020. It was forecasted that 20 billion apps would be downloaded in 2020 in the UK.

According to the survey reports, the number of downloaded mobile applications is increasing constantly. In the contemporary era, now customers prefer mobile applications to get information about the service or product; however, mobile applications have turned as a success key to stay ahead in the market competition. The high usage of mobile applications has raised to the demand of the mobile application development service with the latest integrated trends such as blockchain and the Internet of things.

Selecting a Programming Language for Selenium Automation Testing

So many language to learn, so little time.

As people are shifting to automation from manual testing, they prefer to go with the best-suited testing framework for them. When we talk about a popular automation testing framework, most people immediately think about Selenium. Selenium is one of the most reliable, portable software testing frameworks for web applications. It comes with one test domain-specific programming language Selenese for writing automation scripts, but it also supports other programming languages like Java, Python, Ruby, Javascript, PHP, and C#, which makes it a good choice.

While moving to automation testing with Selenium, everyone who tests has to face a question: Which programming language should you use for writing test automation suits?