Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perftest: Add GPU Touch Flag for Testing GPU Memory Interference with CUDA and OpenCL Support #302

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

yonatan786
Copy link

Enhances perftest with GPU memory testing capabilities, including:

  1. CUDA Enhancements:
  • Added support for GPU touch mode, requiring CUDA kernel launches to evaluate GPU memory access performance.
  • Introduced multiple memory types (DEVICE, MANAGED, MALLOC) selectable via the new cuda_mem_type flag.
  1. OpenCL Integration:
  • Enabled GPU memory testing with OpenCL by adding support for OpenCL memory management.
  • Introduced flags (use_opencl_flag, opencl_platform_id_flag) for OpenCL-specific configurations.
  1. gpu_touch Flag:
  • Introduced the -gpu_touch flag to control GPU memory access patterns with two modes:
  • once: GPU touches memory a single time during the test.
  • infinite: GPU continuously accesses memory throughout the test.

Yonatan Maman added 4 commits December 16, 2024 22:41
Implement support for multiple CUDA memory types including:
    - CUDA_MEM_DEVICE  (0) for device memory (default)
    - CUDA_MEM_MANAGED (1) for unified managed memory
    - CUDA_MEM_MALLOC  (4) for host memory allocated via malloc

Previously, only CUDA_MEM_DEVICE was supported as CUDA memory. This
change introduces a new flag (`cuda_mem_type`) to set the memory type
with the presented values.

Reviewed-by: Gal Shalom <GalShalom@Nvidia.com>
Signed-off-by: Yonatan Maman <Ymaman@Nvidia.com>
Introduce the `-gpu_touch` flag to control GPU memory access testing behavior.
The flag supports two modes:
    - `once`: The GPU touches the memory only once during the test process.
    - `infinite`: The GPU continuously touches the memory throughout the test.

This parameter will trigger migration of pages to the GPU, allowing for
evaluation of GPU memory access patterns and performance.

Reviewed-by: Gal Shalom <GalShalom@Nvidia.com>
Signed-off-by: Yonatan Maman <Ymaman@Nvidia.com>
Extend perftest to support OpenCL memory management, including:
 * Introduce new flags (`use_opencl_flag` and `opencl_platform_id_flag`)
   and update the parser to handle OpenCL-specific configurations.
 * Added support for gpu_touch parameter by OpenCL.

Reviewed-by: Gal Shalom <GalShalom@Nvidia.com>
Signed-off-by: Yonatan Maman <Ymaman@Nvidia.com>
Extend perftest to support GPU touch mode for CUDA memory and enable
CUDA kernel launches.
Note: CUDA kernels are required for CUDA GPU touch mode functionality.

Reviewed-by: Gal Shalom <GalShalom@Nvidia.com>
Signed-off-by: Yonatan Maman <Ymaman@Nvidia.com>
static int init_gpu(struct opencl_memory_ctx *ctx)
{
cl_platform_id platforms_id[NUM_PLATFORMS];
cl_device_id devices_id[NUM_PLATFORMS];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not possible to have more than NUM_PLATFORMS/NUM_DEVICES (5) on a server?

if (opencl_ctx->gpu_touch != GPU_NO_TOUCH) {
opencl_ctx->buffer_ctx = malloc(sizeof(struct buffer_ctx));
if (!opencl_ctx->buffer_ctx) {
printf("Failed to allocate context for gpu_touch\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about release the allocated addr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants