Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:31:31

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2020-2024 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file celeritas/track/detail/TrackInitAlgorithms.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Assert.hh"
0011 #include "corecel/Macros.hh"
0012 #include "corecel/Types.hh"
0013 #include "corecel/data/Collection.hh"
0014 #include "corecel/sys/ThreadId.hh"
0015 #include "celeritas/global/CoreParams.hh"
0016 #include "celeritas/track/CoreStateCounters.hh"
0017 
0018 #include "Utils.hh"
0019 
0020 namespace celeritas
0021 {
0022 namespace detail
0023 {
0024 //---------------------------------------------------------------------------//
0025 // Remove all elements in the vacancy vector that were flagged as alive
0026 size_type remove_if_alive(
0027     StateCollection<TrackSlotId, Ownership::reference, MemSpace::host> const&,
0028     StreamId);
0029 size_type remove_if_alive(
0030     StateCollection<TrackSlotId, Ownership::reference, MemSpace::device> const&,
0031     StreamId);
0032 
0033 //---------------------------------------------------------------------------//
0034 // Calculate the exclusive prefix sum of the number of surviving secondaries
0035 size_type exclusive_scan_counts(
0036     StateCollection<size_type, Ownership::reference, MemSpace::host> const&,
0037     StreamId);
0038 size_type exclusive_scan_counts(
0039     StateCollection<size_type, Ownership::reference, MemSpace::device> const&,
0040     StreamId);
0041 
0042 //---------------------------------------------------------------------------//
0043 // Sort the tracks that will be initialized in this step by charged/neutral
0044 void partition_initializers(
0045     CoreParams const&,
0046     TrackInitStateData<Ownership::reference, MemSpace::host> const&,
0047     CoreStateCounters const&,
0048     size_type,
0049     StreamId);
0050 void partition_initializers(
0051     CoreParams const&,
0052     TrackInitStateData<Ownership::reference, MemSpace::device> const&,
0053     CoreStateCounters const&,
0054     size_type,
0055     StreamId);
0056 
0057 //---------------------------------------------------------------------------//
0058 // INLINE DEFINITIONS
0059 //---------------------------------------------------------------------------//
0060 #if !CELER_USE_DEVICE
0061 inline size_type remove_if_alive(
0062     StateCollection<TrackSlotId, Ownership::reference, MemSpace::device> const&,
0063     StreamId)
0064 {
0065     CELER_NOT_CONFIGURED("CUDA or HIP");
0066 }
0067 
0068 inline size_type exclusive_scan_counts(
0069     StateCollection<size_type, Ownership::reference, MemSpace::device> const&,
0070     StreamId)
0071 {
0072     CELER_NOT_CONFIGURED("CUDA or HIP");
0073 }
0074 
0075 inline void partition_initializers(
0076     CoreParams const&,
0077     TrackInitStateData<Ownership::reference, MemSpace::device> const&,
0078     CoreStateCounters const&,
0079     size_type,
0080     StreamId)
0081 {
0082     CELER_NOT_CONFIGURED("CUDA or HIP");
0083 }
0084 
0085 #endif
0086 //---------------------------------------------------------------------------//
0087 }  // namespace detail
0088 }  // namespace celeritas