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 [1]: j = Job()
In [2]: j.application = PrimeFactorizer(number=1925)
In [3]: j.inputdata = PrimeTableDataset(table_id_lower=1, table_id_upper=1)
In [4]: j.submit()
When the job is in
completed
state we can check if all the prime factors have been found.
In [5]: 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 [1]: j = Job()
In [2]: j.application = PrimeFactorizer(number=118020903911855744138963610)
In [3]: j.inputdata = PrimeTableDataset()
In [4]: j.inputdata.table_id_lower = 1
In [5]: j.inputdata.table_id_upper = 15
In [6]: j.splitter = PrimeFactorizerSplitter(numsubjobs= 5)
In [7]: j.submit()
Now we do the same using LCG.
In [8]: j = j.copy()
In [9]: j.backend = LCG()
In [10]: j.submit()
And now using gLite.
In [11]: j = j.copy()
In [12]: j.backend = LCG(middleware='GLITE')
In [13]: j.submit()
We can use
check_prime_job()
function to see the outcome on selected jobs.
-- Main.hclee - 09 May 2007