Révision 47
| Pi/GPU/Pi-GPU.py (revision 47) | ||
|---|---|---|
| 360 | 360 |
|
| 361 | 361 |
if iterations%jobs==0: |
| 362 | 362 |
iterationsCL=numpy.uint64(iterations/jobs) |
| 363 |
iterationsNew=iterationsCL*jobs
|
|
| 363 |
iterationsNew=numpy.uint64(iterationsCL*jobs)
|
|
| 364 | 364 |
else: |
| 365 | 365 |
iterationsCL=numpy.uint64(iterations/jobs+1) |
| 366 |
iterationsNew=iterations
|
|
| 366 |
iterationsNew=numpy.uint64(iterations)
|
|
| 367 | 367 |
|
| 368 | 368 |
for i in range(steps): |
| 369 | 369 |
|
| ... | ... | |
| 409 | 409 |
#print circle,float(numpy.sum(circle)) |
| 410 | 410 |
MyPi[i]=4.*float(numpy.sum(circle))/float(iterationsNew) |
| 411 | 411 |
MyDuration[i]=elapsed |
| 412 |
#print MyPi[i],MyDuration[i]
|
|
| 412 |
print MyPi[i],MyDuration[i] |
|
| 413 | 413 |
|
| 414 | 414 |
circleCL.release() |
| 415 | 415 |
|
| ... | ... | |
| 507 | 507 |
JobStart=1 |
| 508 | 508 |
# JobEnd is last number of Jobs to explore |
| 509 | 509 |
JobEnd=16 |
| 510 |
# JobStep is the step of Jobs to explore |
|
| 511 |
JobStep=1 |
|
| 510 | 512 |
# Redo is the times to redo the test to improve metrology |
| 511 | 513 |
Redo=1 |
| 512 | 514 |
# OutMetrology is method for duration estimation : False is GPU inside |
| ... | ... | |
| 516 | 518 |
Curves=False |
| 517 | 519 |
|
| 518 | 520 |
try: |
| 519 |
opts, args = getopt.getopt(sys.argv[1:],"hoca:g:p:i:s:e:r:d:",["alu=","gpustyle=","parastyle=","iterations=","jobstart=","jobend=","redo=","device="])
|
|
| 521 |
opts, args = getopt.getopt(sys.argv[1:],"hoca:g:p:i:s:e:t:r:d:",["alu=","gpustyle=","parastyle=","iterations=","jobstart=","jobend=","jobstep=","redo=","device="])
|
|
| 520 | 522 |
except getopt.GetoptError: |
| 521 |
print '%s -o (Out of Core Metrology) -c (Print Curves) -a <CPU/GPU> -d <DeviceId> -g <CUDA/OpenCL> -p <Threads/Hybrid/Blocks> -i <Iterations> -s <JobStart> -e <JobEnd> -r <RedoToImproveStats>' % sys.argv[0] |
|
| 523 |
print '%s -o (Out of Core Metrology) -c (Print Curves) -a <CPU/GPU> -d <DeviceId> -g <CUDA/OpenCL> -p <Threads/Hybrid/Blocks> -i <Iterations> -s <JobStart> -e <JobEnd> -t <JobStep> -r <RedoToImproveStats>' % sys.argv[0]
|
|
| 522 | 524 |
sys.exit(2) |
| 523 | 525 |
|
| 524 | 526 |
for opt, arg in opts: |
| 525 | 527 |
if opt == '-h': |
| 526 |
print '%s -o (Out of Core Metrology) -c (Print Curves) -a <CPU/GPU> -d <DeviceId> -g <CUDA/OpenCL> -p <Threads/Hybrid/Blocks> -i <Iterations> -s <JobStart> -e <JobEnd> -r <RedoToImproveStats>' % sys.argv[0] |
|
| 528 |
print '%s -o (Out of Core Metrology) -c (Print Curves) -a <CPU/GPU> -d <DeviceId> -g <CUDA/OpenCL> -p <Threads/Hybrid/Blocks> -i <Iterations> -s <JobStart> -e <JobEnd> -t <JobStep> -r <RedoToImproveStats>' % sys.argv[0]
|
|
| 527 | 529 |
|
| 528 | 530 |
print "\nInformations about devices detected under OpenCL:" |
| 529 | 531 |
# For PyOpenCL import |
| ... | ... | |
| 555 | 557 |
JobStart = int(arg) |
| 556 | 558 |
elif opt in ("-e", "--jobend"):
|
| 557 | 559 |
JobEnd = int(arg) |
| 560 |
elif opt in ("-t", "--jobstep"):
|
|
| 561 |
JobStep = int(arg) |
|
| 558 | 562 |
elif opt in ("-r", "--redo"):
|
| 559 | 563 |
Redo = int(arg) |
| 560 | 564 |
|
| ... | ... | |
| 651 | 655 |
if len(average)!=0: |
| 652 | 656 |
numpy.savez("Pi_%s_%s_%s_%s_%i_%.8i_Device%i_%s_%s" % (Alu,GpuStyle,ParaStyle,JobStart,JobEnd,Iterations,Device,Metrology,gethostname()),(ExploredJobs,average,median,stddev))
|
| 653 | 657 |
numpy.savetxt("Pi_%s_%s_%s_%s_%i_%.8i_Device%i_%s_%s" % (Alu,GpuStyle,ParaStyle,JobStart,JobEnd,Iterations,Device,Metrology,gethostname()),(ExploredJobs,average,median,stddev))
|
| 654 |
Jobs+=1
|
|
| 658 |
Jobs+=JobStep
|
|
| 655 | 659 |
|
| 656 | 660 |
FitAndPrint(ExploredJobs,median,Curves) |
| 657 | 661 |
|
Formats disponibles : Unified diff