CMS 3D CMS Logo

Functions
atomicMaxF.h File Reference
#include <alpaka/alpaka.hpp>
#include "FWCore/Utilities/interface/bit_cast.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"

Go to the source code of this file.

Functions

template<typename TAcc , typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float atomicMaxF (const TAcc &acc, float *address, float val)
 

Function Documentation

◆ atomicMaxF()

template<typename TAcc , typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float atomicMaxF ( const TAcc &  acc,
float *  address,
float  val 
)
static

Definition at line 21 of file atomicMaxF.h.

References edm::bit_cast(), runTheMatrix::ret, and heppy_batch::val.

Referenced by ALPAKA_ACCELERATOR_NAMESPACE::hcalFastCluster_exotic(), ALPAKA_ACCELERATOR_NAMESPACE::hcalFastCluster_multiSeedIterative(), and ALPAKA_ACCELERATOR_NAMESPACE::hcalFastCluster_multiSeedParallel().

21  {
22  // CPU implementation uses edm::bit_cast
23  int ret = edm::bit_cast<int>(*address);
24  while (val > edm::bit_cast<float>(ret)) {
25  int old = ret;
26  if ((ret = alpaka::atomicCas(acc, (int*)address, old, edm::bit_cast<int>(val))) == old)
27  break;
28  }
29  return edm::bit_cast<float>(ret);
30 }
To bit_cast(const From &src) noexcept
Definition: bit_cast.h:29
ret
prodAgent to be discontinued