This article was conceived while trying to create a virtual cluster using a distribution of Linux (CentOS) that is modified for parallel computing. There is some documentation out there on how to do this, but I had to piece together multiple documents to be able to get my “Rocks in a Box” running, so I’ve documented my steps here which will hopefully have all the steps required to get your parallel virtual machine up and running.
Please note, this machine, although parallel, cannot possibly be any faster than the machine on which it is created. This demonstration should be used solely as practice setting up a Rocks Cluster if you decide to do so on multiple real machines, in which case some networking will be required. Also, there are other ways to set up parallel networks, in or out of VirtualBox, I will cover these in future articles.
1. Downloading Oracle VirtualBox
Downloads for VirtualBox for Linux, Windows, OS X, and Solaris can be found at the following site:
Be sure to choose the correct download for the operating system you are currently running.
2. Downloading Rocks Operating System
I downloaded Rocks from DistroWatch.com at the following address:
The actual download can be hard to find, it is hidden in some text on this page. The image below shows where it is located if you are having problems.
This .iso is what will be used as the “bootable disk” in VirtualBox.
This operating system can be found very easily via a simple Google search for “Rocks Cluster Download” if, for any reason, you have an issue with the link I’ve provided.
3. Creating the Front-End Node
After installing the virtualization software and downloading the operating system .iso file, we are ready to create the virtual machines that will make up the virtual cluster.
First off, open up VirtualBox. Select “New” in the upper left corner of the Oracle VM VirtualBox Manager. The first virtual machine we will create will be our “front end node” this node is responsible for controlling the other nodes (the “slave” nodes). The following are the options I choose for the first dialog box when creating a cluster, note I downloaded the 64-bit version, thus I am creating a 64-bit virtual machine.
After clicking “Next” we will select the amount of RAM for this machine. Most sources recommend at least 1GB (1024MB) of RAM for the front-end node of the cluster. I am choosing 2GB of RAM since my machine has 32GB. At this step be sure to know how many machines you will be virtualizing and ensure the total RAM of all the machines does not exceed one-half of the host machines total RAM (as a rule of thumb, you can push this limit if you so choose).
On the next dialog simply click “Create” to move on since we are most likely creating new virtual machines and not using hard drives from other machines. Likewise, the first option is out of the picture since we NEED a hard drive to install the cluster OS.
After selecting “Create” just fly through the next two screens by clicking “Next”. You should now be on this screen:
Here we chose the size of the virtual hard disk we are creating. This too is dependent on your host machine specifications. I will be using 30GB of hard disk space for each of my nodes THIS IS THE REQUIRED SIZE (may want to verify this for newer versions). That is, you need to have at least 30GB of hard drive space to install this OS. Again don’t use so much space that there is none left on the host machine, but make sure it meets the requirement.
That should be all the steps to create the virtual machine. Now there are a few more steps to get the machine ready to boot.
You should now be at the Home screen of the Oracle VM VirtualBox Manager. Select the front-end node we just created and click “Settings” next to the “New” option in the upper left corner. Select Network on the left of the dialog that just appeared and go to the “Adapter 2” tab.
Check the “Enable Network Adapter” and select “Internal Network” from the “Attached to:” combo box. Press OK to exit settings.
The virtual machine should now be ready to start, do so by clicking “Start” (next to “Settings”) or by double-clicking the virtual machine.
This will bring up the following dialog:
Click the folder next to the combo box and browse to the folder containing the Rocks OS .iso previously downloaded. Select the .iso and click open. Clicking start on the dialog will fire up the machine.
IMPORTANT! This step is crucial for setting up the front-end node. When the .iso loads up there will be a screen with a picture of a rattlesnake, on this screen you must quickly type “frontend” to set up this node as the front end node.
HELPFUL! This OS in VirtualBox has the feature of ‘capturing’ the mouse, this can be annoying since sometimes it forgets to release it. To get the mouse cursor out of the virtual machine window press the left CTRL button on your keyboard (this works for all virtual machines in VirtualBox).
Once all the black magic is done a new GUI will appear with the option to “Select Your Rolls”. I’m not too savvy on what exactly a “roll” is. Even though I have some idea I will not attempt to explain them here. However, click the “CD/DVD-based Roll” button under the “Local Rolls” section.
There are a lot of rolls to select from here and feel free to select them all if you’d like. However, I select bios, area51, base, and os for my install.
Click “Next” and “Next” again until you are on the “Ethernet Configuration for Public Network” page. Select “eth0” from the combo box and assign an IP address, I use 192.168.0.1 for mine with a Netmask of 255.255.255.0. Click “Next” again.
We should now be on the “Ethernet Configuration for Private Network” and select “eth1” from the combo box. There should be an IP address and Netmask already assigned, leave them as they are.
Click “Next” again should take you to the “Miscellaneous Network Settings” screen. Here I entered the values Gateway: 192.168.0.11 DNS Server: 188.8.131.52. I’m not sure the significance of these values or if there’s a proper way to set them. If you know, please feel free to comment below. 🙂
The next screen is to set the password. After that, you will select your timezone, and then finally select manual or automatic partitioning. I use automatic partitioning for simplicity, but if you prefer to create the partitions differently select manual partitioning.
Now the front-end node will begin to install. Once the installation is finished login to the root account. Open the terminal and run insert-ethers. This is how you will detect the compute nodes. Select “Compute” from the menu and hit OK.
NOTES! In this version of Cent OS the terminal is located in the Applications -> System Tools -> Terminal. Applications are in the upper right-hand corner of the screen.
4. Creating the Compute Nodes
Setting up the virtual machines for the compute nodes is very similar so I will just add the screenshots of the individual dialog’s so that you can copy the settings if need be.
Again, be wary of your host machine and virtual machine(s) specifications. Also, you can name your nodes however you want but I follow the following convention: node 1 = compute-0-0, node 2 = compute-0-1, node 3 = compute-0-3, etc.
IMPORTANT! Notice in the network configuration step we change the “Attached to” field from “NAT” to “Internal Network” (the RocksLAN network) rather than adding an additional network. This is because when booting from the network, which we will do, the application will “look through” eth0 (Adapter 1) for something to boot from. Therefore, it must be the internal network we’re looking through to boot.
Here are two new steps to take when creating compute nodes. First we must enable PAE/NX boot via Settings-> System-> Processor -> (checkbox), see below.
Next, we have to move network boot to the highest boot priority via Settings -> System -> Motherboard. Use the “Boot Order” box and the arrows beside it to move “Network” and “CD/DVD” to the top of the list, again see below.
When you first start the virtual machine you will need to select the Rocks .iso, like we have done before.
This time when the “Rattlesnake Screen” appears do not type anything. It will automatically install and connect to the front-end node.
Follow these same steps to create more compute nodes. As many as you want or as many as your machine can handle. Now you can use things like OpenMPI to create and execute parallel applications and test the speed of your network.
5. Rocks on an Actual Cluster
Although I haven’t experimented with setting up Rocks on an actual cluster, I imagine these instructions could be used there as well. Of course, you will not be setting up virtual machines, will likely be booting (the front-end) from a USB, and configuring an actual network. In the future, If I can round up enough used PCs, I might add another tutorial on setting up an actual cluster using rocks. That being said, creating a compute cluster with any Linux OS is pretty simple, here is a quick post on another of my sites outlining how to do this on Raspberry Pi’s using the Raspbian OS.
Another Rocks tutorial, not in VirtualBox:
How to install and setup OpenMPI:
Short MPI introduction: