TWiki> ArdaGrid Web>GangaIndex>EGEETutorialPackage>GangaTutorialExercise (2007-05-09, HurngChunLee)

### Running PrimeFactorizer application

#### Small example

In this example we create and submit a local job with PrimeFactorizer application. We use only one table in the PrimeTableDataset - so the first million prime numbers.

```In : j = Job()
In : j.application = PrimeFactorizer(number=1925)
In : j.inputdata = PrimeTableDataset(table_id_lower=1, table_id_upper=1)
In : j.submit()
```

When the job is in `completed` state we can check if all the prime factors have been found.

```In : check_prime_job(j)
Looking for prime factors of 1925
job 0 : got factors: [(5, 2), (7, 1), (11, 1)]

All prime factors found: [(5, 2), (7, 1), (11, 1)]
```

#### Bigger example

Now we will factorize a much larger number, so we need a PrimeTableDataset which contains all 15 tables. We will also split the job into 5 local subjobs, which will run in concurrently.

```In : j = Job()
In : j.application = PrimeFactorizer(number=118020903911855744138963610)
In : j.inputdata = PrimeTableDataset()
In : j.inputdata.table_id_lower = 1
In : j.inputdata.table_id_upper = 15
In : j.splitter = PrimeFactorizerSplitter(numsubjobs= 5)
In : j.submit()
```

Now we do the same using LCG.

```In : j = j.copy()
In : j.backend = LCG()
In : j.submit()
```

And now using gLite.

```In : j = j.copy()
In : j.backend = LCG(middleware='GLITE')
In : j.submit()
```

We can use `check_prime_job()` function to see the outcome on selected jobs.

-- Main.hclee - 09 May 2007

Topic revision: r1 - 2007-05-09 - HurngChunLee Log In

Welcome Guest  Cern Search TWiki Search Google Search ArdaGrid All webs Copyright &© 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback