|
| 1 | +import FWCore.ParameterSet.Config as cms |
| 2 | + |
| 3 | +def customiseAlpakaServiceMemoryFilling(process): |
| 4 | + # load all variants of the AlpakaService |
| 5 | + # ProcessAcceleratorAlpaka will take care of removing the unused ones |
| 6 | + |
| 7 | + process.load('HeterogeneousCore.AlpakaServices.AlpakaServiceSerialSync_cfi') |
| 8 | + |
| 9 | + # load the CUDAService and the AlpakaService for the CUDA backend, if available |
| 10 | + try: |
| 11 | + process.load('HeterogeneousCore.CUDAServices.CUDAService_cfi') |
| 12 | + process.load('HeterogeneousCore.AlpakaServices.AlpakaServiceCudaAsync_cfi') |
| 13 | + except: |
| 14 | + pass |
| 15 | + |
| 16 | + # load the ROCmService and the AlpakaService for the ROCm backend, if available |
| 17 | + try: |
| 18 | + process.load('HeterogeneousCore.ROCmServices.ROCmService_cfi') |
| 19 | + process.load('HeterogeneousCore.AlpakaServices.AlpakaServiceROCmAsync_cfi') |
| 20 | + except: |
| 21 | + pass |
| 22 | + |
| 23 | + # enable junk memory filling for all AlpakaServices |
| 24 | + for name in process.services_(): |
| 25 | + if name.startswith('AlpakaService'): |
| 26 | + service = getattr(process, name) |
| 27 | + # host allocator |
| 28 | + service.hostAllocator.fillAllocations = True |
| 29 | + service.hostAllocator.fillAllocationValue = 0xB4 |
| 30 | + service.hostAllocator.fillReallocations = True |
| 31 | + service.hostAllocator.fillReallocationValue = 0x78 |
| 32 | + service.hostAllocator.fillDeallocations = True |
| 33 | + service.hostAllocator.fillDeallocationValue = 0x4B |
| 34 | + service.hostAllocator.fillCaches = True |
| 35 | + service.hostAllocator.fillCacheValue = 0x87 |
| 36 | + # device allocator |
| 37 | + service.deviceAllocator.fillAllocations = True |
| 38 | + service.deviceAllocator.fillAllocationValue = 0xA5 |
| 39 | + service.deviceAllocator.fillReallocations = True |
| 40 | + service.deviceAllocator.fillReallocationValue = 0x69 |
| 41 | + service.deviceAllocator.fillDeallocations = True |
| 42 | + service.deviceAllocator.fillDeallocationValue = 0x5A |
| 43 | + service.deviceAllocator.fillCaches = True |
| 44 | + service.deviceAllocator.fillCacheValue = 0x96 |
| 45 | + |
| 46 | + return process |
0 commit comments