1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2021 NVIDIA Corporation & Affiliates
14 #include <rte_common.h>
15 #include <rte_malloc.h>
16 #include <rte_memory.h>
18 #include <rte_ether.h>
19 #include <rte_ethdev.h>
20 #include <rte_mempool.h>
23 #include <rte_gpudev.h>
31 usage(const char *prog_name)
33 printf("%s [EAL options] --\n",
38 args_parse(int argc, char **argv)
44 static struct option lgopts[] = {
45 { "help", 0, 0, ARG_HELP},
51 while ((opt = getopt_long(argc, argvopt, "",
52 lgopts, &opt_idx)) != EOF) {
59 rte_exit(EXIT_FAILURE, "Invalid option: %s\n", argv[optind]);
66 main(int argc, char **argv)
71 struct rte_gpu_info ginfo;
74 ret = rte_eal_init(argc, argv);
76 rte_exit(EXIT_FAILURE, "EAL init failed\n");
80 args_parse(argc, argv);
84 nb_gpus = rte_gpu_count_avail();
85 printf("\n\nDPDK found %d GPUs:\n", nb_gpus);
86 RTE_GPU_FOREACH(gpu_id)
88 if (rte_gpu_info_get(gpu_id, &ginfo))
89 rte_exit(EXIT_FAILURE, "rte_gpu_info_get error - bye\n");
91 printf("\tGPU ID %d\n\t\tparent ID %d GPU Bus ID %s NUMA node %d Tot memory %.02f MB, Tot processors %d\n",
96 (((float)ginfo.total_memory)/(float)1024)/(float)1024,
102 /* clean up the EAL */