Thursday, August 28, 2014

Painful Process

This summer, I embarked upon an ambitious project of pulling an old program out of its tomb, updating it and using it for something it was never meant to be used for. And thus was born the C++ version of the EICM, a landmark effort that will certainly find pride of place in my Masters thesis. More importantly, the program will be my stepping stone for another paper or two and possibly for the larger aims of the research project.

When I first saw the legacy code in FORTRAN, I had no clue about programming in that language. I had to take a crash course on its syntax, although I could logically follow it given my knowledge of C++. Nonetheless, a 7000-line program is no mean challenge and I admit that I did put if off for a few months, focusing my energies elsewhere. But when it became apparent that there could be no forward movement without it, I finally took up the challenge in the summer. Initially, I had hoped that it would finish in the summer itself and indeed, it did seem possible in the beginning, with rapid progress having been made.

But around the middle of June, it became apparent that this code was not going to be so easy. With a lot of support from my adviser and a series of meetings with people who were part of the original foundation of the program, I finally managed to pass through a major barrier, a set of three functions - FCOMB, FPRESO and FFINSO that made absolutely no sense. The day I got through those with my own set of functions - fmult and fgauss - was a landmark day in the development of the new code.

And yet, it did not end. Even after the code was ready, substituting archaic syntax and structure with modern ones and removing unnecessary parts of the code, there were many bugs in it. It took me weeks of delving into the inner working of the program, following the flow of logic in figuring out just why errors kept blowing up, leading to large, indeterminate numbers in the output. At one point, I was extraordinarily frustrated, worried that there was a problem in the logic itself, despite having verified it months back from the theoretical model. Amazingly, the final bug was found not in the same place I had started it, my office in Newmark, but far away in the ATREL Classroom while I was waiting for my safety training to start!

The EICM_CPP is to date the most elaborate program I have ever written, running into 2000 lines, well-commented with a multitude of subroutines and analyzing millions of pieces of data in a matter of minutes. While I do have the highest respect for FORTRAN and its enviable speed, I do believe that's its time researchers took to the challenge of updating legacy code into newer, modern languages. With my small part, I'm glad to have added to the body of knowledge. It was long, painful and at one point of time seemed hopeless, with the greatest fear that it would run into the entire Fall semester. But in the end, like all research, I hope, it came out well. 

1 comment:

Anonymous said...

I can almost imagine you spending hours at the office, staring into your laptop (or otherwise) with that specific purpose - Man on a Mission! haha....Reminds me a lot of my days at R during 2-4th year. I knew exactly what I wanted, and how to get it! Just like you. Tedious, it may be, but I was game for it. And it paid off. It usually does, isn't it? ;->

(yaar, ye verification wagera disable karo.....what a pain, da!)