diff --git a/sample/vcopy.cpp b/sample/vcopy.cpp index 7d5107ffe3..0eed48711a 100644 --- a/sample/vcopy.cpp +++ b/sample/vcopy.cpp @@ -2,6 +2,8 @@ #include #include #include +#include +using namespace std; #define HIP_ASSERT(x) (assert((x)==hipSuccess)) @@ -19,7 +21,7 @@ __global__ void vecCopy(double *a, double *b, double *c, int n,int stride) void usage() { - printf("\nUsage: vcopy [n] [blocksize] [dev]\n\n"); + printf("\nUsage: vcopy [n] [blocksize] {dev}\n\n"); exit(1); return; } @@ -47,12 +49,13 @@ int main( int argc, char* argv[] ) int stride = 1; int devId = 0; - if(argc < 4) + if(argc < 3) usage(); + if(argc > 3) + devId = atoi(argv[3]); n = atoi(argv[1]); blockSize = atoi(argv[2]); - devId = atoi(argv[3]); int numGpuDevices; HIP_ASSERT(hipGetDeviceCount(&numGpuDevices));