@mdboom's commentary: This all seems pretty low stakes, but now is the time to address any inconsistencies before 1.0.0.
Summary
An audit of all public class names in cuda.core found three categories of naming inconsistency: a terminology mismatch ("Config" vs "Options"), one unusual abbreviation, and several PEP 8 acronym-capitalization violations in the cuda.core.system submodule.
Original prompt
Can you please look at all classes exposed in the public API of cuda_core. I want you to look just at the names of the classes, not any members or methods. Please make sure they are all PEP8 compliant and that the same words are used for the same concepts.
Findings
1. "Config" vs "Options" inconsistency
LaunchConfig is the only class that uses "Config" for a configuration/options object. Every other such class uses "Options":
| Pattern-breaker |
Consistent peers |
LaunchConfig |
EventOptions, LinkerOptions, StreamOptions, ProgramOptions, DeviceMemoryResourceOptions, ManagedMemoryResourceOptions, PinnedMemoryResourceOptions, VirtualMemoryResourceOptions, TensorMapDescriptorOptions, GraphAllocOptions, GraphCompleteOptions, GraphDebugPrintOptions |
Suggestion: LaunchConfig → LaunchOptions
2. GraphDef abbreviation
GraphDef abbreviates "Definition" while the rest of the API spells words out (e.g. TensorMapDescriptor, not TensorMapDesc; ConditionalNode, not CondNode). The AllocNode / GraphAllocOptions abbreviations are defensible since "alloc/free" are standard CUDA/C terms, but GraphDef is less conventional.
Suggestion: GraphDef → GraphDefinition
3. Acronym capitalization (PEP 8 violation in cuda.core.system)
PEP 8 says: "When using abbreviations in CapWords, capitalize all the letters of the abbreviation. Thus HTTPServerError is better than HttpServerError."
The system module is internally inconsistent — P2P and BAR1 are correctly all-caps, while other acronyms are treated as regular CamelCase words:
| Current name |
PEP 8 name |
Acronym |
GpuDynamicPstatesInfo |
GPUDynamicPStatesInfo |
GPU, PStates |
GpuDynamicPstatesUtilization |
GPUDynamicPStatesUtilization |
GPU, PStates |
GpuP2PCapsIndex |
GPUP2PCapsIndex |
GPU |
GpuP2PStatus |
GPUP2PStatus |
GPU |
GpuTopologyLevel |
GPUTopologyLevel |
GPU |
Pstates |
PStates |
PStates |
PcieUtilCounter |
PCIeUtilCounter |
PCIe |
PciInfo |
PCIInfo |
PCI |
GpuIsLostError |
GPUIsLostError |
GPU |
GpuNotFoundError |
GPUNotFoundError |
GPU |
VgpuEccNotSupportedError |
VGPUECCNotSupportedError |
VGPU, ECC |
IrqIssueError |
IRQIssueError |
IRQ |
LibRmVersionMismatchError |
LibRMVersionMismatchError |
RM |
Note: BAR1MemoryInfo, GpuP2PCapsIndex (the P2P part), and GpuP2PStatus (the P2P part) already correctly capitalize their acronyms, making the inconsistency with Gpu, Pci, etc. more visible.
What already looks good
- All class names use CamelCase (PEP 8 compliant).
- The
*MemoryResource / *MemoryResourceOptions family is consistently named.
- The
*Node subclasses in cuda.core.graph are consistently named.
- The
*Error exception classes consistently use the Error suffix.
Event/EventOptions, Stream/StreamOptions, Program/ProgramOptions, Linker/LinkerOptions all follow the same pairing pattern.
Recommended changes by priority
LaunchConfig → LaunchOptions — terminology inconsistency with the rest of the API
GraphDef → GraphDefinition — unusual abbreviation
- Acronym capitalization in
cuda.core.system — 13 classes violate PEP 8's explicit acronym rule and are internally inconsistent with P2P/BAR1 in the same module
@mdboom's commentary: This all seems pretty low stakes, but now is the time to address any inconsistencies before 1.0.0.
Summary
An audit of all public class names in
cuda.corefound three categories of naming inconsistency: a terminology mismatch ("Config" vs "Options"), one unusual abbreviation, and several PEP 8 acronym-capitalization violations in thecuda.core.systemsubmodule.Original prompt
Findings
1. "Config" vs "Options" inconsistency
LaunchConfigis the only class that uses "Config" for a configuration/options object. Every other such class uses "Options":LaunchConfigEventOptions,LinkerOptions,StreamOptions,ProgramOptions,DeviceMemoryResourceOptions,ManagedMemoryResourceOptions,PinnedMemoryResourceOptions,VirtualMemoryResourceOptions,TensorMapDescriptorOptions,GraphAllocOptions,GraphCompleteOptions,GraphDebugPrintOptionsSuggestion:
LaunchConfig→LaunchOptions2.
GraphDefabbreviationGraphDefabbreviates "Definition" while the rest of the API spells words out (e.g.TensorMapDescriptor, notTensorMapDesc;ConditionalNode, notCondNode). TheAllocNode/GraphAllocOptionsabbreviations are defensible since "alloc/free" are standard CUDA/C terms, butGraphDefis less conventional.Suggestion:
GraphDef→GraphDefinition3. Acronym capitalization (PEP 8 violation in
cuda.core.system)PEP 8 says: "When using abbreviations in CapWords, capitalize all the letters of the abbreviation. Thus
HTTPServerErroris better thanHttpServerError."The system module is internally inconsistent —
P2PandBAR1are correctly all-caps, while other acronyms are treated as regular CamelCase words:GpuDynamicPstatesInfoGPUDynamicPStatesInfoGpuDynamicPstatesUtilizationGPUDynamicPStatesUtilizationGpuP2PCapsIndexGPUP2PCapsIndexGpuP2PStatusGPUP2PStatusGpuTopologyLevelGPUTopologyLevelPstatesPStatesPcieUtilCounterPCIeUtilCounterPciInfoPCIInfoGpuIsLostErrorGPUIsLostErrorGpuNotFoundErrorGPUNotFoundErrorVgpuEccNotSupportedErrorVGPUECCNotSupportedErrorIrqIssueErrorIRQIssueErrorLibRmVersionMismatchErrorLibRMVersionMismatchErrorNote:
BAR1MemoryInfo,GpuP2PCapsIndex(theP2Ppart), andGpuP2PStatus(theP2Ppart) already correctly capitalize their acronyms, making the inconsistency withGpu,Pci, etc. more visible.What already looks good
*MemoryResource/*MemoryResourceOptionsfamily is consistently named.*Nodesubclasses incuda.core.graphare consistently named.*Errorexception classes consistently use theErrorsuffix.Event/EventOptions,Stream/StreamOptions,Program/ProgramOptions,Linker/LinkerOptionsall follow the same pairing pattern.Recommended changes by priority
LaunchConfig→LaunchOptions— terminology inconsistency with the rest of the APIGraphDef→GraphDefinition— unusual abbreviationcuda.core.system— 13 classes violate PEP 8's explicit acronym rule and are internally inconsistent withP2P/BAR1in the same module