Configuration#

An instance of Configuration is passed to makeFactory() to provide parameters and their values for constructing a factory.

Parameter

Default value

Notes

architecture

Architecture.detect

value is an hpk.Architecture

threads

0 => detectCores()

int, where -n => ncores - n

teams

0 => detectPackages()

int, where -n => npkgs - n

l1size

0 => detectDataCache(1).size

int, L1 size measured in KiB

l2size

0 => detectDataCache(2).size

int, L2 size measured in KiB

l3size

0 => detectDataCache(3).size

int, L3 size measured in KiB

The threads parameter sets the maximum number of threads that can be used by a compute object. Note that the default is the number of cores, not the number of cpus. On a core with hyperthreading, you can try setting threads to the value returned by detectCpus().

The teams parameter may be used by a factory to determine how to divvy up the threads among work items. Similarly, cache sizes are used to guide how the problem is decomposed into work items.

See Also:

ENUMERATION

class hpk.Parameter(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#
architecture = 1#
invalid = 0#
l1size = 273#
l2size = 274#
l3size = 275#
teams = 257#
threads = 256#

CLASS

class hpk.Configuration#

A container for parameters and their associated values.

Configuration.__init__(self) None#
Configuration.__init__(self, arg: collections.abc.Sequence[hpk.ConfigItem], /) None

Initialize from a list in which each item is either an Architecture or is a key and an int value, (Parameter, int).

Configuration.get(self, param: hpk.Parameter) int#

Returns the int value for the specified parameter. If a value for the parameter was not set, returns zero.

Configuration.getArchitecture(self) hpk.Architecture#

Returns the Architecture that was set in this configuration. If an architecture was not set, it returns Architecture.detect.