File indexing completed on 2025-09-17 08:53:39
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Types.hh"
0010 #include "corecel/data/Collection.hh"
0011 #include "corecel/data/CollectionBuilder.hh"
0012 #include "corecel/sys/ThreadId.hh"
0013 #include "celeritas/Types.hh"
0014
0015 namespace celeritas
0016 {
0017 namespace detail
0018 {
0019
0020 template<MemSpace M>
0021 class CoreStateThreadOffsets;
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 template<>
0032 class CoreStateThreadOffsets<MemSpace::host>
0033 {
0034 public:
0035
0036
0037 using NativeActionThreads
0038 = Collection<ThreadId, Ownership::value, MemSpace::host, ActionId>;
0039 using HostActionThreads = NativeActionThreads;
0040
0041
0042 public:
0043 auto& host_action_thread_offsets() { return thread_offsets_; }
0044 auto const& host_action_thread_offsets() const { return thread_offsets_; }
0045 auto& native_action_thread_offsets() { return thread_offsets_; }
0046 auto const& native_action_thread_offsets() const
0047 {
0048 return thread_offsets_;
0049 }
0050
0051
0052 void resize(size_type n) { celeritas::resize(&thread_offsets_, n); }
0053
0054
0055 bool empty() const { return thread_offsets_.empty(); }
0056
0057 private:
0058 NativeActionThreads thread_offsets_;
0059 };
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069 template<>
0070 class CoreStateThreadOffsets<MemSpace::device>
0071 {
0072 public:
0073
0074
0075 using NativeActionThreads
0076 = Collection<ThreadId, Ownership::value, MemSpace::device, ActionId>;
0077 using HostActionThreads
0078 = Collection<ThreadId, Ownership::value, MemSpace::mapped, ActionId>;
0079
0080
0081 public:
0082 auto& host_action_thread_offsets() { return host_thread_offsets_; }
0083 auto const& host_action_thread_offsets() const
0084 {
0085 return host_thread_offsets_;
0086 }
0087 auto& native_action_thread_offsets() { return thread_offsets_; }
0088 auto const& native_action_thread_offsets() const
0089 {
0090 return thread_offsets_;
0091 }
0092 void resize(size_type n)
0093 {
0094 celeritas::resize(&thread_offsets_, n);
0095 celeritas::resize(&host_thread_offsets_, n);
0096 }
0097
0098
0099 bool empty() const { return thread_offsets_.empty(); }
0100
0101 private:
0102 NativeActionThreads thread_offsets_;
0103 HostActionThreads host_thread_offsets_;
0104 };
0105
0106
0107 }
0108 }