Matrix Multiplication Optimization

As the final lab assignment for our Concurrent Programming module, we were asked to optimize matrix multiplication. C++ was set as the language and Linux was set as the environment for this task. The tasks for this lab assignment were as follows:

  • Write a naive sequential program to perform matrix multiplication on a n x n matrix containing double precision values. The matrices were to be filled with random double values. Only the time taken for the actual multiplication part was to be recorded.
  • Identify a C++ library for Linux environment which supports parallel for loops and write a parallelized version of the above program.
  • Running the above 2 versions of matrix multiplication for matrix sizes of n = 100 to n = 1000 in increments of 100 and record the time taken for each of these executions.
  • We were then supposed to look in to ways to optimize matrix multiplication taking the processor architecture into account as well and come up with a 3rd version of the matrix multiplication making use of both parallel for loops and various optimization techniques.

The full source code of this project can be found here: https://github.com/pubudu91/mm-optimization

Naive Sequential Version

For this, the standard matrix multiplication algorithm was used. If the matrices are called A, B and C,

Continue reading

Advertisements

Clustering WSO2 Governance Registry 5.1.0

Introduction

Recently, I created a Governance Registry cluster on EC2 using Nginx as a load balancer. The cluster created was a 3 node cluster, fronted with Nginx. The initial plan was to create a cluster with 2 Nginx load balancers, one each for the Store components and the Publisher components, as given below.

greg-original

Originally proposed deployment pattern

As the first step in creating the cluster, I was advised to create a cluster (same deployment pattern as above) of just one G-Reg node. Although I successfully managed to deploy the cluster, there was a major issue in it. The scenario for the G-Reg cluster I was creating was that the artifacts would be deployed by the publishers and as such, the Publisher context should only be accessible by publishers (typically in a company). The artifacts would be consumed by users and they would access these artifacts through the Store. 

Now in the cluster I created, the issue was that  if a user signs in to the Store, he/she would also be able to access the Publisher and vice versa. This is problematic since only the publishers (i.e: the company) should be able to publish artifacts. This is because G-Reg has the Single Sign On (SSO) feature enabled by default. When SSO is used, a user signed into one system can access other, connected systems without the need to sign in again at those particular systems. More on SSO can be found here.

Continue reading

Creating a WSO2 Application Server cluster using AWS EC2 and Nginx as a load balancer

Introduction

The WSO2 Application server is used for hosting, deploying and managing applications, built on the WSO2 Carbon platform. A detailed documentation of the Application Server can be found here.

As is the case with other WSO2 products, multiple instances of the Application Server can be installed in a cluster. When in a cluster, the work is shared between the multiple instances although it appears as if though there is only a single instance of the Application Server (AS).

In this tutorial, we will be using AWS EC2 instances to create a AS cluster. The EC2 instances will be Ubuntu based. We’ll be creating a cluster of 3 AS nodes, using Nginx for load balancing and MySQL for storing the user management and registry data of the AS. More information on load balancing can be found here and here.

Continue reading

Sinhala in Windows 10

I am usually pretty skeptic about Microsoft’s upgrades to its Windows OS. I’ve been using Windows 7 in my laptop ever since I bought it about over a year back. Windows 8 nor 8.1 appeal to me at all! However, this time, with all the hype for Windows 10, I was curious to try it out.

After obtaining a copy few days back, I was still hesitant to install it, mainly because I didn’t wanna go through the pain of having to comb through the internet for drivers and workarounds for softwares I used to use on Windows 7 (the memories from the switch to Vista from XP was haunting me 😛 ).  After asking around a few who had already installed it, and after checking it on VMWare, I finally decided to give it a go.

The installation process was pretty smooth, though I expected it might be troublesome. I used a bootable USB to install a clean copy of Windows 10. For creating the bootable USB, I used the tool given by Microsoft for creating Windows 7 bootable USBs. I decided on this because my laptop is dual boot and when installing Ubuntu Gnome on it before, I ran in to trouble with UEFI vs. BIOS. The bootable Ubuntu USB given by my friend was a UEFI installer and it caused a boot-loader nightmare when installed along Windows 7 (which was BIOS based). So in order to avoid facing those problems again, I used the Windows USB/DVD Download Tool. It allowed me to create a BIOS based bootable Windows 10 USB.

Happily for me, the software I used on Windows 7 runs without problem in Windows 10 as well (well, at least so far! 😛 ). However there was a minor annoyance in Windows 10, in my short experience with the OS. It does not seem to support any other language pack, other than the pack you selected initially, when starting the installation. I found this out when trying to browse websites containing Sinhala text; the pages simply didn’t render the text. To fix this, go to the language settings of the control panel and download the Sinhala language pack. If you were already using any browsers etc. restart them to let the changes take effect.

language

Software Engineering Project (SEP): Introduction

In our 5th semester, we have a module called Software Engineering Project, in which we have to carry out a Software Engineering Project, individually. The purpose of this project is to put the knowledge we gained on Computer Science and Software Engineering in to practice. We could either select a project of our own or select from a list of ideas given to us. For my project, I selected a project given to us. It is a project of LIRNEasia, a regional organization which carries out various researches.

The project is to develop a web-based tool to visualizing propagation of information/disease in networks with the option to overlay such visualizations on a map. Such a tool will give valuable insights to researchers upon visual inspection of the data. There are actually 3 other projects related to this project, which in combination will give researchers and policy makers a valuable tool.

In my project, the aim is to provide a visualization overlaid on a map for researchers studying disease/information propagation through network-based models. When overlaid on a map, such models provide the ability to simulate scenarios and identify vulnerable regions etc.

There are several challenges to be addressed when going ahead with this project. First, the scalability. The tool should be able to handle large volumes of input data, without crashing the browser. Secondly the input file format is generic and not completely specified, which means the tool should be capable of handling input files with data formatted in various ways. Third problem is the extensibility of the tool. The tool needs to be designed in a way that it enables other developers to add features to it or build other components or services on top of it. At the moment, I haven’t really figured out how to tackle these problems. But I feel the right sort of modular architecture will sort out or at least make it easier to tackle these problems.

Using Apache Jena With Netbeans

So it is GSoC time and I came across an interesting project which deals with linked data. In order to apply for it, I had to get Jena, a Java library for handling RDF graphs. The documentation provides info on how to configure Eclipse to use it. But Eclipse is not really my choice for an IDE. I prefer Netbeans. So I wanted to configure Jena to be used in Netbeans. Most of the resources I looked up suggested using Maven. But I wasn’t interested in that. After a bit of tinkering around, I managed to get it configured as a library in Netbeans. It is quite easy actually.

Go to Tools -> Libraries and create a new library called Jena. In the classpath tab, go to ‘Add Jar/Folder’ and navigate to the path where you extracted Jena and go to the ‘lib’ folder. Select all the jar files in the ‘lib’ folder and add them. Then, optionally, you can add the Jena source files and Java docs as well. And that is it.

Screenshot 2015-03-25 02.35.57

To use Jena in a new project, right click the libraries directory in the created project on the ‘Projects’ tab and select ‘Add Library’ and select Jena.

First taste of real world software development

Few weeks back, our Database Systems lecturer, Dr. Shehan, asked for a couple of volunteers to work on developing a volunteer management system. Me being the adventurous programming enthusiast that I am, volunteered at once. Along with me, Yasiru, Amitha, Dinusha, Kasun, Riyafa, Chathura and Lasantha also volunteered. The project was actually a project done by a student of the senior batch (Ridwan) as a part of his Software Engineering course module in the 5th semester. He had wanted to move on from the project and therefore, is handing over the project to us.

The project is to implement a volunteer management system for the newly instated National Volunteering Secretariat (NVS). This is an initiative of the Ministry of Social Services and the United Nations Volunteers (UNV). UNV is handling the project on behalf of the NVS and we had our first meeting with the UNV project team last Monday. This was our first proper meeting with a client and I must say, it was may more interesting than they make it sound in lectures on requirements gathering 😛

The meeting was mainly to introduce us Continue reading