Révision 235

TrouNoir/TrouNoir.py (revision 235)
1758 1758
    Method=InputCL['Method']
1759 1759
    TrackPoints=InputCL['TrackPoints']
1760 1760
    Physics=InputCL['Physics']
1761
    Threads=InputCL['Threads']
1761 1762

  
1762 1763
    PhysicsList=DictionariesAPI()
1763 1764
    
......
1819 1820
                    numpy.float32(ExternalRadius),
1820 1821
                    numpy.float32(Angle),
1821 1822
                    numpy.int32(Line),
1822
                    grid=(zImage.shape[0]/32,zImage.shape[1]/32),
1823
                    block=(32,32,1))
1823
                    grid=(zImage.shape[0]/32,zImage.shape[1]/Threads),
1824
                    block=(Threads,Threads,1))
1824 1825
    elif Method=='EachCircle':
1825 1826
        EachCircleCU(zImageCU,fImageCU,
1826 1827
                   numpy.float32(Mass),
......
1828 1829
                   numpy.float32(ExternalRadius),
1829 1830
                   numpy.float32(Angle),
1830 1831
                   numpy.int32(Line),
1831
                   grid=(zImage.shape[0]/32/2,1),
1832
                   block=(32,1,1))
1832
                   grid=(zImage.shape[0]/Threads/2,1),
1833
                   block=(Threads,1,1))
1833 1834
    elif Method=='Original':
1834 1835
        OriginalCU(zImageCU,fImageCU,
1835 1836
                   numpy.uint32(zImage.shape[0]/2),
......
1847 1848
                     numpy.float32(ExternalRadius),
1848 1849
                     numpy.float32(Angle),
1849 1850
                     numpy.int32(Line),
1850
                     grid=(Trajectories.shape[0]/32,1),
1851
                     block=(32,1,1))
1851
                     grid=(Trajectories.shape[0]/Threads,1),
1852
                     block=(Threads,1,1))
1852 1853
        
1853 1854
        CircleCU(TrajectoriesCU,IdLastCU,zImageCU,fImageCU,
1854 1855
                 numpy.float32(Mass),
......
1856 1857
                 numpy.float32(ExternalRadius),
1857 1858
                 numpy.float32(Angle),
1858 1859
                 numpy.int32(Line),
1859
                 grid=(Trajectories.shape[0]/32,zImage.shape[0]*4/32),
1860
                 block=(32,32,1))
1860
                 grid=(Trajectories.shape[0]/Threads,zImage.shape[0]*4/Threads),
1861
                 block=(Threads,Threads,1))
1861 1862
    else:
1862 1863
        TrajectoryCU(TrajectoriesCU,IdLastCU,
1863 1864
                     numpy.float32(Mass),
......
1865 1866
                     numpy.float32(ExternalRadius),
1866 1867
                     numpy.float32(Angle),
1867 1868
                     numpy.int32(Line),
1868
                     grid=(Trajectories.shape[0]/32,1),
1869
                     block=(32,1,1))
1869
                     grid=(Trajectories.shape[0]/Threads,1),
1870
                     block=(Threads,1,1))
1870 1871
        
1871 1872
        PixelCU(zImageCU,fImageCU,TrajectoriesCU,IdLastCU,
1872 1873
                numpy.uint32(Trajectories.shape[0]),
......
1875 1876
                numpy.float32(ExternalRadius),
1876 1877
                numpy.float32(Angle),
1877 1878
                numpy.int32(Line),
1878
                grid=(zImage.shape[0]/32,zImage.shape[1]/32,1),
1879
                block=(32,32,1))
1879
                grid=(zImage.shape[0]/Threads,zImage.shape[1]/Threads,1),
1880
                block=(Threads,Threads,1))
1880 1881

  
1881 1882
    Context.synchronize()
1882 1883

  
......
1927 1928
    Physics='Einstein'
1928 1929
    # No output as image
1929 1930
    NoImage = False
1931
    # Threads in CUDA
1932
    Threads = 32
1930 1933
    
1931
    HowToUse='%s -h [Help] -b [BlackBodyEmission] -n [NoImage] -p <Einstein/Newton> -s <SizeInPixels> -m <Mass> -i <DiscInternalRadius> -x <DiscExternalRadius> -a <AngleAboveDisc> -d <DeviceId> -c <Greyscale/Red2Yellow> -g <CUDA/OpenCL> -t <EachPixel/TrajectoCircle/TrajectoPixel/EachCircle/Original> -v <FP32/FP64>'
1934
    HowToUse='%s -h [Help] -b [BlackBodyEmission] -n [NoImage] -p <Einstein/Newton> -s <SizeInPixels> -m <Mass> -i <DiscInternalRadius> -x <DiscExternalRadius> -a <AngleAboveDisc> -d <DeviceId> -c <Greyscale/Red2Yellow> -g <CUDA/OpenCL> -o <EachPixel/TrajectoCircle/TrajectoPixel/EachCircle/Original> -t <ThreadsInCuda> -v <FP32/FP64>'
1932 1935

  
1933 1936
    try:
1934
        opts, args = getopt.getopt(sys.argv[1:],"hbns:m:i:x:a:d:g:v:t:c:p:",["blackbody","noimage","camera","size=","mass=","internal=","external=","angle=","device=","gpustyle=","variabletype=","method=","colors=","physics="])
1937
        opts, args = getopt.getopt(sys.argv[1:],"hbns:m:i:x:a:d:g:v:o:t:c:p:",["blackbody","noimage","camera","size=","mass=","internal=","external=","angle=","device=","gpustyle=","variabletype=","method=","threads=","colors=","physics="])
1935 1938
    except getopt.GetoptError:
1936 1939
        print(HowToUse % sys.argv[0])
1937 1940
        sys.exit(2)
......
1994 1997
            BlackBody = True
1995 1998
        elif opt in ("-n", "--noimage"):
1996 1999
            NoImage = True
1997
        elif opt in ("-t", "--method"):
2000
        elif opt in ("-o", "--method"):
1998 2001
            Method = arg
2002
        elif opt in ("-t", "--threads"):
2003
            Threads = int(arg)
1999 2004
        elif opt in ("-c", "--colors"):
2000 2005
            Colors = arg
2001 2006
        elif opt in ("-p", "--physics"):
......
2069 2074
    InputCL['Method']=Method
2070 2075
    InputCL['TrackPoints']=TrackPoints
2071 2076
    InputCL['Physics']=Physics
2077
    InputCL['Threads']=Threads
2072 2078

  
2073 2079
    if GpuStyle=='OpenCL':
2074 2080
        duration=BlackHoleCL(zImage,fImage,InputCL)
TrouNoir/BenchTrouNoir.sh (revision 235)
15 15
echo -e "Experience : $LINE $METHOD $DEVICE $GPU"
16 16
seq $SEQ | while read POWER ; do
17 17
    SIZE=$((2**$POWER))
18
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -b -s $SIZE -t $METHOD >>$LOGFILE 2>&1 
18
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -b -s $SIZE -o $METHOD >>$LOGFILE 2>&1 
19 19
done
20 20
METHOD=TrajectoCircle
21 21
echo -e "Experience : $LINE $METHOD" >>$LOGFILE
22 22
echo -e "Experience : $LINE $METHOD $DEVICE $GPU"
23 23
seq $SEQ | while read POWER ; do
24 24
    SIZE=$((2**$POWER))
25
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -b -s $SIZE -t $METHOD >>$LOGFILE 2>&1 
25
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -b -s $SIZE -o $METHOD >>$LOGFILE 2>&1 
26 26
done
27 27
METHOD=EachPixel
28 28
echo -e "Experience : $LINE $METHOD" >>$LOGFILE
29 29
echo -e "Experience : $LINE $METHOD $DEVICE $GPU"
30 30
seq $SEQ | while read POWER ; do
31 31
    SIZE=$((2**$POWER))
32
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -b -s $SIZE -t $METHOD >>$LOGFILE 2>&1 
32
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -b -s $SIZE -o $METHOD >>$LOGFILE 2>&1 
33 33
done
34 34
LINE=MONO
35 35
METHOD=TrajectoPixel
......
37 37
echo -e "Experience : $LINE $METHOD $DEVICE $GPU"
38 38
seq $SEQ | while read POWER ; do
39 39
    SIZE=$((2**$POWER))
40
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -s $SIZE -t $METHOD >>$LOGFILE 2>&1 
40
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -s $SIZE -o $METHOD >>$LOGFILE 2>&1 
41 41
done
42 42
METHOD=TrajectoCircle
43 43
echo -e "Experience : $LINE $METHOD" >>$LOGFILE
44 44
echo -e "Experience : $LINE $METHOD $DEVICE $GPU"
45 45
seq $SEQ | while read POWER ; do
46 46
    SIZE=$((2**$POWER))
47
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -s $SIZE -t $METHOD >>$LOGFILE 2>&1 
47
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -s $SIZE -o $METHOD >>$LOGFILE 2>&1 
48 48
done
49 49
METHOD=EachPixel
50 50
echo -e "Experience : $LINE $METHOD" >>$LOGFILE
51 51
echo -e "Experience : $LINE $METHOD $DEVICE $GPU"
52 52
seq $SEQ | while read POWER ; do
53 53
    SIZE=$((2**$POWER))
54
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -s $SIZE -t $METHOD >>$LOGFILE 2>&1 
54
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -s $SIZE -o $METHOD >>$LOGFILE 2>&1 
55 55
done
56 56
LINE=BB
57 57
METHOD=EachCircle
......
59 59
echo -e "Experience : $LINE $METHOD $DEVICE $GPU"
60 60
seq $SEQ | while read POWER ; do
61 61
    SIZE=$((2**$POWER))
62
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -s $SIZE -t $METHOD >>$LOGFILE 2>&1 
62
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -s $SIZE -o $METHOD >>$LOGFILE 2>&1 
63 63
done
64 64
LINE=MONO
65 65
METHOD=EachCircle
......
67 67
echo -e "Experience : $LINE $METHOD $DEVICE $GPU"
68 68
seq $SEQ | while read POWER ; do
69 69
    SIZE=$((2**$POWER))
70
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -s $SIZE -t $METHOD >>$LOGFILE 2>&1 
70
    seq 1 1 10 | xargs -I TOTO /usr/bin/time python ./TrouNoir.py -d $DEVICE -g $GPU -n -s $SIZE -o $METHOD >>$LOGFILE 2>&1 
71 71
done

Formats disponibles : Unified diff