DEFAULT_MERGE_BATCH_SIZE
module-attribute
DEFAULT_MERGE_BATCH_SIZE = 8
MERGE_TREE_THRESHOLD
module-attribute
MERGE_TREE_THRESHOLD = 64
DistributedBruteforceGPUSampler
Bases: Sampler
parameters
property
parameters: Dict[str, Any]
properties
property
properties: Dict[str, Any]
sample
sample(bqm, num_states, num_fixed_vars, suffix_size, grid_size, block_size, num_steps_per_kernel=1, partial_diff_buffer_depth=1, dtype=np.float32, merge_batch_size=None)
Solve Binary Quadratic Model by distributing an exhaustive search over Ray workers.
The search is split by fixing num_fixed_vars variables to all of their 2 ** num_fixed_vars possible assignments. Each assignment defines an independent subproblem over the remaining variables, which is dispatched as a Ray task and solved by the GPU kernel on one worker. There is no communication between workers during the search; the partial results are combined afterwards by a hierarchy of merge tasks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bqm
|
Binary Quadratic Model instance to solve. |
required | |
num_states
|
number of lowest energy states to compute. |
required | |
num_fixed_vars
|
number k of variables to fix, giving 2 ** k independent
subproblems over |
required | |
suffix_size
|
exponent l such that 2 ** l configurations are kept in the GPU
working set at a time (see :meth: |
required | |
grid_size
|
number of blocks for the custom kernels. |
required | |
block_size
|
number of threads per block for the custom kernels. |
required | |
num_steps_per_kernel
|
number of chunks processed by a single kernel launch. |
1
|
|
partial_diff_buffer_depth
|
depth of the incremental energy difference buffers. |
1
|
|
dtype
|
datatype to use, either np.float32 or np.float64, or one of the names
accepted by :func: |
float32
|
|
merge_batch_size
|
|
None
|
Returns:
| Type | Description |
|---|---|
|
sample set containing num_states samples. Its |
Raises:
| Type | Description |
|---|---|
ValueError
|
if num_fixed_vars or merge_batch_size is out of range, if the resulting subproblems cannot be enumerated by the kernels, or if dtype is not a supported precision. |