
Have you participated in
Acceler8 2011 parallel programming
contest ? Then this post is about you.
Are you participating in the current
Accelerate-2012 contest? Then this post is for you.
Did you participate or are you just planning to participate in any competition for sports programming? Or are you going to start your first independent project? Then you, Stirlitz, I will ask to stay with us.
This post is a "debriefing" last year's Intel contest - Acceler8 2011, performed by one of the jury members. He commented on the key competitive points, and also gave banal and obvious, but still relevant tips on how to participate in such competitions and how to manage projects.
So,
go!
')
The first thing that the organizers have encountered is the sincere interest of the participants, live communication on blogs and forums. To be honest, the decisions of the participants, who “inherited a lot” in the forum, we considered with particular predilection. Each member of the jury had their favorites, but this had no effect on the final result of the competition, since the test machine had no preferences.
The challenge of the competition
Oh, what kind of unflattering epithets were the organizers of the competition heard about
the task at hand . By trial and error, it was reduced to a more or less acceptable form. But after receiving the first decisions, we realized how rich she was for various optimizations. The participants focused (expectedly) on the computation of “periodic” matrices and parallelization. But some contestants also made theoretical studies of the algorithm, optimizing memory allocation and storage of matrices, their filling, and ways to circumvent them. In the eyes of the competition jury, such an approach to solving the problem added at least +100 to the participant's karma.
Tip : There are many ways to write applications in the world, but
the northwest corner method is the most popular. This is when the cursor is placed in the upper left corner of the screen and the code starts to be printed. This is the wrong method. Never start implementing projects at once, start with research on paper, break the whole project into interface-function-modules. Perhaps you will come across difficulties and subtle moments at once, which will save you many man-hours later, before handing over the project.
Quality code
Here the organizers of the competition felt the truth of the popular Chinese saying “no matter what color the cat is if it catches mice.” What only ornate constructions and expressions were not in the code. The organizers remembered their youth when they wrote almost the same. I will give the TOP-5 "awkward" places in the projects:
5th place (tricky pointer initialization in the constructor):
m_memory_pointer((char*)this + 1024)
4th place (variable initialization):
static const int min_int = -2147483648;
3rd place : comparison of the structure with the pointer. How is this compiled under Linux at all?
2nd place : main.c file with 1900 lines. Guys, seriously, how do you navigate?
1 place (almost ten applicants): non-observance of an input-output format.
Sometimes the brain simply exploded, trying to understand what the participants meant. The lack of comments only aggravated the big picture (although I’m lying, in a couple of files the code was lost among the comments). But what is most striking is that sometimes these complex, unreadable constructions worked, worked correctly, worked faster than anyone.
The problem that developers may face if they write projects in this style is the support and maintenance of the code. Sometimes, projects last for years, and if at the time of the completion of the project, developers remember what they wrote, then after a month they may not understand. In our opinion, the main reason for the low quality of the code was the lack of time. And even after the organizers extended the time frame of the competition. I would venture to suggest that almost all the participants were sitting at their computers at the weekends before the end of the competition.
Tip : Break the entire project into small stages, and implement one stage every day: the overall infrastructure of the application — the main algorithm — the test — optimization of the main algorithm. Write the code as if for its beauty and readability will be passed to heaven or hell. I hope that everyone is aware that now it is considered to be a good idea for programmers to specify their external repository when it comes to writing resume programs? This is done so that a potential employer can become familiar with the skills of the job seeker. In reality, a beautiful and readable code opens the door as quickly as an unreadable code closes them.
Algorithm quality
I admit, my favorite in the last competition was the
KomsomolskDV team. It is felt that the guys have quite a rich experience of participation in such competitions. They approached the study of the algorithm so meticulously that they even calculated the theoretical time of the algorithm in cycles. If all participants had conducted similar studies, we would not have to run the application. It would be enough to compare the theoretical calculation times.
Also, some participants described in their accompanying documents the course of their thoughts, where they started, how their thought developed.
If we present the train of thought of the participants in the form of a schedule (hmm, I wonder if such a schedule is possible?), Almost all the participants thought up some basic improvements. With the growth of cunning and the complexity of some idea, the number of the coped participants plummeted.
If you look at the final
table with the results , you can see that the first five places vary greatly in performance from the others. Do you know why? Because these teams came up with slightly more non-trivial solutions than the other participants.
Tip : Conduct theoretical studies of the tasks of the competition on paper, draw diagrams and pictures. It is possible that you will find some subtleties or vulnerabilities of the algorithm that make its decision much faster, which will give you an advantage over other competitors.
In conclusion I want to say that the participants of the competition delivered a lot of fun minutes to the organizers.
Almost a tip : Treat programming as a serious game. On the one hand, everything should work, on the other - the development process should bring joy.
For example, why not leave a “message” in the comments to future generations?