Getting started with MulticoreBSP for Java
We assume you are working in a clean directory for this course, called ParCo. We further assume you have access to the internet and that the Eclipse for Java software development platform is installed.
- Start Eclipse and create a new Java project in the ParCo directory.
- Get the MulticoreBSP library from the webpage.
- Add the MulticoreBSP library in the current project using the following procedure:
- Select your newly created project and press F5 to refresh the file list (see screenshot).
- Right-click on the project name in Eclipse's package explorer.
- Go to the Java Build Path section, select the Libraries tab and click on Add JARs.
- Select the MulticoreBSP.jar file and add it to the project.
- We can now create a simple `Hello World' example by creating a new executable Java class extended from com.multicorebsp.core.BSP_PROGRAM, and writing the basic code as found here. We can immediately run this program (also see the screenshot). Note that starting a BSP program is done by calling its start() function, as is also used for standard Java threads. Also note the function main_part() is sequential, and execution of the parallel part happens by calling bsp_begin() from within the sequential main_part() function. MulticoreBSP for Java does not require any call to bsp_init nor to bsp_end. This is all quite different from the Oxford BSP library.
Optional exercise:
write your own MulticoreBSP-for-Java version of the BSP inner-product calculation. You can start from a given code skeleton. Note that communication now is also object-oriented-- try to figure out how to perform the allreduce operation from the MulticoreBSP for Java documentation (tip: look at the BSP_REGISTER class or the BSP_DOUBLE_ARRAY class).