Révision 67 Splutter/GPU/SplutterGPU.py
SplutterGPU.py (revision 67) | ||
---|---|---|
25 | 25 |
import math |
26 | 26 |
from socket import gethostname |
27 | 27 |
|
28 |
# find prime factors of a number |
|
29 |
# Get for WWW : |
|
30 |
# http://pythonism.wordpress.com/2008/05/17/looking-at-factorisation-in-python/ |
|
31 |
def PrimeFactors(x): |
|
32 |
factorlist=numpy.array([]).astype('uint32') |
|
33 |
loop=2 |
|
34 |
while loop<=x: |
|
35 |
if x%loop==0: |
|
36 |
x/=loop |
|
37 |
factorlist=numpy.append(factorlist,[loop]) |
|
38 |
else: |
|
39 |
loop+=1 |
|
40 |
return factorlist |
|
41 |
|
|
42 | 28 |
# Try to find the best thread number in Hybrid approach (Blocks&Threads) |
43 | 29 |
# output is thread number |
44 | 30 |
def BestThreadsNumber(jobs): |
Formats disponibles : Unified diff