Debug

I had been avoiding the backend(LLVM) code of libRoadRunner for a while (Had a very superficial understanding) and I thought it was time to pull my socks up and go through the code. With the help of the Visual Studio Debugger, I went through layers of function calls and tried to map it to my current understanding of the project. The code was very complicated and the lack of full-fledged documentation caused a lot of troubles. I was to implement the data structure required to store arrays for which I had to use libSBML arrays package.

I started simple and assumed that I only had an array of global parameters. Digging through the code, I started making changes for including the arrayed parameter. First idea was to store it as various parameters with different IDs. With this approach I was successfully able to store the parameters, but there was a problem that I didn’t realise. The SBML document is unchanged and therefore the libSBML “model” data structure that is used throughout the backend is unchanged. This implied that I had to change all the functions where the id of the parameter was used. Not only that, this was just for the case of parameters. Array support has to be implemented for the whole document! The amount of code that has to be changed to implement array support would be immense (6+ years worth of code rewritten). This was infeasible for the amount of time left.

I thought of a second approach wherein I could write completely new code for supporting arrays but this would again require me to rewrite a lot of implemented function in a new way, again infeasible. The reason for these problems is because of the deep interrelations between different data structures in the current implementation of libRoadRunner.

The only feasible way that arrays can be implemented is by flattening the arrays in the original SBML file and then using this modified SBML which is free of arrays to simulate the model. This would lead to a large consumption of memory as is indicated by Leandro’s paper but a slightly faster runtime. Since libRoadRunner is focused on speed and due to general large availibilty of storage space, I believe that this method would be the most feasible way to implement array support. I would be speaking to the mentors about ths in today’s meeting and see what they have to say to the idea.

Updated:

Comments

Loading Google+ Comments ...