Record Class ParallelConfig
java.lang.Object
java.lang.Record
smile.llm.parallel.ParallelConfig
- Record Components:
tpSize- tensor-parallel size (must divide attention / FFN widths).ppSize- pipeline-parallel size (must be1until phase 2).dpSize- data-parallel size (must be1in phase 1).devices- CUDA device indices for local TP ranks (length == tpSize).
Process-mesh configuration for tensor / pipeline / data parallelism.
worldSize == tpSize * ppSize * dpSize. Phase 1 uses ppSize=1
and dpSize=1; pipeline axes are reserved for multi-node PP.
-
Constructor Summary
ConstructorsConstructorDescriptionParallelConfig(int tpSize, int ppSize, int dpSize, byte[] devices) Validates mesh sizes and defensively copiesdevices. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]devices()Returns the value of thedevicesrecord component.intdpSize()Returns the value of thedpSizerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns whether tensor parallelism is enabled.intppSize()Returns the value of theppSizerecord component.static ParallelConfigsingle(byte device) Single-device (no parallelism).static ParallelConfigtensorParallel(byte... devices) Tensor-parallel group on the given CUDA devices.final StringtoString()Returns a string representation of this record class.inttpSize()Returns the value of thetpSizerecord component.intReturnstpSize * ppSize * dpSize.
-
Constructor Details
-
ParallelConfig
public ParallelConfig(int tpSize, int ppSize, int dpSize, byte[] devices) Validates mesh sizes and defensively copiesdevices.
-
-
Method Details
-
single
Single-device (no parallelism).- Parameters:
device- CUDA device index.- Returns:
- config with
tpSize=1.
-
tensorParallel
Tensor-parallel group on the given CUDA devices.- Parameters:
devices- CUDA device indices (lengthbecomestpSize).- Returns:
- tensor-parallel config.
-
worldSize
public int worldSize()ReturnstpSize * ppSize * dpSize.- Returns:
- world size.
-
isTensorParallel
public boolean isTensorParallel()Returns whether tensor parallelism is enabled.- Returns:
trueiftpSize > 1.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
tpSize
-
ppSize
-
dpSize
-
devices
-