Matlab Distributed Judge

20 02 2009

Been really really busy of late. Had to Engineer Engineer. Anyways, the fun techie stuff started with simplicity. Since I generally dont trust old code by someone else, me and him decided to build our own server from scratch.

At M$R, I had experimented with distributed computing on R2008B. But didnt really get to trying it out on the corp net coz I was too scared πŸ™‚

Anyway, so, here’s what we did

1. Opened up the necessary ports. There is one port for the job manager which needs to be opened up on the server. And then they have a base port +5 + client number of ports. Do this.

2. Add Matlab.exe and java.exe from the matlab installation to the firewall.

3. This is very very important. Add the host-name to Β %windir%\system32\drivers\etc\hosts. Just open this in wordpad or something and add the hostname and ip address (intranet) at the very end

4. Then, it is recommended that you create batch scripts to start and stop workers and manager. Also, the nice thing was that both of us had dual procs – mine dual core and his was core 2 duo… so 2 workers ran well on each

5. To actually do the judging, I wrote a single function for the evaluation. The test case and expected answers were passed to the workers in an async call with a desired timeout. The function was just copied from a SMB share and renamed. It ran flawlessly.

6. The scores were updated using a php script. The script resided on the server, had an arbit name and took arbit POST variable names. So, security was somewhat guaranteed. We could have also added Β an ip based restriction, but anyway. The main reason for this was because MYSQL was hosted on loopback, so it did not have access from an external comp.

7. After sometime we felt the need for checking the code for malicious code. Without a sandbox for matlab, I was forced to write a php script to periodically refresh and show the code for new files. The nice thing here was the html tag that lets you display formatted text as is… without the bugging html white space parsing.

8. The interface looked cute at the end – I had picked up some CSS tricks after designing the modx site πŸ™‚

So, in the end, php, C, C++, html, sql and matlab were used…

Appz – Photoshop, Dreamweaver, Matlab, Opera (for bug testing and phpmyadmin) putty, winscp, windows share, and thats it πŸ™‚