Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 #ifdef USE_INFERENCE 26 #ifdef USE_INFERENCE 27 # include "Par04InferenceMessenger.hh" << 27 #include "Par04InferenceMessenger.hh" 28 << 28 #include <CLHEP/Units/SystemOfUnits.h> // for pi 29 # include "Par04InferenceSetup.hh" // for Pa << 29 #include <G4ApplicationState.hh> // for G4State_Idle 30 << 30 #include <G4ThreeVector.hh> // for G4ThreeVector 31 # include "G4UIcmdWithADoubleAndUnit.hh" // << 31 #include <G4UImessenger.hh> // for G4UImessenger 32 # include "G4UIcmdWithAString.hh" // for G4U << 32 #include <string> // for stoi 33 # include "G4UIcmdWithAnInteger.hh" // for G << 33 #include "G4UIcmdWithADoubleAndUnit.hh" // for G4UIcmdWithADoubleAndUnit 34 # include "G4UIdirectory.hh" // for G4UIdire << 34 #include "G4UIcmdWithAString.hh" // for G4UIcmdWithAString 35 << 35 #include "G4UIcmdWithAnInteger.hh" // for G4UIcmdWithAnInteger 36 # include <CLHEP/Units/SystemOfUnits.h> // f << 36 #include "G4UIdirectory.hh" // for G4UIdirectory 37 # include <G4ApplicationState.hh> // for G4S << 37 #include "Par04InferenceSetup.hh" // for Par04InferenceSetup 38 # include <G4ThreeVector.hh> // for G4ThreeV << 39 # include <G4UImessenger.hh> // for G4UImess << 40 # include <string> // for stoi << 41 class G4UIcommand; 38 class G4UIcommand; 42 39 43 //....oooOO0OOooo........oooOO0OOooo........oo 40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 44 41 45 Par04InferenceMessenger::Par04InferenceMesseng 42 Par04InferenceMessenger::Par04InferenceMessenger(Par04InferenceSetup* aInference) 46 : G4UImessenger(), fInference(aInference) << 43 : G4UImessenger() >> 44 , fInference(aInference) 47 { 45 { 48 fExampleDir = new G4UIdirectory("/Par04/"); 46 fExampleDir = new G4UIdirectory("/Par04/"); 49 fExampleDir->SetGuidance("UI commands specif 47 fExampleDir->SetGuidance("UI commands specific to this example"); 50 48 51 fInferenceDir = new G4UIdirectory("/Par04/in 49 fInferenceDir = new G4UIdirectory("/Par04/inference/"); 52 fInferenceDir->SetGuidance("Inference constr 50 fInferenceDir->SetGuidance("Inference construction UI commands"); 53 51 54 fInferenceLibraryCmd = new G4UIcmdWithAStrin 52 fInferenceLibraryCmd = new G4UIcmdWithAString("/Par04/inference/setInferenceLibrary", this); 55 fInferenceLibraryCmd->SetGuidance("Inference 53 fInferenceLibraryCmd->SetGuidance("Inference library."); 56 fInferenceLibraryCmd->SetParameterName("Infe 54 fInferenceLibraryCmd->SetParameterName("InferenceLibrary", false); 57 fInferenceLibraryCmd->AvailableForStates(G4S 55 fInferenceLibraryCmd->AvailableForStates(G4State_Idle); 58 fInferenceLibraryCmd->SetToBeBroadcasted(tru 56 fInferenceLibraryCmd->SetToBeBroadcasted(true); 59 57 60 fSizeLatentVectorCmd = new G4UIcmdWithAnInte 58 fSizeLatentVectorCmd = new G4UIcmdWithAnInteger("/Par04/inference/setSizeLatentVector", this); 61 fSizeLatentVectorCmd->SetGuidance("Set size 59 fSizeLatentVectorCmd->SetGuidance("Set size of the latent space vector."); 62 fSizeLatentVectorCmd->SetParameterName("Size 60 fSizeLatentVectorCmd->SetParameterName("SizeLatentVector", false); 63 fSizeLatentVectorCmd->SetRange("SizeLatentVe 61 fSizeLatentVectorCmd->SetRange("SizeLatentVector>0"); 64 fSizeLatentVectorCmd->AvailableForStates(G4S 62 fSizeLatentVectorCmd->AvailableForStates(G4State_Idle); 65 fSizeLatentVectorCmd->SetToBeBroadcasted(tru 63 fSizeLatentVectorCmd->SetToBeBroadcasted(true); 66 64 67 fSizeConditionVectorCmd = 65 fSizeConditionVectorCmd = 68 new G4UIcmdWithAnInteger("/Par04/inference 66 new G4UIcmdWithAnInteger("/Par04/inference/setSizeConditionVector", this); 69 fSizeConditionVectorCmd->SetGuidance("Set si 67 fSizeConditionVectorCmd->SetGuidance("Set size of the condition vector."); 70 fSizeConditionVectorCmd->SetParameterName("S 68 fSizeConditionVectorCmd->SetParameterName("SizeConditionVector", false); 71 fSizeConditionVectorCmd->SetRange("SizeCondi 69 fSizeConditionVectorCmd->SetRange("SizeConditionVector>0"); 72 fSizeConditionVectorCmd->AvailableForStates( 70 fSizeConditionVectorCmd->AvailableForStates(G4State_Idle); 73 fSizeConditionVectorCmd->SetToBeBroadcasted( 71 fSizeConditionVectorCmd->SetToBeBroadcasted(true); 74 72 75 fModelPathNameCmd = new G4UIcmdWithAString(" 73 fModelPathNameCmd = new G4UIcmdWithAString("/Par04/inference/setModelPathName", this); 76 fModelPathNameCmd->SetGuidance("Model path a 74 fModelPathNameCmd->SetGuidance("Model path and name."); 77 fModelPathNameCmd->SetParameterName("Name", 75 fModelPathNameCmd->SetParameterName("Name", false); 78 fModelPathNameCmd->AvailableForStates(G4Stat 76 fModelPathNameCmd->AvailableForStates(G4State_Idle); 79 fModelPathNameCmd->SetToBeBroadcasted(true); 77 fModelPathNameCmd->SetToBeBroadcasted(true); 80 78 81 fProfileFlagCmd = new G4UIcmdWithAnInteger(" 79 fProfileFlagCmd = new G4UIcmdWithAnInteger("/Par04/inference/setProfileFlag", this); 82 fProfileFlagCmd->SetGuidance("Flag to save a 80 fProfileFlagCmd->SetGuidance("Flag to save a json file for model execution profiling."); 83 fProfileFlagCmd->SetParameterName("ProfileFl 81 fProfileFlagCmd->SetParameterName("ProfileFlag", false); 84 fProfileFlagCmd->SetRange("ProfileFlag>-1"); 82 fProfileFlagCmd->SetRange("ProfileFlag>-1"); 85 fProfileFlagCmd->AvailableForStates(G4State_ 83 fProfileFlagCmd->AvailableForStates(G4State_Idle); 86 fProfileFlagCmd->SetToBeBroadcasted(true); 84 fProfileFlagCmd->SetToBeBroadcasted(true); 87 85 88 fOptimizationFlagCmd = new G4UIcmdWithAnInte 86 fOptimizationFlagCmd = new G4UIcmdWithAnInteger("/Par04/inference/setOptimizationFlag", this); 89 fOptimizationFlagCmd->SetGuidance("Set optim 87 fOptimizationFlagCmd->SetGuidance("Set optimization flag"); 90 fOptimizationFlagCmd->SetParameterName("Opti 88 fOptimizationFlagCmd->SetParameterName("OptimizationFlag", false); 91 fOptimizationFlagCmd->SetRange("Optimization 89 fOptimizationFlagCmd->SetRange("OptimizationFlag>-1"); 92 fOptimizationFlagCmd->AvailableForStates(G4S 90 fOptimizationFlagCmd->AvailableForStates(G4State_Idle); 93 fOptimizationFlagCmd->SetToBeBroadcasted(tru 91 fOptimizationFlagCmd->SetToBeBroadcasted(true); 94 92 95 fMeshNbRhoCellsCmd = new G4UIcmdWithAnIntege 93 fMeshNbRhoCellsCmd = new G4UIcmdWithAnInteger("/Par04/inference/setNbOfRhoCells", this); 96 fMeshNbRhoCellsCmd->SetGuidance("Set number 94 fMeshNbRhoCellsCmd->SetGuidance("Set number of rho cells in the cylindrical mesh readout."); 97 fMeshNbRhoCellsCmd->SetParameterName("NbRhoC 95 fMeshNbRhoCellsCmd->SetParameterName("NbRhoCells", false); 98 fMeshNbRhoCellsCmd->SetRange("NbRhoCells>0") 96 fMeshNbRhoCellsCmd->SetRange("NbRhoCells>0"); 99 fMeshNbRhoCellsCmd->AvailableForStates(G4Sta 97 fMeshNbRhoCellsCmd->AvailableForStates(G4State_Idle); 100 fMeshNbRhoCellsCmd->SetToBeBroadcasted(true) 98 fMeshNbRhoCellsCmd->SetToBeBroadcasted(true); 101 99 102 fMeshNbPhiCellsCmd = new G4UIcmdWithAnIntege 100 fMeshNbPhiCellsCmd = new G4UIcmdWithAnInteger("/Par04/inference/setNbOfPhiCells", this); 103 fMeshNbPhiCellsCmd->SetGuidance("Set number 101 fMeshNbPhiCellsCmd->SetGuidance("Set number of phi cells in the cylindrical mesh readout."); 104 fMeshNbPhiCellsCmd->SetParameterName("NbPhiC 102 fMeshNbPhiCellsCmd->SetParameterName("NbPhiCells", false); 105 fMeshNbPhiCellsCmd->SetRange("NbPhiCells>0") 103 fMeshNbPhiCellsCmd->SetRange("NbPhiCells>0"); 106 fMeshNbPhiCellsCmd->AvailableForStates(G4Sta 104 fMeshNbPhiCellsCmd->AvailableForStates(G4State_Idle); 107 fMeshNbPhiCellsCmd->SetToBeBroadcasted(true) 105 fMeshNbPhiCellsCmd->SetToBeBroadcasted(true); 108 106 109 fMeshNbZCellsCmd = new G4UIcmdWithAnInteger( 107 fMeshNbZCellsCmd = new G4UIcmdWithAnInteger("/Par04/inference/setNbOfZCells", this); 110 fMeshNbZCellsCmd->SetGuidance("Set number of 108 fMeshNbZCellsCmd->SetGuidance("Set number of z cells in the cylindrical mesh readout."); 111 fMeshNbZCellsCmd->SetParameterName("NbZCells 109 fMeshNbZCellsCmd->SetParameterName("NbZCells", false); 112 fMeshNbZCellsCmd->SetRange("NbZCells>0"); 110 fMeshNbZCellsCmd->SetRange("NbZCells>0"); 113 fMeshNbZCellsCmd->AvailableForStates(G4State 111 fMeshNbZCellsCmd->AvailableForStates(G4State_Idle); 114 fMeshNbZCellsCmd->SetToBeBroadcasted(true); 112 fMeshNbZCellsCmd->SetToBeBroadcasted(true); 115 113 116 fMeshSizeRhoCellsCmd = new G4UIcmdWithADoubl 114 fMeshSizeRhoCellsCmd = new G4UIcmdWithADoubleAndUnit("/Par04/inference/setSizeOfRhoCells", this); 117 fMeshSizeRhoCellsCmd->SetGuidance("Set size 115 fMeshSizeRhoCellsCmd->SetGuidance("Set size of rho cells in the cylindrical readout mesh"); 118 fMeshSizeRhoCellsCmd->SetParameterName("Size 116 fMeshSizeRhoCellsCmd->SetParameterName("Size", false); 119 fMeshSizeRhoCellsCmd->SetRange("Size>0."); 117 fMeshSizeRhoCellsCmd->SetRange("Size>0."); 120 fMeshSizeRhoCellsCmd->SetUnitCategory("Lengt 118 fMeshSizeRhoCellsCmd->SetUnitCategory("Length"); 121 fMeshSizeRhoCellsCmd->AvailableForStates(G4S 119 fMeshSizeRhoCellsCmd->AvailableForStates(G4State_Idle); 122 fMeshSizeRhoCellsCmd->SetToBeBroadcasted(tru 120 fMeshSizeRhoCellsCmd->SetToBeBroadcasted(true); 123 121 124 fMeshSizeZCellsCmd = new G4UIcmdWithADoubleA 122 fMeshSizeZCellsCmd = new G4UIcmdWithADoubleAndUnit("/Par04/inference/setSizeOfZCells", this); 125 fMeshSizeZCellsCmd->SetGuidance("Set size of 123 fMeshSizeZCellsCmd->SetGuidance("Set size of z cells in the cylindrical readout mesh"); 126 fMeshSizeZCellsCmd->SetParameterName("Size", 124 fMeshSizeZCellsCmd->SetParameterName("Size", false); 127 fMeshSizeZCellsCmd->SetRange("Size>0."); 125 fMeshSizeZCellsCmd->SetRange("Size>0."); 128 fMeshSizeZCellsCmd->SetUnitCategory("Length" 126 fMeshSizeZCellsCmd->SetUnitCategory("Length"); 129 fMeshSizeZCellsCmd->AvailableForStates(G4Sta 127 fMeshSizeZCellsCmd->AvailableForStates(G4State_Idle); 130 fMeshSizeZCellsCmd->SetToBeBroadcasted(true) 128 fMeshSizeZCellsCmd->SetToBeBroadcasted(true); 131 << 132 // Onnx Runtime Execution Provider flag comm << 133 fCudaFlagCmd = new G4UIcmdWithAnInteger("/Pa << 134 G4cout << "f CudaFlagCmd " << fCudaFlagCmd < << 135 fCudaFlagCmd->SetGuidance("Whether to use CU << 136 fCudaFlagCmd->SetParameterName("CudaFlag", f << 137 fCudaFlagCmd->SetRange("CudaFlag>-1"); << 138 fCudaFlagCmd->AvailableForStates(G4State_Idl << 139 fCudaFlagCmd->SetToBeBroadcasted(true); << 140 << 141 /// OnnxRuntime Execution Provider Options << 142 /// Cuda << 143 fCudaOptionsDir = new G4UIdirectory("/Par04/ << 144 fCudaOptionsDir->SetGuidance("Commands for s << 145 << 146 fCudaDeviceIdCmd = new G4UIcmdWithAString("/ << 147 fCudaDeviceIdCmd->SetGuidance("Device ID of << 148 fCudaDeviceIdCmd->SetParameterName("CudaDevi << 149 fCudaDeviceIdCmd->AvailableForStates(G4State << 150 fCudaDeviceIdCmd->SetToBeBroadcasted(true); << 151 << 152 fCudaGpuMemLimitCmd = new G4UIcmdWithAString << 153 fCudaGpuMemLimitCmd->SetGuidance("GPU Memory << 154 fCudaGpuMemLimitCmd->SetParameterName("CudaG << 155 fCudaGpuMemLimitCmd->AvailableForStates(G4St << 156 fCudaGpuMemLimitCmd->SetToBeBroadcasted(true << 157 << 158 fCudaArenaExtendedStrategyCmd = << 159 new G4UIcmdWithAString("/Par04/inference/c << 160 fCudaArenaExtendedStrategyCmd->SetGuidance( << 161 "Strategy for extending the device memory << 162 fCudaArenaExtendedStrategyCmd->SetParameterN << 163 fCudaArenaExtendedStrategyCmd->AvailableForS << 164 fCudaArenaExtendedStrategyCmd->SetToBeBroadc << 165 << 166 fCudaCudnnConvAlgoSearchCmd = << 167 new G4UIcmdWithAString("/Par04/inference/c << 168 fCudaCudnnConvAlgoSearchCmd->SetGuidance("Se << 169 fCudaCudnnConvAlgoSearchCmd->SetParameterNam << 170 fCudaCudnnConvAlgoSearchCmd->AvailableForSta << 171 fCudaCudnnConvAlgoSearchCmd->SetToBeBroadcas << 172 << 173 fCudaDoCopyInDefaultStreamCmd = << 174 new G4UIcmdWithAString("/Par04/inference/c << 175 fCudaDoCopyInDefaultStreamCmd->SetGuidance(" << 176 fCudaDoCopyInDefaultStreamCmd->SetParameterN << 177 fCudaDoCopyInDefaultStreamCmd->AvailableForS << 178 fCudaDoCopyInDefaultStreamCmd->SetToBeBroadc << 179 << 180 fCudaCudnnConvUseMaxWorkspaceCmd = << 181 new G4UIcmdWithAString("/Par04/inference/c << 182 fCudaCudnnConvUseMaxWorkspaceCmd->SetGuidanc << 183 fCudaCudnnConvUseMaxWorkspaceCmd->SetParamet << 184 fCudaCudnnConvUseMaxWorkspaceCmd->AvailableF << 185 fCudaCudnnConvUseMaxWorkspaceCmd->SetToBeBro << 186 } 129 } 187 130 188 //....oooOO0OOooo........oooOO0OOooo........oo 131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 189 132 190 Par04InferenceMessenger::~Par04InferenceMessen 133 Par04InferenceMessenger::~Par04InferenceMessenger() 191 { 134 { 192 delete fInferenceLibraryCmd; 135 delete fInferenceLibraryCmd; 193 delete fSizeLatentVectorCmd; 136 delete fSizeLatentVectorCmd; 194 delete fSizeConditionVectorCmd; 137 delete fSizeConditionVectorCmd; 195 delete fModelPathNameCmd; 138 delete fModelPathNameCmd; 196 delete fProfileFlagCmd; 139 delete fProfileFlagCmd; 197 delete fOptimizationFlagCmd; 140 delete fOptimizationFlagCmd; 198 delete fMeshNbRhoCellsCmd; 141 delete fMeshNbRhoCellsCmd; 199 delete fMeshNbPhiCellsCmd; 142 delete fMeshNbPhiCellsCmd; 200 delete fMeshNbZCellsCmd; 143 delete fMeshNbZCellsCmd; 201 delete fMeshSizeRhoCellsCmd; 144 delete fMeshSizeRhoCellsCmd; 202 delete fMeshSizeZCellsCmd; 145 delete fMeshSizeZCellsCmd; 203 } 146 } 204 147 205 //....oooOO0OOooo........oooOO0OOooo........oo 148 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 206 149 207 void Par04InferenceMessenger::SetNewValue(G4UI 150 void Par04InferenceMessenger::SetNewValue(G4UIcommand* aCommand, G4String aNewValue) 208 { 151 { 209 if (aCommand == fInferenceLibraryCmd) { << 152 if(aCommand == fInferenceLibraryCmd) >> 153 { 210 fInference->SetInferenceLibrary(aNewValue) 154 fInference->SetInferenceLibrary(aNewValue); 211 } 155 } 212 if (aCommand == fSizeLatentVectorCmd) { << 156 if(aCommand == fSizeLatentVectorCmd) >> 157 { 213 fInference->SetSizeLatentVector(std::stoi( 158 fInference->SetSizeLatentVector(std::stoi(aNewValue)); 214 } 159 } 215 if (aCommand == fSizeConditionVectorCmd) { << 160 if(aCommand == fSizeConditionVectorCmd) >> 161 { 216 fInference->SetSizeConditionVector(std::st 162 fInference->SetSizeConditionVector(std::stoi(aNewValue)); 217 } 163 } 218 if (aCommand == fModelPathNameCmd) { << 164 if(aCommand == fModelPathNameCmd) >> 165 { 219 fInference->SetModelPathName(aNewValue); 166 fInference->SetModelPathName(aNewValue); 220 } 167 } 221 if (aCommand == fProfileFlagCmd) { << 168 if(aCommand == fProfileFlagCmd) >> 169 { 222 fInference->SetProfileFlag(std::stoi(aNewV 170 fInference->SetProfileFlag(std::stoi(aNewValue)); 223 } 171 } 224 if (aCommand == fOptimizationFlagCmd) { << 172 if(aCommand == fOptimizationFlagCmd) >> 173 { 225 fInference->SetOptimizationFlag(std::stoi( 174 fInference->SetOptimizationFlag(std::stoi(aNewValue)); 226 } 175 } 227 else if (aCommand == fMeshNbRhoCellsCmd) { << 176 else if(aCommand == fMeshNbRhoCellsCmd) >> 177 { 228 fInference->SetMeshNbOfCells(0, fMeshNbRho 178 fInference->SetMeshNbOfCells(0, fMeshNbRhoCellsCmd->GetNewIntValue(aNewValue)); 229 } 179 } 230 else if (aCommand == fMeshNbPhiCellsCmd) { << 180 else if(aCommand == fMeshNbPhiCellsCmd) >> 181 { 231 fInference->SetMeshNbOfCells(1, fMeshNbPhi 182 fInference->SetMeshNbOfCells(1, fMeshNbPhiCellsCmd->GetNewIntValue(aNewValue)); 232 fInference->SetMeshSizeOfCells(1, 183 fInference->SetMeshSizeOfCells(1, 233 2. * CLHEP: 184 2. * CLHEP::pi / fMeshNbPhiCellsCmd->GetNewIntValue(aNewValue)); 234 } 185 } 235 else if (aCommand == fMeshNbZCellsCmd) { << 186 else if(aCommand == fMeshNbZCellsCmd) >> 187 { 236 fInference->SetMeshNbOfCells(2, fMeshNbZCe 188 fInference->SetMeshNbOfCells(2, fMeshNbZCellsCmd->GetNewIntValue(aNewValue)); 237 } 189 } 238 else if (aCommand == fMeshSizeRhoCellsCmd) { << 190 else if(aCommand == fMeshSizeRhoCellsCmd) >> 191 { 239 fInference->SetMeshSizeOfCells(0, fMeshSiz 192 fInference->SetMeshSizeOfCells(0, fMeshSizeRhoCellsCmd->GetNewDoubleValue(aNewValue)); 240 } 193 } 241 else if (aCommand == fMeshSizeZCellsCmd) { << 194 else if(aCommand == fMeshSizeZCellsCmd) >> 195 { 242 fInference->SetMeshSizeOfCells(2, fMeshSiz 196 fInference->SetMeshSizeOfCells(2, fMeshSizeZCellsCmd->GetNewDoubleValue(aNewValue)); 243 } 197 } 244 /// Onnx Runtime Execution Provider Flags << 245 /// Cuda << 246 if (aCommand == fCudaFlagCmd) { << 247 fInference->SetCudaFlag(std::stoi(aNewValu << 248 } << 249 if (aCommand == fCudaDeviceIdCmd) { << 250 fInference->SetCudaDeviceId(aNewValue); << 251 } << 252 else if (aCommand == fCudaGpuMemLimitCmd) { << 253 fInference->SetCudaGpuMemLimit(aNewValue); << 254 } << 255 else if (aCommand == fCudaArenaExtendedStrat << 256 fInference->SetCudaArenaExtendedStrategy(a << 257 } << 258 else if (aCommand == fCudaCudnnConvAlgoSearc << 259 fInference->SetCudaCudnnConvAlgoSearch(aNe << 260 } << 261 else if (aCommand == fCudaDoCopyInDefaultStr << 262 fInference->SetCudaDoCopyInDefaultStream(a << 263 } << 264 else if (aCommand == fCudaCudnnConvUseMaxWor << 265 fInference->SetCudaCudnnConvUseMaxWorkspac << 266 } << 267 } 198 } 268 199 269 //....oooOO0OOooo........oooOO0OOooo........oo 200 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 270 201 271 G4String Par04InferenceMessenger::GetCurrentVa 202 G4String Par04InferenceMessenger::GetCurrentValue(G4UIcommand* aCommand) 272 { 203 { 273 G4String cv; 204 G4String cv; 274 205 275 if (aCommand == fInferenceLibraryCmd) { << 206 if(aCommand == fInferenceLibraryCmd) >> 207 { 276 cv = fInferenceLibraryCmd->ConvertToString 208 cv = fInferenceLibraryCmd->ConvertToString(fInference->GetInferenceLibrary()); 277 } 209 } 278 if (aCommand == fSizeLatentVectorCmd) { << 210 if(aCommand == fSizeLatentVectorCmd) >> 211 { 279 cv = fSizeLatentVectorCmd->ConvertToString 212 cv = fSizeLatentVectorCmd->ConvertToString(fInference->GetSizeLatentVector()); 280 } 213 } 281 if (aCommand == fSizeConditionVectorCmd) { << 214 if(aCommand == fSizeConditionVectorCmd) >> 215 { 282 cv = fSizeConditionVectorCmd->ConvertToStr 216 cv = fSizeConditionVectorCmd->ConvertToString(fInference->GetSizeConditionVector()); 283 } 217 } 284 if (aCommand == fModelPathNameCmd) { << 218 if(aCommand == fModelPathNameCmd) >> 219 { 285 cv = fModelPathNameCmd->ConvertToString(fI 220 cv = fModelPathNameCmd->ConvertToString(fInference->GetModelPathName()); 286 } 221 } 287 if (aCommand == fProfileFlagCmd) { << 222 if(aCommand == fProfileFlagCmd) >> 223 { 288 cv = fSizeLatentVectorCmd->ConvertToString 224 cv = fSizeLatentVectorCmd->ConvertToString(fInference->GetProfileFlag()); 289 } 225 } 290 if (aCommand == fOptimizationFlagCmd) { << 226 if(aCommand == fOptimizationFlagCmd) >> 227 { 291 cv = fSizeLatentVectorCmd->ConvertToString 228 cv = fSizeLatentVectorCmd->ConvertToString(fInference->GetOptimizationFlag()); 292 } 229 } 293 else if (aCommand == fMeshNbRhoCellsCmd) { << 230 else if(aCommand == fMeshNbRhoCellsCmd) >> 231 { 294 cv = fMeshNbRhoCellsCmd->ConvertToString(f 232 cv = fMeshNbRhoCellsCmd->ConvertToString(fInference->GetMeshNbOfCells()[0]); 295 } 233 } 296 else if (aCommand == fMeshNbPhiCellsCmd) { << 234 else if(aCommand == fMeshNbPhiCellsCmd) >> 235 { 297 cv = fMeshNbPhiCellsCmd->ConvertToString(f 236 cv = fMeshNbPhiCellsCmd->ConvertToString(fInference->GetMeshNbOfCells()[1]); 298 } 237 } 299 else if (aCommand == fMeshNbZCellsCmd) { << 238 else if(aCommand == fMeshNbZCellsCmd) >> 239 { 300 cv = fMeshNbZCellsCmd->ConvertToString(fIn 240 cv = fMeshNbZCellsCmd->ConvertToString(fInference->GetMeshNbOfCells()[2]); 301 } 241 } 302 else if (aCommand == fMeshSizeRhoCellsCmd) { << 242 else if(aCommand == fMeshSizeRhoCellsCmd) >> 243 { 303 cv = fMeshSizeRhoCellsCmd->ConvertToString 244 cv = fMeshSizeRhoCellsCmd->ConvertToString(fInference->GetMeshSizeOfCells()[0]); 304 } 245 } 305 else if (aCommand == fMeshSizeZCellsCmd) { << 246 else if(aCommand == fMeshSizeZCellsCmd) >> 247 { 306 cv = fMeshSizeZCellsCmd->ConvertToString(f 248 cv = fMeshSizeZCellsCmd->ConvertToString(fInference->GetMeshSizeOfCells()[2]); 307 } << 308 /// Onnx Runtime Execution Provider Flags << 309 /// Cuda << 310 if (aCommand == fCudaDeviceIdCmd) { << 311 cv = fCudaDeviceIdCmd->ConvertToString(fIn << 312 } << 313 else if (aCommand == fCudaGpuMemLimitCmd) { << 314 cv = fCudaGpuMemLimitCmd->ConvertToString( << 315 } << 316 else if (aCommand == fCudaArenaExtendedStrat << 317 cv = fCudaArenaExtendedStrategyCmd->Conver << 318 } << 319 else if (aCommand == fCudaCudnnConvAlgoSearc << 320 cv = fCudaCudnnConvAlgoSearchCmd->ConvertT << 321 } << 322 else if (aCommand == fCudaDoCopyInDefaultStr << 323 cv = fCudaDoCopyInDefaultStreamCmd->Conver << 324 } << 325 else if (aCommand == fCudaCudnnConvUseMaxWor << 326 cv = fCudaCudnnConvUseMaxWorkspaceCmd->Con << 327 fInference->GetCudaCudnnConvUseMaxWorksp << 328 } 249 } 329 250 330 return cv; 251 return cv; 331 } 252 } 332 253 333 #endif 254 #endif 334 255