Run vcopy on a particular device

Signed-off-by: colramos-amd <colramos@amd.com>


[ROCm/rocprofiler-compute commit: 28338d86c0]
This commit is contained in:
colramos-amd
2022-11-10 10:11:40 -06:00
förälder 46f182a0b9
incheckning 272a60fd8d
+12 -2
Visa fil
@@ -19,7 +19,7 @@ __global__ void vecCopy(double *a, double *b, double *c, int n,int stride)
void usage() void usage()
{ {
printf("\nUsage: vcopy [n] [blocksize]\n\n"); printf("\nUsage: vcopy [n] [blocksize] [dev]\n\n");
exit(1); exit(1);
return; return;
} }
@@ -45,12 +45,22 @@ int main( int argc, char* argv[] )
double *d_c; double *d_c;
int stride = 1; int stride = 1;
int devId = 0;
if(argc < 3) if(argc < 4)
usage(); usage();
n = atoi(argv[1]); n = atoi(argv[1]);
blockSize = atoi(argv[2]); 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(n > 0);
assert(blockSize > 0); assert(blockSize > 0);