@@ -46,25 +46,25 @@ def test_mfab_loop(make_mfab):
4646 # numpy representation: non-copying view, including the
4747 # guard/ghost region
4848 # note: in numpy, indices are in C-order!
49- marr_np = np . array ( marr , copy = False )
49+ marr_np = marr . to_numpy ( )
5050
5151 # check the values at start/end are the same: first component
5252 assert marr_np [0 , 0 , 0 , 0 ] == marr [bx .small_end ]
53- assert marr_np [0 , - 1 , - 1 , - 1 ] == marr [bx .big_end ]
53+ assert marr_np [- 1 , - 1 , - 1 , 0 ] == marr [bx .big_end ]
5454 # same check, but for all components
5555 for n in range (mfab .num_comp ):
5656 small_end_comp = list (bx .small_end ) + [n ]
5757 big_end_comp = list (bx .big_end ) + [n ]
58- assert marr_np [n , 0 , 0 , 0 ] == marr [small_end_comp ]
59- assert marr_np [n , - 1 , - 1 , - 1 ] == marr [big_end_comp ]
58+ assert marr_np [0 , 0 , 0 , n ] == marr [small_end_comp ]
59+ assert marr_np [- 1 , - 1 , - 1 , n ] == marr [big_end_comp ]
6060
6161 # now we do some faster assignments, using range based access
6262 # this should fail as out-of-bounds, but does not
6363 # does Numpy not check array access for non-owned views?
6464 # marr_np[24:200, :, :, :] = 42.
6565
6666 # all components and all indices set at once to 42
67- marr_np [:, :, :, : ] = 42.0
67+ marr_np [() ] = 42.0
6868
6969 # values in start & end still match?
7070 assert marr_np [0 , 0 , 0 , 0 ] == marr [bx .small_end ]
@@ -210,8 +210,7 @@ def test_mfab_ops_cuda_cupy(make_mfab_device):
210210 with cupy .profiler .time_range ("assign 3 [()]" , color_id = 0 ):
211211 for mfi in mfab_device :
212212 bx = mfi .tilebox ().grow (ngv )
213- marr = mfab_device .array (mfi )
214- marr_cupy = cp .array (marr , copy = False )
213+ marr_cupy = mfab_device .array (mfi ).to_cupy (order = "C" )
215214 # print(marr_cupy.shape) # 1, 32, 32, 32
216215 # print(marr_cupy.dtype) # float64
217216
@@ -244,8 +243,7 @@ def set_to_five(mm):
244243
245244 for mfi in mfab_device :
246245 bx = mfi .tilebox ().grow (ngv )
247- marr = mfab_device .array (mfi )
248- marr_cupy = cp .array (marr , copy = False )
246+ marr_cupy = mfab_device .array (mfi ).to_cupy (order = "C" )
249247
250248 # write and read into the marr_cupy
251249 fives_cp = set_to_five (marr_cupy )
@@ -266,8 +264,7 @@ def set_to_seven(x):
266264
267265 for mfi in mfab_device :
268266 bx = mfi .tilebox ().grow (ngv )
269- marr = mfab_device .array (mfi )
270- marr_cupy = cp .array (marr , copy = False )
267+ marr_cupy = mfab_device .array (mfi ).to_cupy (order = "C" )
271268
272269 # write and read into the marr_cupy
273270 set_to_seven (marr_cupy )
0 commit comments