示例#1
0
axes.set_axis_off()
ax.set_axis_bgcolor((0.15, 0.15, 0.15))

axes.set_position([0, 0, 1, 1])

azimuth = 0
ax.view_init(elev=10., azim=azimuth)

scat1 = ax.scatter([], [], [], c="darkcyan", s=2, lw=0)
scat2 = ax.scatter([], [], [], c="darkolivegreen", s=2, lw=0)
scat3 = ax.scatter([], [], [], c="paleturquoise", s=2, lw=0)
scat4 = ax.scatter([], [], [], c="olive", s=2, lw=0)
scat5 = ax.scatter([], [], [], c="darkcyan", s=2, lw=0)
scat6 = ax.scatter([], [], [], c="darkolivegreen", s=2, lw=0)

progress_bar = progress_bar_init(num_frames-1)

old_end = time.time()

def animate(frame):
    global old_end
    start = old_end
    set_name = "out_%03d.csv" % frame

    data = hdf5_root[set_name]

    and_disk = data[:16384, :]
    mil_disk = data[16384:32768, :]
    and_bulg = data[32768:40960, :]
    mil_bulg = data[40960:49152, :]
    and_halo = data[49152:65536, :]
示例#2
0
# ============================= DATA CONTAINER ============================= #

file_name = "nbody.hdf5"
full_path = os.path.join(OUT_DIR, file_name)

hdf_root = h5py.File(full_path, "w")

# ============================ ACTUAL PROCESSING ============================ #

# Create two timers so we measure time
start = driver.Event()
end = driver.Event()

start.record()  # start timing

progress_bar = progress_bar_init(NUM_FRAMES-1)

for frame in range(NUM_FRAMES):
    # Start time measure
    pb_start = time.time()

    # Call the kernel on the card
    galaxyKernel(
        # inputs
        pos_gpu,
        vel_gpu,
        np.float32(0.1),

        # Grid definition -> number of blocks x number of blocks.
        grid=(int(NUM_BODIES / TILE_SIZE), 1, 1),
        # block definition -> number of threads x number of threads