AutotunedObject¶
- class hoomd.operation.AutotunedObject¶
An object with autotuned kernel parameters.
AutotunedObject
instances may complete portions of their computation with one or more GPU kernels. Each GPU kernel is executed with a set of parameters (kernel_parameters
) that influence the run time of the execution. After initialization,AutotunedObject
varies these parameters as the simulation runs and searches for the best performing combination. The optimal parameters depend on your system’s size, density, force field parameters, the specific hardware you execute on, and more.Check
is_tuning_complete
to check if the search is complete. After the search is complete,AutotunedObject
holds the parameters constant at the optimal values. Typical operations require thousands of time steps to complete tuning. Some may take tens of thousands or more depending on the parameters you set.Tip
When you significantly change your system during the simulation (e.g. compress to a higher density), then you can tune the parameters again after with
tune_kernel_parameters
. This step is optional, but may increase performance as the new system parameters may lead to different optimal parameters.Note
In MPI parallel execution, all methods and attributes of
AutotunedObject
reference the rank local tuner objects. Different ranks may tune different optimal kernel parameters and may complete tuning at different times. Use onlyhoomd.Operations.is_tuning_complete
in control flow operations, as this method is reduced across all ranks.- property is_tuning_complete¶
Check if kernel parameter tuning is complete.
True
when tuning is complete andkernel_parameters
has locked optimal parameters for all active kernels used by this object.Example:
while not operation.is_tuning_complete: simulation.run(1000)
- Type:
- property kernel_parameters¶
Kernel parameters.
The dictionary maps GPU kernel names to tuples of integers that control how the kernel executes on the GPU. These values will change during the tuning process and remain static after tuning completes. Set the kernel parameters for one or more kernels to force specific values and stop tuning.
Warning
The keys and valid values in this dictionary depend on the hardware device, the HOOMD-blue version, and the value of class attributes. Keys and/or valid values may change even with new patch releases of HOOMD-blue.
Provided that you use the same HOOMD-blue binary on the same hardware and execute a script with the same parameters, you may save the tuned values from one run and load them in the next.
Examples:
kernel_parameters = operation.kernel_parameters
operation.kernel_parameters = kernel_parameters
- tune_kernel_parameters()¶
Start tuning kernel parameters.
After calling
tune_kernel_parameters
,AutotunedObject
will vary the kernel parameters in subsequent time steps, check the run time of each, and lock to the fastest performing parameters after the scan is complete.Example:
operation.tune_kernel_parameters()