Saturday, September 28, 2013 - Minor Website Update
The website was given some formatting adjustments.
Hydra PPS (Parallel Programming System) extends the Java language and virtual machine with new parallel constructs. It also allows programs to be compiled for a particular parallel architecture at runtime on the user's machine rather than on the machine of the developer. This allows a program to run on and be optimized for the user's computer. Right now only an SMP (Symmetric Multiprocessing) runtime is available. However, development is underway for more runtimes.
The user site is for both end users and developers who wish to use Hydra PPS with their programs. The developer site is for developers who are developing Hydra PPS and those who wish to learn about the internals of the system.
Most of the code that is included in the Hydra PPS falls under the Lesser GPL v2.1 license. The rest of the code uses the BSD license. In short, all the code for the Hydra PPS is both free and open.
Copyright (c) 2006 - 2013, Franklin E. Powers, Jr.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- Documentation
Hydra PPS will be released within the next few weeks.
Hydra Parallel Programming System Public Release 2
The second release is not meant for casual use and as a result it is being distributed in source code form only. The license is LGPL 2.1 or later. You can either download a zip or a tgz file. Some instructions are included in the readme file.
Hydra Parallel Programming System Public Release 1
This first release is not meant for casual use and as a result it is being distributed in source code form only. The license is LGPL 2.1 or later. You can either download a zip or a tgz file. Some instructions are included in the readme file.
Monday, January 15, 2007 - Major Website Update
The website was updated with the following:
- Some minor corrections
- A new color scheme
- An example program was added.
- Some AJAX code was written to display some information about Hydra commands that are in example programs.
- Some information was added by Hydra commands, which is accessible via the tooltips and by clicking on Hydra commands in example programs.
Thursday, August 10, 2006 - Minor Corrections and PR2
The website was updated with some minor corrections. Also, the second public test version of Hydra PPS is now available.
Saturday, May 7, 2006 - Website updated and first public test version available
The website was updated with more information. Also... At long last, the first public test version of Hydra PPS is now available!
Tuesday, April 18, 2006 - Website finally up
The first version of the website is finally up. In the near future it will be expanded and improved.
Friday, April 14, 2006 - Hydra PPS is unveiled
The Hydra Parallel Programming System was publicly unveiled in a demonstration at a university. In the near future this language extension for Java will be released to the general public. Right now the different licenses are being reviewed to ensure that the correct one has been choosen (LGPL) and that none of the libraries and tools that were used prevent a particular license. In addition, internal tests are being run to ensure that the current system is ready for public release. If you wish to be notified when the system has been released you can send an e-mail to moreinfo@hydrapps.net.
The Hydra Parallel Programming System is divided into a number of subprojects. Most of these subprojects are publicly available and listed below:
- Alchemist Compiler - This is used to recompile Java class files.
- Alchemist Definition Generator - This produces language definitions for use with the Alchemist compiler.
- BAPS (Benchmark And Profiling System) - This is a library used to write programs that test the performance of Java and it's parallel language extensions.
- Hydra Language - A class library that defines the Hydra language.
- Hydra Language Plugin - An Alchemist plugin that defines the properties of the Hydra language.
- Hydra Runtime - An implementation of the Hydra language.
- Hydra Stay Resident - An add-on for the Hydra runtime, which allows it to remain in memory and improve performance.
- ParMake - A collection of scripts that is used to compile Hydra on Microsoft Windows.
- Test Suite - A collection of benchmarks for Hydra and Java.
For this example, our program will do the following operations:
- Create a parallel event group, for executing the threads in parallel.
- Create a sequential event group for each thread.
- Begin execution of an instance of our implementation of class Runnable for each thread.
Executing code in parallel with Hydra is simple. We need only add events or event groups to a parallel event group and the code will execute in parallel. Executing code sequentially is also simple. We need only add events or event groups to a sequential event group and the code will execute in a similar manner to how it would execute without Hydra.
In order to simulate a thread, we need only to use a sequential event group. To simulate threads executing in parallel, we need to add the sequential event groups to a parallel event group.
We also need some code to execute. Traditionally in Java, the code for a thread is in a class which either implements the Runnable interface or a class which extends the Thread class. For this example, we will be using a class that extends the Runnable interface. So, we will use this class just like we would normally use it in Java. We will implement the run method and that will contain our code for each thread. The run method will simply output a number to the console.
Source Code:
/*
* Threads.java
*
* Copyright (c) 2007, Franklin E. Powers, Jr.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of Franklin E. Powers, Jr. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
import Hydra.Language.*;
/**
* This class demonstrates how to simulate the starting of parallel threads
* using Hydra events and event groups.
*
* @author Franklin E. Powers, Jr.
*/
public class Threads {
/**
* The method that is invoked when the program is started. It creates a
* number of threads to be executed with Hydra and executes them by using
* the SpawnThreads method.
*
* @param args The arguments passed from the command-line.
*/
public static void main(String[] args) {
Runnable[] threads = new Runnable[4];
for (int i = 0; i < threads.length; i++)
threads[i] = new ToExecute();
SpawnThreads(threads);
}
/**
* This creates a number of threads using Hydra events and event groups.
* The code for the threads are in the implementation of the run method(s)
* used by the instances of Runnable. When starting a new thread, Java
* typically uses an instance of Runnable (or Thread) for the code to
* execute.
*
* @param threads The threads to start.
*/
public static void SpawnThreads(Runnable[] threads) {
EventGroup addingto = EventGroup.GetAddingTo();
EventGroup parallel = EventGroup.Parallel();
parallel.AddEventsToThis();
for (Runnable r : threads) {
EventGroup thread = EventGroup.Sequential();
thread.AddAsChildEventGroup();
thread.AddEventsToThis();
Start(r);
parallel.AddEventsToThis();
}
addingto.AddEventsToThis();
parallel.AddAsChildEventGroup();
}
/**
* An event that is used to start an individual thread. This is necessary
* because the run method is typically not a Hydra event.
*
* @param r The instance of Runnable that has the code to execute.
*/
private static @event void Start(Runnable r) {
r.run();
}
/**
* This class provides the code for the thread to execute.
*
* @author Franklin E. Powers, Jr.
*/
private static class ToExecute implements Runnable {
/**
* The total number of instances of this class.
*/
private static int iNumber = 0;
/**
* The ID number for this instance.
*/
private int iID = iNumber++;
/**
* This method is invoked when the thread starts. In this case it
* simply prints out the ID number of the instance.
*/
public void run() {
System.out.println(iID);
}
}
} |
Source code listing for Threads.java |