Révision 135 NBody/NBody.py
| NBody.py (revision 135) | ||
|---|---|---|
| 44 | 44 |
#define MYFLOAT8 float8 |
| 45 | 45 |
#define MYFLOAT float |
| 46 | 46 |
#else |
| 47 |
#pragma OPENCL EXTENSION cl_khr_fp64: enable |
|
| 47 | 48 |
#define MYFLOAT4 double4 |
| 48 | 49 |
#define MYFLOAT8 double8 |
| 49 | 50 |
#define MYFLOAT double |
| ... | ... | |
| 441 | 442 |
t1=np.append(t1,[MyData[1][0],MyData[1][1],MyData[1][2]]) |
| 442 | 443 |
tL=np.append(tL,[MyData[-1][0],MyData[-1][1],MyData[-1][2]]) |
| 443 | 444 |
print("\nDuration on %s for each %s" % (Device,(time.time()-time_start)/Iterations))
|
| 445 |
|
|
| 446 |
if GraphSamples: |
|
| 447 |
t0=np.transpose(np.reshape(t0,(Iterations+1,3))) |
|
| 448 |
t1=np.transpose(np.reshape(t1,(Iterations+1,3))) |
|
| 449 |
tL=np.transpose(np.reshape(tL,(Iterations+1,3))) |
|
| 444 | 450 |
|
| 445 |
# t0=np.transpose(np.reshape(t0,(Iterations+1,3))) |
|
| 446 |
# t1=np.transpose(np.reshape(t1,(Iterations+1,3))) |
|
| 447 |
# tL=np.transpose(np.reshape(tL,(Iterations+1,3))) |
|
| 451 |
import matplotlib.pyplot as plt |
|
| 452 |
from mpl_toolkits.mplot3d import Axes3D |
|
| 448 | 453 |
|
| 449 |
# import matplotlib.pyplot as plt |
|
| 450 |
# from mpl_toolkits.mplot3d import Axes3D |
|
| 451 |
# |
|
| 452 |
# fig = plt.figure() |
|
| 453 |
# ax = fig.gca(projection='3d') |
|
| 454 |
# ax.scatter(t0[0],t0[1],t0[2], marker='^',color='blue') |
|
| 455 |
# ax.scatter(t1[0],t1[1],t1[2], marker='o',color='red') |
|
| 456 |
# ax.scatter(tL[0],tL[1],tL[2], marker='D',color='green') |
|
| 457 |
# |
|
| 458 |
# ax.set_xlabel('X Label')
|
|
| 459 |
# ax.set_ylabel('Y Label')
|
|
| 460 |
# ax.set_zlabel('Z Label')
|
|
| 461 |
# |
|
| 462 |
# plt.show() |
|
| 454 |
fig = plt.figure() |
|
| 455 |
ax = fig.gca(projection='3d') |
|
| 456 |
ax.scatter(t0[0],t0[1],t0[2], marker='^',color='blue') |
|
| 457 |
ax.scatter(t1[0],t1[1],t1[2], marker='o',color='red') |
|
| 458 |
ax.scatter(tL[0],tL[1],tL[2], marker='D',color='green') |
|
| 459 |
|
|
| 460 |
ax.set_xlabel('X Label')
|
|
| 461 |
ax.set_ylabel('Y Label')
|
|
| 462 |
ax.set_zlabel('Z Label')
|
|
| 463 |
|
|
| 464 |
plt.show() |
|
| 463 | 465 |
|
| 464 | 466 |
clData.release() |
| 465 | 467 |
clKinetic.release() |
Formats disponibles : Unified diff