diff --git a/projects/rocprofiler-compute/sample/vcopy.cpp b/projects/rocprofiler-compute/sample/vcopy.cpp index 91412e6180..7d5107ffe3 100644 --- a/projects/rocprofiler-compute/sample/vcopy.cpp +++ b/projects/rocprofiler-compute/sample/vcopy.cpp @@ -19,7 +19,7 @@ __global__ void vecCopy(double *a, double *b, double *c, int n,int stride) void usage() { - printf("\nUsage: vcopy [n] [blocksize]\n\n"); + printf("\nUsage: vcopy [n] [blocksize] [dev]\n\n"); exit(1); return; } @@ -45,12 +45,22 @@ int main( int argc, char* argv[] ) double *d_c; int stride = 1; + int devId = 0; - if(argc < 3) + if(argc < 4) usage(); n = atoi(argv[1]); blockSize = atoi(argv[2]); + devId = atoi(argv[3]); + + int numGpuDevices; + HIP_ASSERT(hipGetDeviceCount(&numGpuDevices)); + if(devId >= numGpuDevices) + devId = 0; + HIP_ASSERT(hipSetDevice(devId)); + + printf("vcopy testing on GCD %d\n", devId); assert(n > 0); assert(blockSize > 0);