From e3bbc7c7a6a66de4f2db066640f01a6cef80a485 Mon Sep 17 00:00:00 2001 From: Peter Andreas Entschev Date: Thu, 22 Sep 2022 12:52:37 -0700 Subject: [PATCH] Remove duplicate code in vectorAddMMAP example The code to determine granularity is duplicated, immediately after perforing that check, the same code exists. The second entry is being eliminated by this change. --- examples/0_Introduction/vectorAddMMAP_test.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/examples/0_Introduction/vectorAddMMAP_test.py b/examples/0_Introduction/vectorAddMMAP_test.py index 9a6a41ce23b..b492e8a128a 100644 --- a/examples/0_Introduction/vectorAddMMAP_test.py +++ b/examples/0_Introduction/vectorAddMMAP_test.py @@ -80,16 +80,6 @@ def simpleMallocMultiDeviceMmap(size, residentDevices, mappingDevices, align = 0 if min_granularity < granularity: min_granularity = granularity - # Get the minimum granularity needed for the accessing devices - # (the max of the minimum granularity of each participating device) - for device in residentDevices: - prop.location.id = device - status, granularity = cuda.cuMemGetAllocationGranularity(prop, cuda.CUmemAllocationGranularity_flags.CU_MEM_ALLOC_GRANULARITY_MINIMUM) - if status != cuda.CUresult.CUDA_SUCCESS: - return status, None, None - if min_granularity < granularity: - min_granularity = granularity - # Round up the size such that we can evenly split it into a stripe size tha meets the granularity requirements # Essentially size = N * residentDevices.size() * min_granularity is the requirement, # since each piece of the allocation will be stripeSize = N * min_granularity