# how to run workflow on Htcass?

Hi,

I have a simple task to calculate Pi (3,14...) on Htcaas.

The algorithm is:

Assume the center of a cycle is (0,0) and r = 1, consider the quarter whose x > 0 and y > 0

The area of the quarter is pi/4

Consider the square whose 4 points are (0,0), (0,1), (1,1) and (1,0)

The area of the square is 1

Consider point A (x, y); 0 < x, y < 1

The possibility that A is located inside the cycle = the area of the quarter / the area of the square = pi/4

A is located inside the cycle iff (x^2 + y ^2 <= 1 (which is r^2))

The serial version of the algorithm is:

int numSample = 100000;

int numPointInsideRound = 0;

for (int i = 0; i < numSample; i++){

double x = Math.random();

double y = Math.random();

double distanceSquare = (x*x) + (y*y);

if (distanceSquare < 1){

numPointIns

}

}

// result = pi

double result = (double) (numPointInside

System.

The result on my PC is pi = 3.14164

Now I want to create a parallel, parameter sweep version of the algorithm and submit to Htcaas, somehow like this:

double x = Math.random();

double y = Math.random();

double distanceSquare = (x*x) + (y*y);

if (distanceSquare < 1){

} else {

}

The question is, if I submit this program, for example 1000 times, then I will get 1000 output files.

I don't want to retrieve these 1000 output file to my PC to process. Instead, I want to do "something more" on Htcaas before getting the final result.

How can I do it?

Hieu

## Question information

- Language:
- English Edit question

- Status:
- Answered

- For:
- HTCaaS Edit question

- Assignee:
- No assignee Edit question

- Last query:

- Last reply:

## Can you help with this problem?

Provide an answer of your own, or ask Hieu Vu for more information if necessary.