Skip to content

Commit

Permalink
Add a simple test to load the AlpakaService
Browse files Browse the repository at this point in the history
  • Loading branch information
fwyzard committed Jun 28, 2024
1 parent 6bfad55 commit 3830ca7
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 0 deletions.
18 changes: 18 additions & 0 deletions HeterogeneousCore/AlpakaServices/test/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- test the AlpakaService for the CPU serial backend -->
<test name="testAlpakaServiceSerialSync" command="cmsRun ${LOCALTOP}/src/HeterogeneousCore/AlpakaServices/test/testAlpakaServiceSerialSync.py">
<use name="HeterogeneousCore/AlpakaServices"/>
</test>

<!-- test the AlpakaService for the CUDA backend -->
<test name="testAlpakaServiceCudaAsync" command="cmsRun ${LOCALTOP}/src/HeterogeneousCore/AlpakaServices/test/testAlpakaServiceCudaAsync.py">
<!-- dependence only to trigger the unit test when NVIDIA GPU is (expected to be) present -->
<use name="cuda"/>
<use name="HeterogeneousCore/AlpakaServices"/>
</test>

<!-- test the AlpakaService for the ROCm backend -->
<test name="testAlpakaServiceROCmAsync" command="cmsRun ${LOCALTOP}/src/HeterogeneousCore/AlpakaServices/test/testAlpakaServiceROCmAsync.py">
<!-- dependence only to trigger the unit test when AMD GPU is (expected to be) present -->
<use name="rocm"/>
<use name="HeterogeneousCore/AlpakaServices"/>
</test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process( "TEST" )

process.options = cms.untracked.PSet(
numberOfThreads = cms.untracked.uint32( 4 ),
numberOfStreams = cms.untracked.uint32( 0 ),
)

process.load('FWCore.MessageService.MessageLogger_cfi')
process.MessageLogger.CUDAService = {}
process.MessageLogger.AlpakaService = {}

process.load('HeterogeneousCore.CUDAServices.CUDAService_cfi')

from HeterogeneousCore.AlpakaServices.AlpakaServiceCudaAsync_cfi import AlpakaServiceCudaAsync as _AlpakaServiceCudaAsync
process.AlpakaServiceCudaAsync = _AlpakaServiceCudaAsync.clone(
verbose = True,
hostAllocator = dict(
binGrowth = 2,
minBin = 8, # 256 bytes
maxBin = 30, # 1 GB
maxCachedBytes = 64*1024*1024*1024, # 64 GB
maxCachedFraction = 0.8, # or 80%, whatever is less
fillAllocations = True,
fillAllocationValue = 0xA5,
fillReallocations = True,
fillReallocationValue = 0x69,
fillDeallocations = True,
fillDeallocationValue = 0x5A,
fillCaches = True,
fillCacheValue = 0x96
),
deviceAllocator = dict(
binGrowth = 2,
minBin = 8, # 256 bytes
maxBin = 30, # 1 GB
maxCachedBytes = 8*1024*1024*1024, # 8 GB
maxCachedFraction = 0.8, # or 80%, whatever is less
fillAllocations = True,
fillAllocationValue = 0xA5,
fillReallocations = True,
fillReallocationValue = 0x69,
fillDeallocations = True,
fillDeallocationValue = 0x5A,
fillCaches = True,
fillCacheValue = 0x96
)
)

process.source = cms.Source("EmptySource")

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32( 0 )
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process( "TEST" )

process.options = cms.untracked.PSet(
numberOfThreads = cms.untracked.uint32( 4 ),
numberOfStreams = cms.untracked.uint32( 0 ),
)

process.load('FWCore.MessageService.MessageLogger_cfi')
process.MessageLogger.ROCmService = {}
process.MessageLogger.AlpakaService = {}

process.load('HeterogeneousCore.ROCmServices.ROCmService_cfi')

from HeterogeneousCore.AlpakaServices.AlpakaServiceROCmAsync_cfi import AlpakaServiceROCmAsync as _AlpakaServiceROCmAsync
process.AlpakaServiceROCmAsync = _AlpakaServiceROCmAsync.clone(
verbose = True,
hostAllocator = cms.untracked.PSet(
binGrowth = cms.untracked.uint32(2),
minBin = cms.untracked.uint32(8),
maxBin = cms.untracked.uint32(30),
maxCachedBytes = cms.untracked.uint64(0),
maxCachedFraction = cms.untracked.double(0.8),
fillAllocations = cms.untracked.bool(True),
fillAllocationValue = cms.untracked.uint32(165),
fillReallocations = cms.untracked.bool(True),
fillReallocationValue = cms.untracked.uint32(90),
fillDeallocations = cms.untracked.bool(True),
fillDeallocationValue = cms.untracked.uint32(105),
fillCaches = cms.untracked.bool(True),
fillCacheValue = cms.untracked.uint32(150)
),
deviceAllocator = cms.untracked.PSet(
binGrowth = cms.untracked.uint32(2),
minBin = cms.untracked.uint32(8),
maxBin = cms.untracked.uint32(30),
maxCachedBytes = cms.untracked.uint64(0),
maxCachedFraction = cms.untracked.double(0.8),
fillAllocations = cms.untracked.bool(True),
fillAllocationValue = cms.untracked.uint32(165),
fillReallocations = cms.untracked.bool(True),
fillReallocationValue = cms.untracked.uint32(90),
fillDeallocations = cms.untracked.bool(True),
fillDeallocationValue = cms.untracked.uint32(105),
fillCaches = cms.untracked.bool(True),
fillCacheValue = cms.untracked.uint32(150)
)
)

process.source = cms.Source("EmptySource")

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32( 0 )
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process( "TEST" )

process.options = cms.untracked.PSet(
numberOfThreads = cms.untracked.uint32( 4 ),
numberOfStreams = cms.untracked.uint32( 0 ),
)

process.load('FWCore.MessageService.MessageLogger_cfi')
process.MessageLogger.AlpakaService = {}

from HeterogeneousCore.AlpakaServices.AlpakaServiceSerialSync_cfi import AlpakaServiceSerialSync as _AlpakaServiceSerialSync
process.AlpakaServiceSerialSync = _AlpakaServiceSerialSync.clone(
verbose = True,
hostAllocator = cms.untracked.PSet(
binGrowth = cms.untracked.uint32(2),
minBin = cms.untracked.uint32(8),
maxBin = cms.untracked.uint32(30),
maxCachedBytes = cms.untracked.uint64(0),
maxCachedFraction = cms.untracked.double(0.8),
fillAllocations = cms.untracked.bool(True),
fillAllocationValue = cms.untracked.uint32(165),
fillReallocations = cms.untracked.bool(True),
fillReallocationValue = cms.untracked.uint32(90),
fillDeallocations = cms.untracked.bool(True),
fillDeallocationValue = cms.untracked.uint32(105),
fillCaches = cms.untracked.bool(True),
fillCacheValue = cms.untracked.uint32(150)
),
deviceAllocator = cms.untracked.PSet(
binGrowth = cms.untracked.uint32(2),
minBin = cms.untracked.uint32(8),
maxBin = cms.untracked.uint32(30),
maxCachedBytes = cms.untracked.uint64(0),
maxCachedFraction = cms.untracked.double(0.8),
fillAllocations = cms.untracked.bool(True),
fillAllocationValue = cms.untracked.uint32(165),
fillReallocations = cms.untracked.bool(True),
fillReallocationValue = cms.untracked.uint32(90),
fillDeallocations = cms.untracked.bool(True),
fillDeallocationValue = cms.untracked.uint32(105),
fillCaches = cms.untracked.bool(True),
fillCacheValue = cms.untracked.uint32(150)
)
)

process.source = cms.Source("EmptySource")

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32( 0 )
)

0 comments on commit 3830ca7

Please sign in to comment.