taichi_1

Productive & portable programming language for high-performance, sparse & differentiable computing on CPUs & GPUs

问题:
1) git clone的应用            (git bash 工具)
2) AMD HD8570显卡是否支持GPU,本人的电脑是Lenovo G500(HD8570m显卡是2013年发布的 )
3) 相关Python包的安装  pip install PackageName (如:  pip install numpy)
4) 编译显示

https://mp.weixin.qq.com/s/m_gQJ5KxhB_ER-01brXXyQ
https://github.com/taichi-dev/taichi


如上图,本来准备配置一下的,再次试试时,又可以正常git clone了.

 

 

 

 

待检查调试......

import taichi as ti

# Run on  GPU by default
#ti.init(arch=ti.gpu) 
ti.init(arch=ti.cuda)
n = 320
pixels = ti.field(dtype=float,shape=(n*2,n))

@ti.func
def complex_sqr(z):
	return ti.Vector([z[0]**2-z[1]**2,*z[1]*z[0]*2])

@ti.kernel
def paint(t: float):
	for i,j in pixels:
		c = ti.Vector([-0.8, ti.cos(t)*0.2])
		z = ti.Vector([i/n-1, j/n-0.5])*2
		iterations = 0
		while z.norm() < 20 and iterations <50:
			z = complex_sqr(z) + c
			interations +=1
		pixels[i,j] = 1 - iterations * 0.02

gui = ti.GUI("Julia Set", res=(n*2,n))
for i in range(1000000):
	paint(i*0.03)
	gui.set_image(pixels)
	gui.show()

 

posted @ 2021-05-03 22:44  CDPJ  阅读(70)  评论(0编辑  收藏  举报