67{
68
69 std::string rm_type =
GetName(_type);
70 if(_type == G4RunManagerType::SerialOnly ||
71 _type == G4RunManagerType::MTOnly ||
72 _type == G4RunManagerType::TaskingOnly ||
73 _type == G4RunManagerType::TBBOnly)
74 {
75
76 fail_if_unavail = true;
77 }
78 else
79 {
80
81
82
83
84
85 rm_type = G4GetEnv<std::string>(
"G4RUN_MANAGER_TYPE",
GetName(_type),
86 "Overriding G4RunManager type...");
87 auto force_rm = G4GetEnv<std::string>("G4FORCE_RUN_MANAGER_TYPE", "",
88 "Forcing G4RunManager type...");
89
90 if(force_rm.length() > 0)
91 {
92 rm_type = force_rm;
93 fail_if_unavail = true;
94 }
95 else if(rm_type.empty())
96 {
98 }
99 }
100
101
102
103
105 if(opts.find(rm_type) == opts.end())
106 {
107 if(fail_if_unavail)
108 {
109 fail("Run manager type is not available", rm_type, opts, 1);
110 }
111 else
112 {
114 }
115 }
116
117
120
121 switch(_type)
122 {
123 case G4RunManagerType::Serial:
125 break;
126 case G4RunManagerType::MT:
127#if defined(G4MULTITHREADED)
129#endif
130 break;
131 case G4RunManagerType::Tasking:
132#if defined(G4MULTITHREADED)
134#endif
135 break;
136 case G4RunManagerType::TBB:
137#if defined(G4MULTITHREADED) && defined(GEANT4_USE_TBB)
139#endif
140 break;
141
142 case G4RunManagerType::SerialOnly:
143 break;
144 case G4RunManagerType::MTOnly:
145 break;
146 case G4RunManagerType::TaskingOnly:
147 break;
148 case G4RunManagerType::TBBOnly:
149 break;
150 case G4RunManagerType::Default:
151 break;
152 }
153
154 if(!rm)
156
158 if(nthreads > 0 && mtrm)
160
161 master_run_manager = rm;
162 mt_master_run_manager = mtrm;
163 master_run_manager_kernel = rm->
kernel;
164
166 return rm;
167}
virtual void SetNumberOfThreads(G4int n)
static std::set< std::string > GetOptions()
static std::string GetName(G4RunManagerType)
static std::string GetDefault()
static G4RunManagerType GetType(const std::string &)
G4RunManagerKernel * kernel
void G4ConsumeParameters(_Args &&...)