@hpx.create_action() def calculate(num_gil): for i in range(num_gil): giltest.calculate(262144 // num_gil) # 262144 is 2^18 return hpx.SUCCESS @hpx.create_action() def main(): time = np.zeros((18, )) for j in range(18): num_gil = 2**j start = hpx.time_now() and_lco = hpx.And(num_action) for i in range(num_action): calculate(hpx.HERE(), num_gil, rsync_lco=and_lco) and_lco.wait() current_time = hpx.time_elapsed_ms(start) print(current_time) time[j] = current_time print(time) time.dump("time.bin") hpx.exit() if __name__ == '__main__': hpx.init(sys.argv) hpx.run(main) hpx.finalize()
except RuntimeError: pass else: raise RuntimeError("Runtime error not raised!") try: test_memory[1, :2, 1].set(from_array, sync='rsync') except RuntimeError: pass else: raise RuntimeError("Runtime error not raised!") # test get and set on array with some dimension of size 1 test_memory_2 = hpx.GlobalMemory.alloc_local_at(2, (2, 2, 2, 2, 2), np.dtype(np.int), hpx.HERE()) from_array = np.array([[1, 2], [3, 4]]) test_memory_2[1, 1, 0, 1, :, :].set(from_array, sync='rsync') get_array = test_memory_2[1, 1, 0, :, :, :].get(sync='sync') assert np.array_equal(get_array[1], from_array) # test free test_memory.free_sync() hpx.exit() hpx.init() hpx.run(main) hpx.finalize()