Révision 239 Pi/XPU/PiXPU.py
| PiXPU.py (revision 239) | ||
|---|---|---|
| 428 | 428 |
RNG=InputCU['RNG'] |
| 429 | 429 |
ValueType=InputCU['ValueType'] |
| 430 | 430 |
TestType=InputCU['IfThen'] |
| 431 |
Seeds=InputCU['Seeds'] |
|
| 431 | 432 |
|
| 432 | 433 |
Marsaglia,Computing,Test=DictionariesAPI() |
| 433 | 434 |
|
| ... | ... | |
| 479 | 480 |
try: |
| 480 | 481 |
MetropolisHybridCU(circleCU, |
| 481 | 482 |
numpy.uint64(iterationsCU), |
| 482 |
numpy.uint32(110271), |
|
| 483 |
numpy.uint32(101008), |
|
| 484 |
# numpy.uint32(nprnd(2**32)), |
|
| 485 |
# numpy.uint32(nprnd(2**32)), |
|
| 483 |
numpy.uint32(Seeds[0]), |
|
| 484 |
numpy.uint32(Seeds[1]), |
|
| 486 | 485 |
grid=(blocks,1),block=(threads,1,1)) |
| 487 | 486 |
except: |
| 488 | 487 |
print("Crash during CUDA call")
|
| ... | ... | |
| 514 | 513 |
RNG=InputCL['RNG'] |
| 515 | 514 |
ValueType=InputCL['ValueType'] |
| 516 | 515 |
TestType=InputCL['IfThen'] |
| 516 |
Seeds=InputCL['Seeds'] |
|
| 517 | 517 |
|
| 518 | 518 |
Marsaglia,Computing,Test=DictionariesAPI() |
| 519 |
|
|
| 519 |
|
|
| 520 | 520 |
# Initialisation des variables en les CASTant correctement |
| 521 | 521 |
Id=0 |
| 522 | 522 |
HasXPU=False |
| ... | ... | |
| 527 | 527 |
print("CPU/GPU selected: ",device.name.lstrip())
|
| 528 | 528 |
HasXPU=True |
| 529 | 529 |
Id+=1 |
| 530 |
print(Id) |
|
| 530 | 531 |
|
| 531 | 532 |
if HasXPU==False: |
| 532 | 533 |
print("No XPU #%i found in all of %i devices, sorry..." % (Device,Id-1))
|
| 533 |
sys.exit()
|
|
| 534 |
sys.exit() |
|
| 534 | 535 |
|
| 535 |
|
|
| 536 |
print(XPU) |
|
| 536 | 537 |
# Je cree le contexte et la queue pour son execution |
| 537 | 538 |
try: |
| 538 | 539 |
ctx = cl.Context(devices=[XPU]) |
| ... | ... | |
| 562 | 563 |
CLLaunch=MetropolisCL.MainLoopGlobal(queue,(blocks,),None, |
| 563 | 564 |
circleCL, |
| 564 | 565 |
numpy.uint64(iterationsCL), |
| 565 |
numpy.uint32(110271), |
|
| 566 |
numpy.uint32(101008)) |
|
| 567 |
# numpy.uint32(nprnd(2**32)), |
|
| 568 |
# numpy.uint32(nprnd(2**32))) |
|
| 566 |
numpy.uint32(Seeds[0]), |
|
| 567 |
numpy.uint32(Seeds[1])) |
|
| 569 | 568 |
else: |
| 570 | 569 |
CLLaunch=MetropolisCL.MainLoopHybrid(queue,(jobs,),(threads,), |
| 571 | 570 |
circleCL, |
| 572 | 571 |
numpy.uint64(iterationsCL), |
| 573 |
numpy.uint32(110271), |
|
| 574 |
numpy.uint32(101008)) |
|
| 575 |
# numpy.uint32(nprnd(2**32)), |
|
| 576 |
# numpy.uint32(nprnd(2**32))) |
|
| 572 |
numpy.uint32(Seeds[0]), |
|
| 573 |
numpy.uint32(Seeds[1])) |
|
| 577 | 574 |
|
| 578 | 575 |
CLLaunch.wait() |
| 579 | 576 |
cl.enqueue_copy(queue, circle, circleCL).wait() |
| ... | ... | |
| 704 | 701 |
RNG='MWC' |
| 705 | 702 |
# Value type : INT32, INT64, FP32, FP64 |
| 706 | 703 |
ValueType='FP32' |
| 704 |
# Seeds for RNG |
|
| 705 |
Seeds=110271,101008 |
|
| 707 | 706 |
|
| 708 | 707 |
HowToUse='%s -o (Out of Core Metrology) -c (Print Curves) -k (Case On IfThen) -d <DeviceId> -g <CUDA/OpenCL> -i <Iterations> -b <BlocksBegin> -e <BlocksEnd> -s <BlocksStep> -f <ThreadsFirst> -l <ThreadsLast> -t <ThreadssTep> -r <RedoToImproveStats> -m <SHR3/CONG/MWC/KISS> -v <INT32/INT64/FP32/FP64>' |
| 709 | 708 |
|
| ... | ... | |
| 874 | 873 |
InputCU['Threads']=Threads |
| 875 | 874 |
InputCU['Device']=Devices[0] |
| 876 | 875 |
InputCU['RNG']=RNG |
| 876 |
InputCU['Seeds']=Seeds |
|
| 877 | 877 |
InputCU['ValueType']=ValueType |
| 878 | 878 |
InputCU['IfThen']=IfThen |
| 879 | 879 |
OutputCU=MetropolisCuda(InputCU) |
| ... | ... | |
| 891 | 891 |
InputCL['Threads']=Threads |
| 892 | 892 |
InputCL['Device']=Devices[0] |
| 893 | 893 |
InputCL['RNG']=RNG |
| 894 |
InputCL['Seeds']=Seeds |
|
| 894 | 895 |
InputCL['ValueType']=ValueType |
| 895 | 896 |
InputCL['IfThen']=IfThen |
| 896 | 897 |
OutputCL=MetropolisOpenCL(InputCL) |
| ... | ... | |
| 911 | 912 |
InputCU['Threads']=Threads |
| 912 | 913 |
InputCU['Device']=Devices[0] |
| 913 | 914 |
InputCU['RNG']=RNG |
| 915 |
InputCU['Seeds']=Seeds |
|
| 914 | 916 |
InputCU['ValueType']=ValueType |
| 915 | 917 |
InputCU['IfThen']=IfThen |
| 916 | 918 |
OutputCU=MetropolisCuda(InputCU) |
| ... | ... | |
| 929 | 931 |
InputCL['Threads']=Threads |
| 930 | 932 |
InputCL['Device']=Devices[0] |
| 931 | 933 |
InputCL['RNG']=RNG |
| 934 |
InputCL['Seeds']=Seeds |
|
| 932 | 935 |
InputCL['ValueType']=ValueType |
| 933 | 936 |
InputCL['IfThen']=IfThen |
| 934 | 937 |
OutputCL=MetropolisOpenCL(InputCL) |
| ... | ... | |
| 940 | 943 |
Rate=NewIterations/Duration |
| 941 | 944 |
print("Pi estimation %.8f" % (4./NewIterations*Inside))
|
| 942 | 945 |
|
| 943 |
|
|
| 944 | 946 |
avgD=numpy.append(avgD,numpy.average(Duration)) |
| 945 | 947 |
medD=numpy.append(medD,numpy.median(Duration)) |
| 946 | 948 |
stdD=numpy.append(stdD,numpy.std(Duration)) |
Formats disponibles : Unified diff