Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to convert Array<T> to Vec<T>? #359

Answered by 3togo
3togo asked this question in Q&A
Discussion options

How to convert Array<T> to Vec<T>?

You must be logged in to vote

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

Comment options

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?

You must be logged in to vote
2 replies
Comment options

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.

Comment options

Many thanks

Answer selected by 9prady9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /