-
Notifications
You must be signed in to change notification settings - Fork 32
Examples using Threadly
We have an entire repo which contains examples of using the Threadly library. Check out the github page, and download the source for those examples here: https://github.com/threadly/threadly_examples
You can also download the automatically compiled jar from our CloudBees ci page here: https://threadly.ci.cloudbees.com/view/Threadly/job/threadly_examples
If there are ever any questions or problems with the examples, feel free to submit issues under the Threadly project for them. The wiki and issues have been disabled for threadly_examples because those should all be done here. The only reason the repositories are split is to keep the code separate.
This fractal builds the Mandelbrot, this one was chosen because it's such a good candidate to compute in parallel. This automatically chooses a thread count based on the number of available processors in the system, trying to take good use of the available hardware.
Once you have the code checked out, and compiled using gradle (via the same methods for threadly described here, just different repo). The application can be run by using the command:
java -cp build/libs/threadly_examples.jar org.threadly.examples.fractals.ThreadlyFractal
Once the application starts, you can click and hold as you move the mouse to select an area of the fractal to zoom into. You can right click to reset to the full view of the fractal.
This is a simple application which tests if a number (or possibly multiple numbers if supplied from the command line) are prime or not. Right now the implementation uses an INCREDIBLY simplistic algorithm. In the future I would like to implement in parallel it with AKS, but right now the best you get is a simple, but still in parallel calculation.
There is little unique about using threadly in this design, it just shows a simple example of submission of runnables and callables, and looking for the first result.
Once you have the code checked out, and compiled using gradle (via the same methods for threadly described here, just different repo). The application can be run by using the command:
java -cp build/libs/threadly_examples.jar org.threadly.examples.prime.PrimeTester [number] [number] [number]...
You can provide any where from 1 to thousands of numbers to test. All numbers will be tested in parallel (so the results of the provided numbers may not be in the order you provided them in the command line). The fewer the numbers of course, the faster the result will be calculated.
Once the application starts, you can click and hold as you move the mouse to select an area of the fractal to zoom into. You can right click to reset to the full view of the fractal.
##Threadly Class Examples Some of the major API classes of Threadly have example usage code written. They are located in the examples repository in the examples features package.