Life-time learner's blog

Tag Archives: C

[MPI] Solving the advection equation in parallel

In chemistry, engineering and earth sciences, advection is a transport mechanism of a substance or conserved property by a fluid due to the fluid’s bulk motion.

Mathematics describes the process of advection with the advection equation:

\frac{\partial\psi}{\partial t}+\nabla\cdot\left(\psi{\bold u}\right)=0

In my course on Parallel programming, I had to implement a solution to a particular advection equation, with  the initial and boundary conditions defined. Read more of this post

MPI: Calculating sum 1/n! in parallel

I’ve spend several hours to understand how to programme in MPI and how to calculate the sum of 1/n! in parallel (it’s my task from university). (By the way, why do I have study this shit? I don’t think I will be working in the field of parallel/distributed computing.)

But finally I wrote a decent programme, which showed not bad results. And I am very excited to share with you! Read more of this post

[For fun] China++ xD

[For fun] China++ xD

Dynamic memory management in China++
It is pretty awesome!
More at:

How to install MPI in Ubuntu

I am starting a series of articles devoted to distributed computing that we are now studying at MIPT. For programming we will use MPI.

Message Passing Interface (MPI) is a standardized and portable message-passing system designed by a group of researchers from academia and industry to function on a wide variety of parallel computers. The standard defines the syntax and semantics of a core of library routines useful to a wide range of users writing portable message-passing programs. We can use it for creating programmes for distributed computing systems (parallel computing).

MPI is a standard. There are different implementations of MPI for different platforms and programming languages. This article is about how to install MPI platform to your Ubuntu.

Read more of this post

[Unix C] ID implementation


Last time I posted my implementation of linux command echo. Now I’d like to introduce my implementation of id (which was another task from my IT teacher). This unix-shell command is rather simple and its task is to print real and effective user and group IDs.

Firstly, let’s see how to obtain current user’s ID and group ID. Take a look at the folowing code:

#include <stdio.h>
#include <unistd.h>

int uid, gid;

int main(){
    uid = getuid();
    gid = getgid();
    printf("UID: %d; GID: %d\n", uid, gid);
    return 0;

But functionality of ID command in Linux is way more complex! It took me almost 3 hours to implement all it’s features. Read more of this post

[Unix C] ECHO Implementation

When I was at my 2nd year, we studied architecture of operating systems. Our IT seminars were devoted to writing C applications for Linux. The first programme that we had to write was a simple terminal command “echo”. I’ve spend 2 hours to do it! Read more of this post