@@ -292,7 +292,7 @@ class dtensor_impl : public tensor_i
292292 auto ptr = buff.ptr ;
293293 auto pylen = VPROD (buff.shape );
294294 assert (buff.itemsize == sizeof (T));
295- theTransceiver->reduce_all (ptr, DTYPE <T>::value , pylen, red_op (op));
295+ theTransceiver->reduce_all (ptr, dtype () , pylen, red_op (op));
296296 return create_dtensor (pvslice (), new_shape, ary, REPLICATED );
297297 }
298298
@@ -404,6 +404,7 @@ class dtensor_impl : public tensor_i
404404 NDSlice my_norm_slice = g_slc_view.map_slice (my_slice);
405405 std::cerr << " my_norm_slice: " << my_norm_slice << std::endl;
406406
407+ theTransceiver->barrier ();
407408 _set_slice (cast (val), my_norm_slice, this , my_slice);
408409 }
409410
@@ -431,9 +432,13 @@ class dtensor_impl : public tensor_i
431432 py::object get_slice (const NDSlice & slice) const
432433 {
433434 auto shp = slice.shape ();
434- auto out = create_dtensor (PVSlice (shp, NOSPLIT ), shp, DTYPE <T>::value, " empty" );
435- _set_slice (this , slice, cast (out), {shp});
436- return cast (out)->_pyarray ;
435+ // Create dtensor without creating id: do not use create_dtensor
436+ py::dict kwa;
437+ kwa[" dtype" ] = get_impl_dtype<T>();
438+ auto ary = _array_ns.attr (" empty" )(_make_tuple (shp), kwa);
439+ auto out = dtensor_impl<T>(PVSlice (shp, NOSPLIT ), shp, ary, theTransceiver->rank ());
440+ _set_slice (this , slice, &out, {shp});
441+ return out._pyarray ;
437442 }
438443
439444 std::string __repr__ () const
0 commit comments