Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update VectorCopy.cpp #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions examples/snack/vector_copy/VectorCopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@ int main(int argc, char **argv)
//Setup kernel arguments
int* in=(int*)malloc(1024*1024*4);
int* out=(int*)malloc(1024*1024*4);
memset(out, 0, 1024*1024*4);
memset(in, 1, 1024*1024*4);

Launch_params_t lparm={ .ndim=1, .gdims={1024*1024}, .ldims={256} };
vcopy(out,in,lparm);
memset(out, -1, 1024*1024*4);
for(int i=0; i<1024*1024; i++)
in[i] = i;

Launch_params_t lparm={ .ndim=1, .gdims={1024*1024}, .ldims={256} };
vcopy(in, out, lparm);

//Validate
bool valid=true;
int failIndex=0;
for(int i=0; i<1024*1024; i++) {
if(out[i]!=in[i]) {
for(int i=0; i<1024*1024; i++)
{
int in_i = in[i];
int out_i = out[i];
if(out_i!=in_i) {
failIndex=i;
valid=false;
break;
Expand All @@ -38,4 +42,3 @@ int main(int argc, char **argv)

return 0;
}