Skip to content

Commit e589f4c

Browse files
sshaulnvHassanKhadour
authored andcommitted
Perftest: Update perftest parameters files to support cuda dma-buf test
Add the 'use_cuda_dmabuf' flag to the Perftest user parameters in order to enable the usege of CUDA DMA-BUF. Signed-off-by: Shmuel Shaul <[email protected]>
1 parent b0823b7 commit e589f4c

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/perftest_parameters.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,12 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
539539

540540
printf(" --use_cuda_bus_id=<cuda full BUS id>");
541541
printf(" Use CUDA specific device, based on its full PCIe address, for GPUDirect RDMA testing\n");
542+
543+
#ifdef HAVE_CUDA_DMABUF
544+
printf(" --use_cuda_dmabuf");
545+
printf(" Use CUDA DMA-BUF for GPUDirect RDMA testing\n");
546+
#endif
547+
542548
#endif
543549

544550
#ifdef HAVE_ROCM
@@ -749,6 +755,9 @@ static void init_perftest_params(struct perftest_parameters *user_param)
749755
#ifdef HAVE_CUDA
750756
user_param->use_cuda = 0;
751757
user_param->cuda_device_id = 0;
758+
#ifdef HAVE_CUDA_DMABUF
759+
user_param->use_cuda_dmabuf = 0;
760+
#endif
752761
#endif
753762
#ifdef HAVE_ROCM
754763
user_param->use_rocm = 0;
@@ -2128,6 +2137,9 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
21282137
#ifdef HAVE_CUDA
21292138
static int use_cuda_flag = 0;
21302139
static int use_cuda_bus_id_flag = 0;
2140+
#ifdef HAVE_CUDA_DMABUF
2141+
static int use_cuda_dmabuf_flag = 0;
2142+
#endif
21312143
#endif
21322144
#ifdef HAVE_ROCM
21332145
static int use_rocm_flag = 0;
@@ -2277,6 +2289,9 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
22772289
#ifdef HAVE_CUDA
22782290
{ .name = "use_cuda", .has_arg = 1, .flag = &use_cuda_flag, .val = 1},
22792291
{ .name = "use_cuda_bus_id", .has_arg = 1, .flag = &use_cuda_bus_id_flag, .val = 1},
2292+
#ifdef HAVE_CUDA_DMABUF
2293+
{ .name = "use_cuda_dmabuf", .has_arg = 0, .flag = &use_cuda_dmabuf_flag, .val = 1},
2294+
#endif
22802295
#endif
22812296
#ifdef HAVE_ROCM
22822297
{ .name = "use_rocm", .has_arg = 1, .flag = &use_rocm_flag, .val = 1},
@@ -2653,6 +2668,16 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
26532668
printf("Got PCIe address of: %s\n", user_param->cuda_device_bus_id);
26542669
use_cuda_bus_id_flag = 0;
26552670
}
2671+
#ifdef HAVE_CUDA_DMABUF
2672+
if (use_cuda_dmabuf_flag) {
2673+
user_param->use_cuda_dmabuf = 1;
2674+
if (!user_param->use_cuda) {
2675+
fprintf(stderr, "CUDA DMA-BUF cannot be used without CUDA\n");
2676+
return FAILURE;
2677+
}
2678+
use_cuda_dmabuf_flag = 0;
2679+
}
2680+
#endif
26562681
#endif
26572682
#ifdef HAVE_ROCM
26582683
if (use_rocm_flag) {

src/perftest_parameters.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,9 @@ struct perftest_parameters {
547547
int use_cuda;
548548
int cuda_device_id;
549549
char *cuda_device_bus_id;
550+
#ifdef HAVE_CUDA_DMABUF
551+
int use_cuda_dmabuf;
552+
#endif
550553
#endif
551554
#ifdef HAVE_ROCM
552555
int use_rocm;

0 commit comments

Comments
 (0)