Révision 239

Pi/XPU/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))
Pi/XPU/PiXpuMPI.py (revision 239)
73 73
        Fit=False
74 74
        # Marsaglia RNG
75 75
        RNG='MWC'
76
        # Seeds
77
        Seeds=110271,101008
76 78
        # Value type : INT32, INT64, FP32, FP64
77 79
        ValueType='FP32'
78 80
        # Inside based on If
......
251 253
                for Device in Devices[1:]:
252 254
                    print("Send to device %i on rank %i" % (Device,r))
253 255
                    InputCL['Device']=Device
256
                    DeltaD=Device-min(Devices)+r+1
257
                    DeltaS=(DeltaD-1+r)*524287
258
                    InputCL['Seeds']=numpy.uint32(Seeds[0]*DeltaD+DeltaS),numpy.uint32(Seeds[1]*DeltaD+DeltaS)
254 259
                    comm.send('CONTINUE',dest=r,tag=11)
255 260
                    comm.send(InputCL,dest=r,tag=11)
256 261
                    r+=1
257 262

  
258 263
                # Compute on rank 0
259 264
                print("Compute on rank 0")
265
                DeltaD=Device-min(Devices)+1
266
                DeltaS=(DeltaD-1)*524287
267
                InputCL['Seeds']=numpy.uint32(Seeds[0]*DeltaD+DeltaS),numpy.uint32(Seeds[1]*DeltaD+DeltaS)
260 268
                InputCL['Device']=Devices[0]
261 269

  
262 270
                if GpuStyle=='CUDA':
Pi/XPU/PiXpuThreads.py (revision 239)
76 76
    Fit=False
77 77
    # Marsaglia RNG
78 78
    RNG='MWC'
79
    # Seeds
80
    Seeds=110271,101008
79 81
    # Value type : INT32, INT64, FP32, FP64
80 82
    ValueType='FP32'
81 83
    # Inside based on If
......
194 196
            for platform in cl.get_platforms():
195 197
                for device in platform.get_devices():
196 198
                    #deviceType=cl.device_type.to_string(device.type)
197
                    deviceType="*PU"
199
                    deviceType="xPU"
198 200
                    print("Device #%i from %s of type %s : %s" % (Id,platform.vendor.lstrip().rstrip(),deviceType,device.name.lstrip().rstrip()))
199 201

  
200 202
                    if Id in Devices:
......
241 243
            time_start=time.time()
242 244

  
243 245
            for Device in Devices:
246
                DeltaD=Device-min(Devices)+1
247
                DeltaS=(DeltaD-1)*524287
244 248
                InputCL={}
245 249
                InputCL['Iterations']=IterationsMP
246 250
                InputCL['Steps']=1
......
248 252
                InputCL['Threads']=Threads
249 253
                InputCL['Device']=Device
250 254
                InputCL['RNG']=RNG
255
                InputCL['Seeds']=numpy.uint32(Seeds[0]*DeltaD+DeltaS),numpy.uint32(Seeds[1]*DeltaD+DeltaS)
251 256
                InputCL['ValueType']=ValueType
252 257
                InputCL['IfThen']=IfThen
253 258
                if GpuStyle=='CUDA':

Formats disponibles : Unified diff