Révision 252 Pi/XPU/PiXPU.py
| PiXPU.py (revision 252) | ||
|---|---|---|
| 503 | 503 |
|
| 504 | 504 |
import pyopencl as cl |
| 505 | 505 |
|
| 506 |
print("Inside ",InputCL)
|
|
| 507 |
|
|
| 508 | 506 |
iterations=InputCL['Iterations'] |
| 509 | 507 |
steps=InputCL['Steps'] |
| 510 | 508 |
blocks=InputCL['Blocks'] |
| ... | ... | |
| 527 | 525 |
print("CPU/GPU selected: ",device.name.lstrip())
|
| 528 | 526 |
HasXPU=True |
| 529 | 527 |
Id+=1 |
| 530 |
print(Id) |
|
| 528 |
# print(Id)
|
|
| 531 | 529 |
|
| 532 | 530 |
if HasXPU==False: |
| 533 | 531 |
print("No XPU #%i found in all of %i devices, sorry..." % (Device,Id-1))
|
| 534 | 532 |
sys.exit() |
| 535 | 533 |
|
| 536 |
print(XPU) |
|
| 537 | 534 |
# Je cree le contexte et la queue pour son execution |
| 538 | 535 |
try: |
| 539 | 536 |
ctx = cl.Context(devices=[XPU]) |
| ... | ... | |
| 590 | 587 |
circleCL.release() |
| 591 | 588 |
|
| 592 | 589 |
OutputCL={'Inside':sum(circle),'NewIterations':numpy.uint64(iterationsCL*jobs),'Duration':MyDuration}
|
| 593 |
print(OutputCL) |
|
| 590 |
# print(OutputCL)
|
|
| 594 | 591 |
return(OutputCL) |
| 595 | 592 |
|
| 596 | 593 |
|
| ... | ... | |
| 831 | 828 |
except ImportError: |
| 832 | 829 |
print("Platform does not seem to support OpenCL")
|
| 833 | 830 |
|
| 834 |
print(Devices,Alu) |
|
| 831 |
#print(Devices,Alu)
|
|
| 835 | 832 |
|
| 836 | 833 |
BlocksList=range(BlocksBegin,BlocksEnd+BlocksStep,BlocksStep) |
| 837 | 834 |
ThreadsList=range(ThreadsBegin,ThreadsEnd+ThreadsStep,ThreadsStep) |
| ... | ... | |
| 941 | 938 |
except: |
| 942 | 939 |
print("Problem with (%i,%i) // computations on OpenCL" % (Blocks,Threads))
|
| 943 | 940 |
Rate=NewIterations/Duration |
| 941 |
print("Itops %i\nLogItops %.2f " % (int(Rate),numpy.log(Rate)/numpy.log(10)))
|
|
| 944 | 942 |
print("Pi estimation %.8f" % (4./NewIterations*Inside))
|
| 945 | 943 |
|
| 946 | 944 |
avgD=numpy.append(avgD,numpy.average(Duration)) |
Formats disponibles : Unified diff