-
Couldn't load subscription status.
- Fork 58
-
How to convert Array<T> to Vec<T>?
Beta Was this translation helpful? Give feedback.
All reactions
fn to_vec<T:HasAfEnum+Default+Clone>(array:&Array) -> Vec {
let mut vec = vec!(T::default();array.elements());
array.host(&mut vec);
return vec;
}
After calling function host, will vec still in gpu memory?
Replies: 1 comment 2 replies
-
fn to_vec<T:HasAfEnum+Default+Clone>(array:&Array) -> Vec {
let mut vec = vec!(T::default();array.elements());
array.host(&mut vec);
return vec;
}
After calling function host, will vec still in gpu memory?
Beta Was this translation helpful? Give feedback.
All reactions
-
host method only copies the contents from GPU to CPU. As long as the associated rust object( or af_array C handle) is live, the GPU memory stays. Host call doesn't remove the contents from GPU.
Beta Was this translation helpful? Give feedback.
All reactions
-
Many thanks
Beta Was this translation helpful? Give feedback.