GSoC 2020 project idea 8: Improving Brian's parallelization capabilities (OpenMP)

Brian can parallelize simulations over multiple processor cores by making use of the OpenMP framework. However, in its current state Brian does not yet make full use of the parallelization potential. In addition, there are some corner cases where activating parallelization can lead to incorrect results (this is why OpenMP support is still marked as “experimental”).

The aim of this project is to finalize the OpenMP support, by:

  • deciding whether parallelization can be safely used based on information about the respective code fragment (which variables are read/written in what way)

  • identifying and implementing additional opportunities for parallelization

  • extensive testing

  • Optional (“stretch goal”): transferring the OpenMP support to other code generation targets (Cython)

Skills: C++ and Python programming, experience with OpenMP or other parallelization techniques helpful

Mentors: Marcel Stimberg ( and Dan Goodman ( )

I am a final year student from BIT, Mesra. This project seems interesting and I would like to work on it. However, I only have theoritical knowledge about the subject in general. How should I develop the required skills and proceed forward in contributing to this project.

Hello Manish, I am tagging @mstimberg who is the mentor for this project, he will get in contact with you. /Malin, org admin

Hi Manish,
thank you for the interest in our project. There’s quite a lot of material out there teaching about OpenMP, e.g. this tutorial: Note that we are only using OpenMP in a very basic way (at least so far), e.g. only for multithreading (no offloading/use of other devices).

The other important thing would be to learn more about the Brian simulator. I’d recommend having a look at our papers ( and and at some point of course install it and run it (see the docs at For this project, the “standalone mode” is relevant, at some point it would be good to run an example with it, activate OpenMP ( and see what code the simulator generates. This is already quite a lot to look at, let me know if you need more suggestions or if anything is unclear! There’s still plenty of time to go more into details.


Yes, I am onto the docs. The basic use of openMP seems encouraging.

Hi, I’m currently taking a class on Parallel Computing and have some experience in using OpenMP for optimizing C++ code for fluid simulations and processing sparse matrices. I’d love to discuss some details and bounce off ideas for using OpenMP for the Brian simulator.

Hello Ayushwashere. I am tagging @mstimberg who is the mentor for this project. He will get in contact with you. Cheers

Hi @ayushwashere, sorry for the late reply, I was out of town for a few days. Thanks for your interest in the project, I am happy to discuss details either here or directly by email (

Hello everyone, I am Rahul Gupta. I am a final year student of Mathematics and Computing from IIT Guwahati, India. I am currently doing a course in parallel computing and have programming experience of shared memory using OpenMp. I found this problem really interesting and want to work in this.

Hi Rahul, thank you for interest in the project. Please see my earlier comment for some pointers where to start.

Dear students interested in this project. I just opened an issue on github ( that I invite all students to work on. The issue does not necessarily require advanced programming skills, what we are more interested in is that you show that: 1) you are able to navigate and (at least partially) understand the Brian2 code base so that you can implement and test a small feature for it, and 2) that you are at ease working with github and contributing via its pull request feature.

Note that this is of course a bit of an artificial situation, usually we wouldn’t have multiple developers working on the same feature in parallel (I wish having too many developers were a common problem :wink: ). This is not a race, do not worry about being the first to open a pull request, but maybe do not wait until the last day of the application period either. Since everything is done in the open you are of course free to look at the work the other students are doing, but please do things the way you think they should be done, regardless of whether others are taking a different approach. Also of course feel free to ask questions in the pull request and/or in the issue if you are unsure about something.

Please refer to the pull request you open as part of your GSoC application (I will give some more information about what we expect to see in that application later), we will not merge any of them before the end of the application period.

1 Like

@mstimberg @malin I’m going through the papers that are mentioned above but I am not able to understand it fully because of too many technical terms involved. Is the understanding of these papers necessary or else understanding only the code through documentation good enough to work in this project?

Hi @rahul_gupta. Are you referring to the papers about Brian? There are certainly a lot of things in these papers that are not necessary for the project. The basic starting point should be to generate C++ standalone code for one of the simpler examples (e.g. and look at the generated code to understand what each of the files is doing (at least roughly). I think some parts of the paper could be helpful for that, but code & documentation might be enough. You could also have a look at the section about Brian in the review paper about code generation ( which has a shorter more general overview over our approach.

@mstimberg yes I was referring to the paper about Brian. Thanks for the information. I’ll look into the links given above.

Dear students. As you all know, the application period for this year’s GSoC has started. I hope you are all doing well and are able to cope with the issues around the ongoing pandemic. Since GSoC is an online-only program it is obviously much less affected than other activities; at the moment no changes to the schedule (e.g. deadline extension) are planned. For some of you it might be difficult to get the necessary proof of enrolment from your university at a time of lockdowns and office closures. Google has updated their guidelines, hopefully you can find a solution that works for you. From the GSoC program lead: “We know some of you may need to get creative to show us forms and that’s okay. Submit what you have before the March 31 deadline and if there is a problem with the form you will be emailed the first week of April and can submit a different proof at that point.”

Regarding your applications for this specific project:

  • please include a link to any Brian contribution you made (e.g. to the Brian issue I linked earlier)
  • the most important thing about the application is not so much the detailed timeline (it’s always hard to plan these things in advance), but rather that you show that you understand the task and its potential problems. I have uploaded two examples that could be helpful in a discussion:
  1. A (contrived) example where Brian gives an incorrected result – this is the main reason why we are currently showing a warning when the user uses OpenMP.
  2. Three examples of toy networks with synaptic events. This is one of the “low-hanging fruits” to improve OpenMP performance. Try to understand where OpenMP parallelization is used and where it isn’t, and try to figure out why this is the case (of course, feel free to look into Brian’s source code). Do you see any room for improvement, and how would you improve things?

For all of these questions, we are not interested in actual solutions (this is what the summer is for). Rather, we’d like you to discuss the general approach and what a solution could look like. For example, you could include something like an “imagined” generated code snippet. I.e., try show the outcome of what your code should do in the end.

Hopefully this makes things a bit clearer, let me know if you have any further questions.