Our final year project research paper is got published in The International Journal of Computer and Information Engineering WASET(http://www.waset.org/journals/ijcie/).
You can download the research paper by clicking the following link.
http://www.waset.org/journals/ijcie/v3/v3-4-34.pdf
I would like to thanks my group members Madhawie Samaranayake, Lahiru Suranga Bandara, Lasantha Fernando and the project coordinator Mr Kishan Wimalawarne for this achievement. success.
Saturday, January 22, 2011
JConqurr - Multicore Programming Toolkit For Java
Our final year project research paper is got published
Saturday, March 20, 2010
Analysis of Parallelizing the Fibonacci using java executor framework
From my last post I have showed you a mechanism that we can used to parallel the Fibonacci. From this post I hope to analyse the various mechanism that can use to parallel the Fibonacci using java and I'll point out the some of the disadvantageous.
One of the famous book in parallel computing is "The Art of Multiprocessor Programming" by Maurice Herlihy and Nir Shavit. In the book we can found a one mechanism that used for parallel the fibonacci.In achieving that the author has used the java executor framework. Here is the code used in the book.

According to the algorithm it mainly focus on the finer-grained parallelism. So when the Fibonacci number increases, number of task increases. So lot of overhead will added in resource allocation for each new task. When you using java threads or the java executor framework if you targeting a performance gain then the time taking for your algorithm complexity must be above the time which require in resource allocation of threads or the executor framework. So what you should focus is achieving the coarse gain parallelism as much as you can. Also you must consider the number of processors in your machine. Your coarse grain parallelism must build around those processor. That's the thing which I did exactly in my algorithm. Which is shown below.


According to the above mechanism resource allocation happens only for two tasks. So those two task bare equal amount of load. When you fork the problem no need to fork it too much. The amount of forking level must depend on the number of processors. That will give you a big performance hit. This is a common practise that we need to adhere in parallel computing.
One of the famous book in parallel computing is "The Art of Multiprocessor Programming" by Maurice Herlihy and Nir Shavit. In the book we can found a one mechanism that used for parallel the fibonacci.In achieving that the author has used the java executor framework. Here is the code used in the book.

According to the algorithm it mainly focus on the finer-grained parallelism. So when the Fibonacci number increases, number of task increases. So lot of overhead will added in resource allocation for each new task. When you using java threads or the java executor framework if you targeting a performance gain then the time taking for your algorithm complexity must be above the time which require in resource allocation of threads or the executor framework. So what you should focus is achieving the coarse gain parallelism as much as you can. Also you must consider the number of processors in your machine. Your coarse grain parallelism must build around those processor. That's the thing which I did exactly in my algorithm. Which is shown below.


According to the above mechanism resource allocation happens only for two tasks. So those two task bare equal amount of load. When you fork the problem no need to fork it too much. The amount of forking level must depend on the number of processors. That will give you a big performance hit. This is a common practise that we need to adhere in parallel computing.
| Reactions: |
Parallelizing the Fibonacci using java
Hai...
Its being a quite some time to my last post. Anyway since I currently researching on parallel computing I thought to publish a post relevant parallel programming. So I thought to implement the Fibonacci calculation algorithm in a parallel way using Java. Here is the source code.
Parallel Fibonacci--------------------------------------


Sequential Fibonacci----------------------------

I have use the Java executor framework to achieve the parallelism. I tested the source code under duel core 1.73Ghz machine. Following are the results that I got for sequential and the parallel computations.
number=25
seq=0.0040 parallel=0.0070
number=30
seq=0.035 parallel=0.029
number=35
seq=0.215 parallel=0.189
number=40
seq=2.025 parallel=1.719
number=45
seq=22.215 parallel=14.291

Above graph shows the performance of each calculation (X=fib number,Y=time(s)).
Thats it for today. I hope to explain the concept behind the performance gain in next post.
Its being a quite some time to my last post. Anyway since I currently researching on parallel computing I thought to publish a post relevant parallel programming. So I thought to implement the Fibonacci calculation algorithm in a parallel way using Java. Here is the source code.
Parallel Fibonacci--------------------------------------


Sequential Fibonacci----------------------------

I have use the Java executor framework to achieve the parallelism. I tested the source code under duel core 1.73Ghz machine. Following are the results that I got for sequential and the parallel computations.
number=25
seq=0.0040 parallel=0.0070
number=30
seq=0.035 parallel=0.029
number=35
seq=0.215 parallel=0.189
number=40
seq=2.025 parallel=1.719
number=45
seq=22.215 parallel=14.291

Above graph shows the performance of each calculation (X=fib number,Y=time(s)).
Thats it for today. I hope to explain the concept behind the performance gain in next post.
| Reactions: |
Sunday, December 27, 2009
How to use OpenForecast to a add forecasting features to you web applications...
Forecasting is one of a nice feature you can add to your data related web application.Assume we have to predict a measurement of a temperature for a given place and date. For that we required a data mining tool. So we achieved this task by using an open source forecasting library called OpenForecast. The advantage of the library is it provides lot of scalability our application. So we can add any data field for our prediction. Below I mentioned the approach we used to achieve the forecasting using OpenForecast.
• First you have to define the test data set for the forecast. For that library provides two class called DataSet and Observations.
• Using Observations class we can define the past observations we made. Then we have to assign the each Observation objects to the Data set. A sample code is shown below
// Create Observation for temperature measured on 2009/12/20
Observation observation1 = new Observation(32.0);
observation1.setIndependentValue("year",2009);
observation1.setIndependentValue("month", 12);
observation1.setIndependentValue("date", 20);
// Create Observation for temperature measured on 2009/12/21
Observation observation2 = new Observation(30.0);
observation2.setIndependentValue("year", 2009);
observation2.setIndependentValue("month", 12);
observation2.setIndependentValue("date", 21);
// Create Observation for temperature measured on 2009/12/22
Observation observation3 = new Observation(27.0);
observation3.setIndependentValue("year", 2009);
observation3.setIndependentValue("month", 12);
observation3.setIndependentValue("date", 22);
DataSet dataSet = new DataSet();
// Add Observations to the DataSet
dataSet.add(observation1);
dataSet.add(observation2);
dataSet.add(observation3);
• After we define the test data set as above we have to use a forecast model to test the data set. For that the library provide a functionality called getBestForecastModel(DataSet dataSet). So we pass our data set and get the best forecast model that can use to train our data set. Library has set of forecasting models such as Double Exponential Smoothing Model, Multiple Linear Regression Model, Naïve Forecasting Model, Polynominal Regression Model, Simple Exponential Smoothing Model, Triple Exponential Smoothing Model, Weighted Moving Average Model. To train the dataset we call the model.init() method. Following code shows this mechanism more clearly.
ForecastingModel model = Forecaster.getBestForecast(dataSet);
model.init(dataSet);
• Then we have to create another Observation/DataPoint for our prediction. In there we set the value to zero and add other independent variables. After that we have to create a new data set and we add above Observation/DataPoint object to our new data set. Sample code shown below.
DataPoint fcDataPoint4 = new Observation(0.0);
fcDataPoint4.setIndependentValue("year", 2009);
fcDataPoint4.setIndependentValue("month", 12);
fcDataPoint4.setIndependentValue("date", 23);
// Create forecast data set and add these DataPoints
DataSet fcDataSet = new DataSet();
fcDataSet.add(fcDataPoint4);
• Now we have created the data set which we want to forecast. Next we forecast the data set using our model and we get the dependent value from above fcDataSet like below. Our forecast result is equal to the value return by the getDependent() method.
Iterator itt = fcDataSet.iterator();
Double value=0.0;
while (itt.hasNext()) {
DataPoint dp = (DataPoint) itt.next();
double forecastValue = dp.getDependentValue();
value = forecastValue;
}
OpenForecast Site:http://openforecast.sourceforge.net/
Download OpenForecast:http://sourceforge.net/projects/openforecast/files/OpenForecast/OpenForecast%200.4.0/OpenForecast-0.4.0.jar/download
• First you have to define the test data set for the forecast. For that library provides two class called DataSet and Observations.
• Using Observations class we can define the past observations we made. Then we have to assign the each Observation objects to the Data set. A sample code is shown below
// Create Observation for temperature measured on 2009/12/20
Observation observation1 = new Observation(32.0);
observation1.setIndependentValue("year",2009);
observation1.setIndependentValue("month", 12);
observation1.setIndependentValue("date", 20);
// Create Observation for temperature measured on 2009/12/21
Observation observation2 = new Observation(30.0);
observation2.setIndependentValue("year", 2009);
observation2.setIndependentValue("month", 12);
observation2.setIndependentValue("date", 21);
// Create Observation for temperature measured on 2009/12/22
Observation observation3 = new Observation(27.0);
observation3.setIndependentValue("year", 2009);
observation3.setIndependentValue("month", 12);
observation3.setIndependentValue("date", 22);
DataSet dataSet = new DataSet();
// Add Observations to the DataSet
dataSet.add(observation1);
dataSet.add(observation2);
dataSet.add(observation3);
• After we define the test data set as above we have to use a forecast model to test the data set. For that the library provide a functionality called getBestForecastModel(DataSet dataSet). So we pass our data set and get the best forecast model that can use to train our data set. Library has set of forecasting models such as Double Exponential Smoothing Model, Multiple Linear Regression Model, Naïve Forecasting Model, Polynominal Regression Model, Simple Exponential Smoothing Model, Triple Exponential Smoothing Model, Weighted Moving Average Model. To train the dataset we call the model.init() method. Following code shows this mechanism more clearly.
ForecastingModel model = Forecaster.getBestForecast(dataSet);
model.init(dataSet);
• Then we have to create another Observation/DataPoint for our prediction. In there we set the value to zero and add other independent variables. After that we have to create a new data set and we add above Observation/DataPoint object to our new data set. Sample code shown below.
DataPoint fcDataPoint4 = new Observation(0.0);
fcDataPoint4.setIndependentValue("year", 2009);
fcDataPoint4.setIndependentValue("month", 12);
fcDataPoint4.setIndependentValue("date", 23);
// Create forecast data set and add these DataPoints
DataSet fcDataSet = new DataSet();
fcDataSet.add(fcDataPoint4);
• Now we have created the data set which we want to forecast. Next we forecast the data set using our model and we get the dependent value from above fcDataSet like below. Our forecast result is equal to the value return by the getDependent() method.
Iterator itt = fcDataSet.iterator();
Double value=0.0;
while (itt.hasNext()) {
DataPoint dp = (DataPoint) itt.next();
double forecastValue = dp.getDependentValue();
value = forecastValue;
}
OpenForecast Site:http://openforecast.sourceforge.net/
Download OpenForecast:http://sourceforge.net/projects/openforecast/files/OpenForecast/OpenForecast%200.4.0/OpenForecast-0.4.0.jar/download
Labels:
Forecasting,
grails,
OpenForecast
| Reactions: |
Subscribe to:
Posts (Atom)