{"action":"created","issue":{"url":"https://api.github.com/repos/cms-sw/cmssw/issues/24188","repository_url":"https://api.github.com/repos/cms-sw/cmssw","labels_url":"https://api.github.com/repos/cms-sw/cmssw/issues/24188/labels{/name}","comments_url":"https://api.github.com/repos/cms-sw/cmssw/issues/24188/comments","events_url":"https://api.github.com/repos/cms-sw/cmssw/issues/24188/events","html_url":"https://github.com/cms-sw/cmssw/issues/24188","id":347334233,"node_id":"MDU6SXNzdWUzNDczMzQyMzM=","number":24188,"title":"Create a product alias functionality with ordered fallback mechanism","user":{"login":"makortel","id":33993,"node_id":"MDQ6VXNlcjMzOTkz","avatar_url":"https://avatars3.githubusercontent.com/u/33993?v=4","gravatar_id":"","url":"https://api.github.com/users/makortel","html_url":"https://github.com/makortel","followers_url":"https://api.github.com/users/makortel/followers","following_url":"https://api.github.com/users/makortel/following{/other_user}","gists_url":"https://api.github.com/users/makortel/gists{/gist_id}","starred_url":"https://api.github.com/users/makortel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makortel/subscriptions","organizations_url":"https://api.github.com/users/makortel/orgs","repos_url":"https://api.github.com/users/makortel/repos","events_url":"https://api.github.com/users/makortel/events{/privacy}","received_events_url":"https://api.github.com/users/makortel/received_events","type":"User","site_admin":false},"labels":[{"id":290515077,"node_id":"MDU6TGFiZWwyOTA1MTUwNzc=","url":"https://api.github.com/repos/cms-sw/cmssw/labels/pending-assignment","name":"pending-assignment","color":"ff8000","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-08-03T09:56:01Z","updated_at":"2018-08-03T12:09:33Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"One way to incorporate chains of algorithms using accelerators would be to\r\n* one EDProducer for each algorithm for each device type, and\r\n   * e.g. a CPU producer, CUDA producer, FPGA producer\r\n* organize these producers into Paths per device type with the first module being an EDFilter deciding whether the algorithms for that device type should run or not\r\n    * e.g. one Path for CPU, one Path for CUDA, one Path for FPGA etc, for that chain of modules\r\n\r\nIn order to keep the downstream (e.g. DQM) unaware on the details how an event product was produced, we'd need something that conditionally aliases a product label to the actual producer that was run. Example:\r\n```python\r\nprocess.fooCPU = cms.EDProducer(\"FooProducerCPU\")\r\nprocess.fooCUDA = cms.EDProducer(\"FooProducerCUDA\")\r\nprocess.foo = # something creating an alias to fooCUDA if it was produced, otherwise to fooCPU\r\n```\r\n(the mechanism of how either `fooCUDA` or `fooCPU` runs is to be discussed elsewhere)\r\n\r\nExisting constructs that might be used (and some reasons why they don't work well)\r\n* EDAlias\r\n   * can create an alias from `foo` to `bar`, but not from `foo` to \"one of these possibilities\"\r\n   * can not be easily extended to support ordered list while keeping the same configuration interface (as the keyword arguments get delivered via `dict`)\r\n* EDProducer\r\n   * requires a separate EDProducer implementation for each product type (leading to lots of boilerplate)\r\n   * requires copying (performance impact)\r\n   * implies prefetching of all inputs\r\n\r\nWhat the new construct would have to do\r\n* create an alias as EDAlias does (no copies)\r\n* take the alias-to as an ordered list\r\n   * take the first item, try to prefetch, if succeeds (i.e. product is found), create the alias to that\r\n   * if prefetch didn't succeed, try the next item etc.\r\n   * if none of the prefetches succeeded, lead to `ProductNotFound` exception to be thrown\r\n* as indicated in above, it would make life easier elsewhere if unnecessary prefetching could be avoided\r\n\r\nBelow is a sketch of how the configuration could look like (enhancing the EDAlias syntax)\r\n```python\r\nprocess.foo = cms.EDFallback(\r\n    cms.PSet(fooCUDA = cms.VPSet(cms.PSet(type=\"SiPixelClusteredmNewDetSetVector\"))),\r\n    cms.PSet(fooCPU = cms.VPSet(cms.PSet(type=\"SiPixelClusteredmNewDetSetVector\")))\r\n)\r\n```\r\n(suggestions how make it less ugly are welcome)\r\n\r\n@Dr15Jones @wddgit "},"comment":{"url":"https://api.github.com/repos/cms-sw/cmssw/issues/comments/410234374","html_url":"https://github.com/cms-sw/cmssw/issues/24188#issuecomment-410234374","issue_url":"https://api.github.com/repos/cms-sw/cmssw/issues/24188","id":410234374,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMDIzNDM3NA==","user":{"login":"Dr15Jones","id":3757616,"node_id":"MDQ6VXNlcjM3NTc2MTY=","avatar_url":"https://avatars2.githubusercontent.com/u/3757616?v=4","gravatar_id":"","url":"https://api.github.com/users/Dr15Jones","html_url":"https://github.com/Dr15Jones","followers_url":"https://api.github.com/users/Dr15Jones/followers","following_url":"https://api.github.com/users/Dr15Jones/following{/other_user}","gists_url":"https://api.github.com/users/Dr15Jones/gists{/gist_id}","starred_url":"https://api.github.com/users/Dr15Jones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dr15Jones/subscriptions","organizations_url":"https://api.github.com/users/Dr15Jones/orgs","repos_url":"https://api.github.com/users/Dr15Jones/repos","events_url":"https://api.github.com/users/Dr15Jones/events{/privacy}","received_events_url":"https://api.github.com/users/Dr15Jones/received_events","type":"User","site_admin":false},"created_at":"2018-08-03T12:09:33Z","updated_at":"2018-08-03T12:09:33Z","author_association":"CONTRIBUTOR","body":"assign core"}}
{"actor":{"display_login":"Dr15Jones"}}