Applying OpenMP directives

The Jacobi method is a usual method to solve partial equations in HPC situations such as pollution diffuses throughout a pipe applying the Laplace’s equation for diffusion.  A way to parallelise this solution when it is coded is by using the geometric decomposition with Epiphany.

From now, the serial version of the code has a runtime of 4256258 ns. We are going to use OpenMP directives to check how faster is going to be the runtime of the parallel version.

Since loops provided a chance to parallel the code, we are going to use the directive above the two loops with the option collapse (2) and declare all the variables involved as private or shared. The reduction also was set to use the value of bnorm outside the parallel region.There is another parallel region defined by loops to find the value of rnorm (where the reduction was applied). The default nonce will force the declaration of private and shared variables. Notice that there is no need to put brackets after the parallel for directives.The parallel for was also applied in the jacobi iteration. In this case, it was not necessary to use the firstprivate variable which takes the previous value before entering to the loop, it can change inside the loop, and have the same value after the loop as it was entered before.Due to the race condition of threads that are running in the program, there is a swapping zone that ought to be controlled by an OpenMP directive one by one. It is possible to achieve this with the single directive to block other threads job while one is executed.* The program was run with 16 threads (export OMP_NUM_THREADS=16) and different schedules were set such as schedule(static), schedule(static,4), schedule(dynamic), schedule(dynamic,4) with the respective runtimes. Finding the lowest runtime with the static schedule: 431520 ns.

The parallel version then turned to be 10 times faster than the serial version!

Posted in Education, τεχνολογια :: Technology | Tagged , , , , , , , , , | Leave a comment

Hybrid MPI-OpenMP

A myriad of applications are using the combination of OpenMP constructs and MPI library in order to improve their performance. You might start MPI with this great Website 🙂

Once you have a MPI program, you may include some code in order to make it hybrid:

  • Add the OpenMP header: #include <omp.h>
  • Declare request and provided variables in order to check the level of threads support.
  • Initialize the MPI environment properly, instead of int MPI_Init(&argc, &argv), use MPI_Init_thread(&argc, &argv, MPI_THREAD_FUNNELED, &provided); In this case, I choose the type Funneled but you may choose the style Master-only, Serialized, or Multiple. You can see further information about this here.
  • Define the parallel block with the directives pragma parallel omp including the default, firstprivate, private and/or shared variables as your program was set.

  • In your Makefile, set the FLAG= openmp or qopenmp (depends on your compiler).
  • Load the modules and run it as it is, a MPI program.

The performance was test as it is shown in the table having the best option with 36 processes and 1 thread using the Funneled type. Later, the style MPI_THREAD_SINGLE with 36 process and 1 thread was set, achieving 0.0532 achieving a speed of 0.9797 with this type.

*** Compared the Single style to the Funneled, this latter one was faster. ***

Posted in Education, τεχνολογια :: Technology | Tagged , , , , , , , | Leave a comment

Memories of #LinuxInEdinburgh

1. Prior to the event

1.1. Organization

It was about a month of preparation for running the event. Thanks to the support of classmates of the HPC master that accepted to share their knowledge using Linux with supercomputers and all their experiences in the scientific background acquired for years. 1.2. Helpers

Efforts were done to do some decoration work, as well as taking care of the technical part for the event (e.g. copying the ISO images, VirtualBox for macs / Windows, code snippets).

1.3. Publicity

It was needed to have the official authorization to post the advertising related to the event. Thanks to the Edinburgh University Students Association for the help with this.

2. During the event

2.1. Lunch 

Speakers and volunteers gathered together at noon to share lunch at Mosque Kitchen 😀
2.2. Talks

As had been planned, the event happened on February 27th, in Appleton Tower Lecture Theatre 4. I started by presenting two free software projects such as Fedora OS project and the Linux UI: GNOME. How Linux was born, the beginning of Fedora and GNOME were also explained, what is GUADEC, and the community of these projects. Then, we installed Fedora 29 in a virtual machine, later Jim Walker installed some applications that students usually used such as  Atom,  Spotify, and Latex.Python and C were the programming languages chosen for this Linux event. We had a last minute speaker from Red Hat Czech Republic, with only 19 years old Marcel Plch took his plane, came to do a great talk about Python on Fedora and he brought a lot of gifts 🙂Andreas Hadjigeorgiou from Cyprus was in charge of the C programming talk for around an hour. He started by explaining basic concepts like libraries and loops to more complex structures such as arrays, pointers, structs and containing functions.

2.3. Fedora and GNOME party

We shared for an hour a cake and coke. This was sponsored by Fedora and GNOME!

2.4. Picture frame 

These are some of the photos we took with the frame. I am glad that I was able to introduce both projects, Fedora and GNOME, that were not well known for some people. 

3. After the event

3.1. Thoughts 

Attendees were able to express their feelings about this event. We are going to take them into consideration to improve upcoming events.  It was great to meet new amazing people.My motivation for doing this event was to retribute what Linux did for me in my personal and professional life. Acknowledge the work of Richard Stallman with his ideology of sharing the code for the benefit of everyone, as well as the Linus Torvalds thought: “Linux succeeded thanks to selfishness and trust”. Special thanks to Fedora and GNOME for sponsoring this part.

3.2. Networking

I would like to thank again to Marcel to travel to Edinburgh, the effort and time he did, were productive to inspire others with his talk! Also thanks to the speakers and volunteers like Andreas, Holly, Jim, Alexey, Javiera, Ana, Ruwaida and Jasmin for the effort and time.I would also like to thank to Alberto Fanjul, I hope we can manage better time and efforts for running an event in Edinburgh. To Leyla Marcelo for the design of the poster, and Alexey Riepenhausen for the videos and professional photos! Thanks to the University of Edinburgh, Fedora, and GNOME for supporting this event.


Posted in Events, FEDORA, GNOME, GNU/Linux/Open Source, τεχνολογια :: Technology | Tagged , , , , , , , , | Leave a comment

My 2018 in Review: Making headlines year

The internationalization of my career was a spotlight in 2008 starting in the U.S.A. with an internship at ORNL in February 2018 and then in U.K. with a Master in HPC (High- Performance Computing) on September 2018. Some online articles can be found chronologically with my active participation and efforts done during the year 2018.

1. Organizing an HPC event

Usually, July is the month in where many interns go to ORNL to have real-world experiences in their fields. Some of them are students from schools, colleges, and universities and I had enough time to interact with most of them and to realize that some of them need more preparation in topics related to HPC such as Linux commands, HPC concepts, Programming, and Deep Learning. This is the web configured to do it:

After the successful event, a note was published in the Sci Ed Programs Summer 2018 Newsletter, Issue 11. I was so happy to help in training students from many countries. 

2. ORNL Photo Story Contest

It was announced a contest of photography about posting photographies related to the internship of students and my picture was published in the Sci Ed Programs Summer 2018 Newsletter. In this magazine, local events in Knoxville and useful ORNL tips were pointed.

Sci Ed Programs Summer 2018 Newsletter, Issue 13 announced the winner of the contest and surprisingly my group got the second place in a picture we took at Smoky Mountain.

3. ORNL 75 years 

The official video was publicly released and 0:33  captured the work I did as a volunteer in the core day of the 75 years of the creation of the Oak Ridge National Laboratory in TN.

4. OLCF 

Five OLCF students of 26 were selected to share their experiences and accomplishments during the internship period. I am so happy with the recognition received for my work.


I decided to prepare myself further in HPC(High-Performance Computing) and I applied to the school of Informatics in Edinburgh where they have a Master in High Performance Computing. I traveled to Scotland to learn from the world-class staff of EPCC that have more than 20 years of experience in teaching parallel programming worldwide.


On December it was published my profile after the internship done in ORNL where they highlighted the passion at work I demonstrated while interacted with leadership-class computing systems for open science in the CADES area with an OpenShift project., my participation was printed to inspire other students to be involved in STEM:

Posted in Education, FEDORA, GNOME, GNU/Linux/Open Source, τεχνολογια :: Technology | Tagged , , , , , , , , , , , , , , | Leave a comment

Jesień Linuksowa 2018

Last weekend I participated in the conference Jesień Linuksowa 2018 in Ustroń which is located in Poland near the Czech and Slovak borders. It was my first time in a country with so much tragic historical experiences.

On the other hand, I was impressed by the community members and the organization of the event. We celebrated another edition of Linux Autumn in the hotel Gwarek and my post-event wrap up will take into consideration seven basic points:


This time I was accompanied by my friend Ana Garcia, who is a student at the University of Edinburgh and the members of the organization were supportive and kind all the time with us. We felt a warm environment since we arrive at midnight in the middle of the fog. They helped us with our talks and workshops we offer related to parallelization.

We meet new Linux friends: Dominik, Rafal, Filip, Mateusz Kita, and Matej from Red Hat.Topics

Interesting topics were presented that included Ansible, catching bugs, packaging to Fedora and the innovations of systemd. Here pictured Marcin, Matej, and Zbigniew talks:

My participation

I did a topic related to introduction to parallel computers and a workshop to use parallel directives in OpenMP such as static, dynamic and guided. Thanks to Ana for being my co-speaker this time. My talk was set to the morning around 10 am, and we did the workshop after lunch and we are glad that all the participants completed successfully the experience.

Fedora 29 party

We celebrated with a delicious Fedora 29 cake! What are the new features in Fedora 29 were explained, as well as how to create a FAS account and the system badges. I am glad that Fedora Ambassadors from Peru and Poland, as well as Matej from Red Hat Brno met.Food

The organization arranged comfort food more than three times a day, we had extra cookies and water between main menus, plus the cake of course! We tasted delicious Poland food!

Special Thanks

To Filip Kłębczyk not only for being the general organizer but also for giving me one of the best gifts ever! and to Rafał Lużyński for the invitation and the tour around the city.

The uniqueness 

Retro gaming area was a geeky-genius-fantastic-idea 🙂 There was a unique collection of games from the 80’s and we were able to have an entertainment with that treasure.

Posted in FEDORA, GNOME, τεχνολογια :: Technology | Tagged , , , , , , , , , | Leave a comment

Profile of the code on Cirrus

To see the profile on a code, we are going to work with gprof on Cirrus. Let’s use the percolate code: Include the flag -pg for Intel compiler in the Makefile to compile.
After compiling, we will see that gmon.out was created,  as well as its executable:To view the performance data, replace the gmon.out with the executable:

gprof ./percolate

Edit again the makefile with the flags -profile-fuctionts and -O3 as follows:

After recompiling and executing with the Intel profiling, two new files are going to be created *.xml and *.dump. To see the graphic output, run the executable *.sh: A graph will be displayed with the profile of the percolate code:To check the performance of loops, use can use the flag -profile-loops in the Makefile:


Each one used separately to produce this outputs:

Screen Shot 2018-11-02 at 11.43.22 AMScreen Shot 2018-11-02 at 11.51.00 AMScreen Shot 2018-11-02 at 11.52.14 AM

Posted in τεχνολογια :: Technology | Tagged , , , , , , | Leave a comment

Unit testing with xUnit practical

This is a lab of the UoE to utilizing xUnit framework to develop unit tests. The experience was inspired by the DNA sequences job. The class of the sequence as follows:

import sys
class Sequence:
    """ DNA sequence consisting of A, C, G, T sequences."""
    WEIGHTS = {'A': 131.2, 'C': 289.2, 'G': 329.2, 'T': 304.2} 
"""dict of str or unicode to float:nucleotide molecular weights"""

    def __init__(self, sequence=""):
     """Initialise Sequence with a string. The string must only
     contain letters in the set a,A,c,C,g,G,t,T.
     :param sequence: sequence
     :type sequence: str or unicode
    :raises AssertionError: if sequence contains an invalid letter
        assert Sequence.is_valid(sequence), \
            "Sequence should only contain A, C, G and T"
        self._nucleotides = sequence.upper()

Python code is in the Python directory.
src/ contains a Python implementation of Sequence.

To run the tests, and also generate an xUnit XML test report:

Checking the output of the XML test report:

These were the test cases in

import unittest
from sequence import Sequence
class SequenceTestCase(unittest.TestCase):
    def test_get_nucleotides(self):
        sequence_str = "GATTACCA"
        sequence = Sequence(sequence_str)
        self.assertEquals(sequence_str, sequence.nucleotides,
                  msg="Nucleotides returned were not those given")

    def test_get_weight(self):
        sequence = Sequence("G")
                            msg="Weight returned was unexpected")

    def test_calculate_weight(self):
        sequence = Sequence("G")
                             msg="Weight returned was unexpected")                            


Posted in τεχνολογια :: Technology | Tagged , , , , | Leave a comment