diff --git a/examples/snack/vector_copy/VectorCopy.cpp b/examples/snack/vector_copy/VectorCopy.cpp index ec1e779..770566e 100644 --- a/examples/snack/vector_copy/VectorCopy.cpp +++ b/examples/snack/vector_copy/VectorCopy.cpp @@ -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; @@ -38,4 +42,3 @@ int main(int argc, char **argv) return 0; } -