Révision 235 TrouNoir/TrouNoir.py
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) |
Formats disponibles : Unified diff