How to set cpu cores when solving by ACT script?
wanghao
Member Posts: 27
**
Hi
I'm trying to solve an analysis such as explicit dynamics analysis by ACT script like:
# some pre-process scripts Model.Solve(True)
Is there any way that can set the cpu cores by ACT script?
I noticed Model.Solve() has 2 function signature.
Solve(self: Model, wait: bool, config: SolveConfiguration) | Run the Solve action. | | wait: Wait or not for the solve to be done. | config: The solve configuration to use. If null, the default. Solve(self: Model, wait: bool, config: str) | Run the Solve action. | | wait: Wait or not for the solve to be done. | config: The solve configuration to use. Results in a new error message if the input | solve configuration does not exist. If none is provided, the default is used | for the solve.
Is there any examples for SolveConfiguration
or the solve config struct?
Tagged:
0
Comments
-
Hey, in "Scripting in Mechanical Guide" there is a section called "Perform Solution While Specifying Solution Handler and the Number of Cores" which looks like this:
# Get the existing My Computer, Background solve configuration config = ExtAPI.Application.SolveConfigurations["My Computer, Background"] config.SetAsDefault() for cores in range(8,13): config.SolveProcessSettings.MaxNumberOfCores = cores Model.Analyses[0].Solution.ClearGeneratedData() # pass in True to wait for the solve to complete Model.Analyses[0].Solution.Solve(True) Model.Analyses[0].Solution.GetResults() elapsed_time = Model.Analyses[0].Solution.ElapsedRunTime print "%d cores took %d secs" % (cores, elapsed_time)
but it doesn't work (at least when running 23R2 version). ANSYS, please let us, users, know, how to fix this code be able to control number of cores within ACT scripting.
0