Skip to content

Commit 0a1a87f

Browse files
authored
Merge pull request #48768 from makortel/removeSwitchProducerCUDA
Remove SwitchProducerCUDA
2 parents 2cf9550 + 22206d8 commit 0a1a87f

18 files changed

+3
-498
lines changed

HeterogeneousCore/AlpakaCore/README.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -427,25 +427,6 @@ process.producerGPU = cms.EDProducer("alpaka_cuda_async::ExampleAlpakaProducer",
427427
Obviously this kind of configuration can be run only on machines that provide the necessary hardware. The configuration is thus explicitly non-portable.
428428

429429

430-
### SwitchProducerCUDA (semi-portable)
431-
432-
A step towards a portable configuration is to use the `SwitchProcucer` mechanism, for which currently the only concrete implementation is [`SwitchProducerCUDA`](../../HeterogeneousCore/CUDACore/README.md#automatic-switching-between-cpu-and-gpu-modules). The modules for different Alpaka backends still need to be specified explicitly
433-
```python
434-
from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA
435-
process.producer = SwitchProducerCUDA(
436-
cpu = cms.EDProducer("alpaka_serial_sync::ExampleAlpakaProducer", ...),
437-
cuda = cms.EDProducer("alpaka_cuda_async::ExampleAlpakaProducer", ...)
438-
)
439-
440-
# or
441-
442-
process.producer = SwitchProducerCUDA(
443-
cpu = cms.EDAlias(producerCPU = cms.EDAlias.allProducts(),
444-
cuda = cms.EDAlias(producerGPU = cms.EDAlias.allProducts()
445-
)
446-
```
447-
This kind of configuration can be run on any machine (a given CMSSW build supports), but is limited to CMSSW builds where the modules for all the Alpaka backends declared in the configuration can be built (`alpaka_serial_sync` and `alpaka_cuda_async` in this example). Therefore the `SwitchProducer` approach is here called "semi-portable".
448-
449430
### Module type resolver (portable)
450431

451432
A fully portable way to express a configuration can be achieved with "module type resolver" approach. The module is specified in the configuration without the backend-specific namespace, and with `@alpaka` postfix

HeterogeneousCore/CUDACore/README.md

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* [Analyzer with CUDA input](#analyzer-with-cuda-input)
1717
* [Configuration](#configuration)
1818
* [GPU-only configuration](#gpu-only-configuration)
19-
* [Automatic switching between CPU and GPU modules](#automatic-switching-between-cpu-and-gpu-modules)
2019
* [More details](#more-details)
2120
* [Device choice](#device-choice)
2221
* [Data model](#data-model)
@@ -355,10 +354,9 @@ void ProducerInputOutputCUDA::produce(edm::StreamID streamID, edm::Event& iEvent
355354
356355
Analyzer with CUDA input is similar to [producer with CUDA
357356
input](#producer-with-cuda-input). Note that currently we do not have
358-
a mechanism for portable configurations with analyzers (like
359-
[`SwitchProducer`](#automatic-switching-between-cpu-and-gpu-modules)
360-
for producers). This means that a configuration with a CUDA analyzer
361-
can only run on a machine with CUDA device(s).
357+
a mechanism for portable configurations with analyzers. This means
358+
that a configuration with a CUDA analyzer can only run on a machine
359+
with CUDA device(s).
362360
363361
```cpp
364362
class AnalyzerInputCUDA: public edm::global::EDAnalyzer<> {
@@ -408,54 +406,10 @@ void AnalyzerInputCUDA::analyze(edm::Event const& iEvent, edm::EventSetup& iSetu
408406
For a GPU-only configuration there is nothing special to be done, just
409407
construct the Paths/Sequences/Tasks from the GPU modules.
410408

411-
#### Automatic switching between CPU and GPU modules
412-
413-
The `SwitchProducer` mechanism can be used to switch automatically
414-
between CPU and GPU modules based on the availability of GPUs on the
415-
machine where the configuration is done. Framework decides at the
416-
beginning of the job which of the modules to run for a given module
417-
label.
418-
419-
Framework requires that the modules in the switch must produce the
420-
same types of output products (the closer the actual results are the
421-
better, but the framework can not enforce that). This means that for a
422-
chain of GPU modules, it is the module that transforms the SoA data
423-
format back to the legacy data formats (possibly, but not necessarily,
424-
transferring the SoA data from GPU to CPU) that should be switched
425-
between the legacy CPU module. The rest of the GPU modules should be
426-
placed to a `Task`, in which case framework runs them only if their
427-
output is needed by another module.
428-
429-
```python
430-
from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA
431-
process.foo = SwitchProducerCUDA(
432-
cpu = cms.EDProducer("FooProducer"), # legacy CPU
433-
cuda = cms.EDProducer("FooProducerFromCUDA",
434-
src="fooCUDA"
435-
)
436-
)
437-
process.fooCUDA = cms.EDProducer("FooProducerCUDA")
438-
439-
process.fooTaskCUDA = cms.Task(process.fooCUDA)
440-
process.fooTask = cms.Task(
441-
process.foo,
442-
process.fooTaskCUDA
443-
)
444-
```
445-
446-
For a more complete example, see [here](../CUDATest/test/testCUDASwitch_cfg.py).
447-
448-
449-
450-
451-
452409
## More details
453410

454411
### Device choice
455412

456-
As discussed above, with `SwitchProducer` the choice between CPU and
457-
GPU modules is done at the beginning of the job.
458-
459413
For multi-GPU setup the device is chosen in the first CUDA module in a
460414
chain of modules by one of the constructors of
461415
`cms::cuda::ScopedContextAcquire`/`cms::cuda::ScopedContextProduce`

HeterogeneousCore/CUDACore/python/SwitchProducerCUDA.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

HeterogeneousCore/CUDACore/test/test_ProcessAcceleratorCUDA.cc

Lines changed: 0 additions & 55 deletions
This file was deleted.

HeterogeneousCore/CUDATest/python/prod1CPU_cfi.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

HeterogeneousCore/CUDATest/python/prod1CUDA_cfi.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

HeterogeneousCore/CUDATest/python/prod1FromCUDA_cfi.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

HeterogeneousCore/CUDATest/python/prod1Switch_cff.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

HeterogeneousCore/CUDATest/python/prod5CPU_cfi.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

HeterogeneousCore/CUDATest/python/prod5CUDA_cfi.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)