J-Gravity: Using An Algorithm to Test Revolutionary Theory on Dark Matter

Fascinated by Jean-Pierre Petit’s revolutionary theory on dark matter, Kwame Yamgnane, 42’s co-founder and managing director, challenged the students of 42 to design an algorithm to put the theory to test. Seven brave students rose to the challenge and gathered as a team to create a distributed simulation that would handle a hundred million particles.

One of the main tasks for the team was to break through a large number of dense and complex research papers to understand how the new theory is implemented in the core algorithm. Another task involved elaborating on the architecture of the dispatcher program to distribute a copious amount of data to 1024 computers at 42. This proved to be one of the major challenges of the project, as the team had to explore the concept of multithreading in order to ensure that the data was spread properly to the large number of processors and to synchronize threads. In doing so, they encountered other difficulties such as needing to find other options for debugging as their usual tools were deemed unfit for dealing with such high level of complexity.

After six weeks of hard work, the students’ efforts came to fruition when their program crossed 100,000,000 particles. Encouraged by the unprecedented scope of their work, the students intend to take this project further. They hope to improve the legibility of their code and add other user-enhancements to their program. The students are also eager to utilize the new and impressive hardware that the school managers have provided.

dark-matter dark-matter dark-matter

As demonstrated by the success of this project, students of 42 are highly capable individuals who, given time and motivation, can rise to any challenge. While these seven students started without any prior experience or knowledge of high performance computing and complex networking, they were able to learn and adapt throughout this process. The team’s next objective is to perfect this physics simulation and build a more generic program that is able to take on a whole variety of problems: from machine learning to searching for the next biggest prime number!

Interview with Team Members Phil and Can


Name: Phil McLaughlin

Hometown: Boston, Massachusetts

Interests: High performance computing and GPU accelerate computing, complex networking infrastructure

“People here can do literally anything given the time and motivation”


Name: Can Yildirim

Hometown: Bay area

Interests: Simulation in all types: rendering or physics, complex networking infrastructure and architecture

“I learned a lot more from this project in terms of learning the concepts and improving my coding style”

What is the purpose of your project?

CAN: The purpose of our project is to create a distributed simulation where we simulate a very large number of particles that can only be done in a distributed manner. It would be very difficult and would take significantly longer to do it in a undistributed fashion.

PHIL: And it is worthy also mentioning that we were trying to be able to test new physics, new ideas, particularly this one French physicist, Jean-Pierre Petit, and his alternative model of explaining dark matter.

How did you get the idea for the project?

PHIL: It was really Kwame’s idea. He knows this French physicist and has always been interested in exploring the idea in detail. He had proposed the project to us in a very broad manner that gave us the freedom of design.

How many are there in your team?

CAN: We have seven core contributors, but the whole team is a dozen people. When the project is as big as this one and none of us have had any management experience, dividing up the work wasn’t an easy task. We did the best we could with our knowledge and, as a team, we managed to build something pretty cool in the end.

Describe the work you did for the project.

PHIL: The work I did was implementing the core algorithm. I did a lot of research and tried to understand how other people do large scale physics simulations. And basically if I can understand it, I implemented it and, if not, I came up with a simpler way of doing it. And I also did all the code that actually runs on the graphics processors. So I had to learn OpenCL.

CAN: I worked on the architecture for the dispatcher program, and a lot of the networking and multithreading that went along with managing all the various workers, just making sure that data got moved around properly. And I learned a lot about a number of topics that I had wanted to explore but just never go around to. One of them was multithreading and then all the signaling that goes along with multithreading. And also networking, just building simple network message protocols to send messages between all our computers.

PHIL: I think that is the headline of the project for you and me: we both had all of these subjects that we wanted to learn about but we hadn’t had a good prompt to. So this project was a great prompt for us to learn more stuff.

What was the most difficult part?

PHIL: Before doing this project I had never read an OpenCL — a large portion of work I did for this project was in that language. So that was probably the main challenge. Also, just learning to look through long dense research papers and finding the core element that I needed to extract.

CAN: Maybe the most difficult part was understanding all the signaling that goes along with multithreading. Just figuring out how they synchronize threats.

PHIL: And debugging a complex multithread flow has been a challenge.

CAN: When you have so many different threads running at the same time, trying to figure out what output is coming from what thread. And trying to figure out where the issue is — because it would be in a number of places because a lot of stuff is happening at the same time. So that has definitely been the most challenging.

PHIL: And when a program reaches a sufficient level of complexity, a lot of our tools that we have learned to use for debugging break down, like lldb and valgrind don’t really play nice with our code anymore. So we had to come up with ways to do our own debugging.

What do you enjoy most about your project ?

PHIL : Like I said, this is stuff that I have always wanted to learn and I finally had a good opportunity to do so I definitely enjoyed that. But also here at 42, we do a lot of cool projects, we write rather cool stuff but, at the end of the day, what we have to show is really small despite being well-made. So, I enjoyed the scope of this. Especially the night before the Job Fair, when we finally crossed 100,000,000 particles, it was like, “Wow, it really does it!” That sense of achievement was really the main reward here I think.

CAN: I don’t know… There are really a lot of things I enjoyed about this project. One, I have always wanted to build really low level stuff and two, I also like working on a very large-scale project: a big project with a lot of team members. That was really cool — just being able to work on a big project and deal with some of the difficulties that came along.

PHIL: I mean, there were frustrations here and there, obviously, but this has been a blast. It has been fantastic.

CAN: I feel like I learned a lot more from this project in terms of learning the concepts and also improving my coding style. I feel like this project has changing my coding style a lot more than any of the smaller projects that I have done in the past. Particularly, because it’s a team environment where everyone has to write on the same code. So there is some form of review and discussion that goes on in terms of coding style.

What kind of support did you receive from 42 ?

CAN: We had some help from the staff, like Hanu. He wrote the script to launch copy of binaries into a lot of computers and run them. There had been so many late nights with him working on the script and us bugging him to reset it.

PHIL: Because before that, we were manually logging in to dozens of computers and starting the program on each of them. But now we basically only have to press a button. Kwame also has some connections with AMD and was able to get us some really amazing hardware. Unfortunately, we have not really had a chance to use it that much yet. But the ongoing improvement of this project is going to depend a lot on that.

What did you learn from this project ?

CAM: I learned a lot about working on a large scale project with a lot of members. Just working in a team, improving my coding style, and then learning a lot of new useful techniques and concepts.

PHIL: Besides some specific topics that I have learned a lot about, I also learned that, honestly, the people here can do literally anything given the time and motivation. Neither of us had done any of the stuff that we did for this project before starting it. And I think we not only did it but we did it really well. Everyone who was a core contributor on the team learned tons of new material as they were working. This was not us showing off what we already knew, this was figuring out stuff as we went. I mean, I already knew that people here were pretty amazing but this was a really good example of that.

What future do you see for your project ?

CAN: Basically just to fine-tune the network with the scientific consultants and to fine-tune our code and our technical physics model. And then also make some new usability improvements, make things easier for testing, like running large batteries of tests. Mainly usability and just cleaning up the code base, make it a lot prettier.

PHIL: I should also mention that we want to perfect this physics simulation version but we also want to make a more generic version of what we built so that we can distribute all sorts of tasks and do large scale computing for a number of problems. I am planning on creating a 42 distributed computing club with Can. So, we think that the machine learning team would be able to benefit from being able to train on lots of computers at once. We might try to find the next biggest prime number. I think this is one of the things we were talking about.

What is your dream job or your long-term career goals ?

PHIL: Having gotten a taste for GPU computing, I really like it and I would really like to work in some sort of high performance computing capacity. Dream job would be working for either AMD or Nvidia. They have these teams that design scientific applications that scientists who are not programmers can benefit from using. I like being at the interface between those two things, because those are my two core interests science and computer programming. So that would be my dream. But, really, anything with really big numbers moving really fast.

CAM: My dream job, I am not sure if it sets along a specific company, but what I really want to do is a lot more low level stuff. If it is web development, then more back-end. Just like building the stuff that the front-end uses with all the cool little algorithms and infrastructure. I also have interests in Virtual Reality and all the things that come along with that. Distributed computing has been really, really cool and very interesting. So I am not sure exactly what my dream job will be.

published by Jennifer Robertson – October 26, 2017