Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
lint:
runs-on: macos-26
steps:
- uses: actions/checkout@v6
- name: SwiftFormat
run: swiftformat --lint --strict . --reporter github-actions-log

build:
runs-on: [self-hosted, linux, nvidia, gpu]
container: ghcr.io/dataparallel-swift/swift:6.1
steps:
- uses: actions/checkout@v6

- uses: actions/cache@v5
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-

- name: Build
run: swift build

- name: Test
run: swift run nvidia-device-query
92 changes: 92 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,95 @@
--header "Copyright (c) {year} The swift-cuda authors. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License."

# rules
--disable extensionAccessControl
--allman false
--binarygrouping none
--decimalgrouping 3,5
--disable redundantSelf,trailingClosures
--elseposition next-line
--exponentcase uppercase
--guardelse same-line
--hexliteralcase lowercase
--indent 4
--indentcase true
--ifdef no-indent
--maxwidth 140
--self insert
--semicolons never
--swiftversion 6
--trimwhitespace always
--storedvarattrs prev-line
--computedvarattrs prev-line
--typeattributes prev-line
--wrapparameters before-first
--wrapcollections before-first
--wraparguments before-first

# Explicitly enable rules to prevent automatic opt-in
# Generated from `swiftformat --rules` on v0.47.1
--rules andOperator
--rules anyObjectProtocol
--rules blankLinesAroundMark
--rules blankLinesAtEndOfScope
--rules blankLinesAtStartOfScope
--rules blankLinesBetweenScopes
--rules braces
--rules consecutiveBlankLines
--rules consecutiveSpaces
--rules duplicateImports
--rules elseOnSameLine
--rules emptyBraces
--rules enumNamespaces
--rules fileHeader
--rules hoistPatternLet
--rules indent
--rules initCoderUnavailable
--rules leadingDelimiters
--rules linebreakAtEndOfFile
--rules linebreaks
--rules modifierOrder
--rules numberFormatting
--rules preferKeyPath
--rules redundantBackticks
--rules redundantBreak
--rules redundantExtensionACL
--rules redundantFileprivate
--rules redundantGet
--rules redundantInit
--rules redundantLet
--rules redundantLetError
--rules redundantNilInit
--rules redundantObjc
--rules redundantParens
--rules redundantPattern
--rules redundantRawValues
--rules redundantReturn
--rules redundantSelf
--rules redundantType
--rules semicolons
--rules sortImports
--rules spaceAroundBraces
--rules spaceAroundBrackets
--rules spaceAroundComments
--rules spaceAroundGenerics
--rules spaceAroundOperators
--rules spaceAroundParens
--rules spaceInsideBraces
--rules spaceInsideBrackets
--rules spaceInsideComments
--rules spaceInsideGenerics
--rules spaceInsideParens
--rules strongOutlets
--rules strongifiedSelf
--rules todos
--rules trailingClosures
--rules trailingCommas
--rules trailingSpace
--rules unusedArguments
--rules void
--rules wrap
--rules wrapArguments
--rules wrapAttributes
--rules wrapMultilineStatementBraces
--rules wrapSingleLineComments
--rules yodaConditions
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
publicHeadersPath: ".",
linkerSettings: [
.linkedLibrary("cupti"),
],
]
),
.executableTarget(
name: "nvidia-device-query",
Expand Down
4 changes: 2 additions & 2 deletions Sources/nvidia-device-query/main.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2025 The swift-cuda authors. All rights reserved.
// Copyright (c) 2026 The swift-cuda authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -183,7 +183,7 @@ else {
print("Device \(devid): \(name)")
print(" CUDA capability: \(major).\(minor)")
print(" CUDA cores: \(coresPerMP * multiProcessorCount) cores in \(multiProcessorCount) multiprocessors (\(coresPerMP) cores/MP)")
print(" Global memory: \(totalGlobalMem / 1048576) MB")
print(" Global memory: \(totalGlobalMem / 1_048_576) MB")
print(" Constant memory: \(totalConstantMem / 1024) kB")
print(" Shared memory per block: \(sharedMemoryPerBlock / 1024) kB")
print(" L2 cache per block: \(l2CacheSize / 1024) kB")
Expand Down
Loading