synop-rs 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- synop_rs-0.0.1/.gitignore +29 -0
- synop_rs-0.0.1/Cargo.lock +180 -0
- synop_rs-0.0.1/Cargo.toml +26 -0
- synop_rs-0.0.1/LICENSE-APACHE +199 -0
- synop_rs-0.0.1/LICENSE-MIT +21 -0
- synop_rs-0.0.1/PKG-INFO +155 -0
- synop_rs-0.0.1/README.md +123 -0
- synop_rs-0.0.1/SynOP_logo.png +0 -0
- synop_rs-0.0.1/pyproject.toml +50 -0
- synop_rs-0.0.1/src/lib.rs +112 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Rust build artifacts
|
|
2
|
+
/target
|
|
3
|
+
**/*.rs.bk
|
|
4
|
+
Cargo.lock
|
|
5
|
+
|
|
6
|
+
# Python / maturin artifacts
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.py[cod]
|
|
9
|
+
*$py.class
|
|
10
|
+
*.so
|
|
11
|
+
*.pyd
|
|
12
|
+
*.dylib
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
build/
|
|
16
|
+
dist/
|
|
17
|
+
wheels/
|
|
18
|
+
*.egg-info/
|
|
19
|
+
.pytest_cache/
|
|
20
|
+
.mypy_cache/
|
|
21
|
+
.ruff_cache/
|
|
22
|
+
|
|
23
|
+
# Editor & OS files
|
|
24
|
+
.DS_Store
|
|
25
|
+
Thumbs.db
|
|
26
|
+
.vscode/
|
|
27
|
+
.idea/
|
|
28
|
+
*.swp
|
|
29
|
+
*.swo
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 3
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.5.1"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "cfg-if"
|
|
13
|
+
version = "1.0.5"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "heck"
|
|
19
|
+
version = "0.5.0"
|
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
22
|
+
|
|
23
|
+
[[package]]
|
|
24
|
+
name = "indoc"
|
|
25
|
+
version = "2.0.8"
|
|
26
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
+
checksum = "a37b2691796cffeb8a8cd305ac66e65841559f147f4e63231d0eafa4db5384d1"
|
|
28
|
+
dependencies = [
|
|
29
|
+
"rustversion",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[[package]]
|
|
33
|
+
name = "libc"
|
|
34
|
+
version = "0.2.191"
|
|
35
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
36
|
+
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
|
|
37
|
+
|
|
38
|
+
[[package]]
|
|
39
|
+
name = "memoffset"
|
|
40
|
+
version = "0.9.1"
|
|
41
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
42
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
43
|
+
dependencies = [
|
|
44
|
+
"autocfg",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[[package]]
|
|
48
|
+
name = "once_cell"
|
|
49
|
+
version = "1.21.4"
|
|
50
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
51
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
52
|
+
|
|
53
|
+
[[package]]
|
|
54
|
+
name = "portable-atomic"
|
|
55
|
+
version = "1.15.0"
|
|
56
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
57
|
+
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
|
58
|
+
|
|
59
|
+
[[package]]
|
|
60
|
+
name = "proc-macro2"
|
|
61
|
+
version = "1.0.107"
|
|
62
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
63
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
64
|
+
dependencies = [
|
|
65
|
+
"unicode-ident",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
[[package]]
|
|
69
|
+
name = "pyo3"
|
|
70
|
+
version = "0.23.5"
|
|
71
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
72
|
+
checksum = "7778bffd85cf38175ac1f545509665d0b9b92a198ca7941f131f85f7a4f9a872"
|
|
73
|
+
dependencies = [
|
|
74
|
+
"cfg-if",
|
|
75
|
+
"indoc",
|
|
76
|
+
"libc",
|
|
77
|
+
"memoffset",
|
|
78
|
+
"once_cell",
|
|
79
|
+
"portable-atomic",
|
|
80
|
+
"pyo3-build-config",
|
|
81
|
+
"pyo3-ffi",
|
|
82
|
+
"pyo3-macros",
|
|
83
|
+
"unindent",
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
[[package]]
|
|
87
|
+
name = "pyo3-build-config"
|
|
88
|
+
version = "0.23.5"
|
|
89
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
90
|
+
checksum = "94f6cbe86ef3bf18998d9df6e0f3fc1050a8c5efa409bf712e661a4366e010fb"
|
|
91
|
+
dependencies = [
|
|
92
|
+
"once_cell",
|
|
93
|
+
"target-lexicon",
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
[[package]]
|
|
97
|
+
name = "pyo3-ffi"
|
|
98
|
+
version = "0.23.5"
|
|
99
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
100
|
+
checksum = "e9f1b4c431c0bb1c8fb0a338709859eed0d030ff6daa34368d3b152a63dfdd8d"
|
|
101
|
+
dependencies = [
|
|
102
|
+
"libc",
|
|
103
|
+
"pyo3-build-config",
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
[[package]]
|
|
107
|
+
name = "pyo3-macros"
|
|
108
|
+
version = "0.23.5"
|
|
109
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
110
|
+
checksum = "fbc2201328f63c4710f68abdf653c89d8dbc2858b88c5d88b0ff38a75288a9da"
|
|
111
|
+
dependencies = [
|
|
112
|
+
"proc-macro2",
|
|
113
|
+
"pyo3-macros-backend",
|
|
114
|
+
"quote",
|
|
115
|
+
"syn",
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
[[package]]
|
|
119
|
+
name = "pyo3-macros-backend"
|
|
120
|
+
version = "0.23.5"
|
|
121
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
122
|
+
checksum = "fca6726ad0f3da9c9de093d6f116a93c1a38e417ed73bf138472cf4064f72028"
|
|
123
|
+
dependencies = [
|
|
124
|
+
"heck",
|
|
125
|
+
"proc-macro2",
|
|
126
|
+
"pyo3-build-config",
|
|
127
|
+
"quote",
|
|
128
|
+
"syn",
|
|
129
|
+
]
|
|
130
|
+
|
|
131
|
+
[[package]]
|
|
132
|
+
name = "quote"
|
|
133
|
+
version = "1.0.47"
|
|
134
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
135
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
136
|
+
dependencies = [
|
|
137
|
+
"proc-macro2",
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
[[package]]
|
|
141
|
+
name = "rustversion"
|
|
142
|
+
version = "1.0.23"
|
|
143
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
144
|
+
checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
|
|
145
|
+
|
|
146
|
+
[[package]]
|
|
147
|
+
name = "syn"
|
|
148
|
+
version = "2.0.119"
|
|
149
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
150
|
+
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
|
151
|
+
dependencies = [
|
|
152
|
+
"proc-macro2",
|
|
153
|
+
"quote",
|
|
154
|
+
"unicode-ident",
|
|
155
|
+
]
|
|
156
|
+
|
|
157
|
+
[[package]]
|
|
158
|
+
name = "synop"
|
|
159
|
+
version = "0.0.1"
|
|
160
|
+
dependencies = [
|
|
161
|
+
"pyo3",
|
|
162
|
+
]
|
|
163
|
+
|
|
164
|
+
[[package]]
|
|
165
|
+
name = "target-lexicon"
|
|
166
|
+
version = "0.12.16"
|
|
167
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
168
|
+
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
|
169
|
+
|
|
170
|
+
[[package]]
|
|
171
|
+
name = "unicode-ident"
|
|
172
|
+
version = "1.0.27"
|
|
173
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
174
|
+
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
|
175
|
+
|
|
176
|
+
[[package]]
|
|
177
|
+
name = "unindent"
|
|
178
|
+
version = "0.2.4"
|
|
179
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
180
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "synop"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
rust-version = "1.75"
|
|
6
|
+
description = "Pure Rust-native multi-hardware (GPU/TPU/NPU) deep learning framework"
|
|
7
|
+
license = "MIT OR Apache-2.0"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
repository = "https://github.com/synop-rs/SynOP"
|
|
10
|
+
homepage = "https://github.com/synop-rs/SynOP"
|
|
11
|
+
documentation = "https://docs.rs/synop"
|
|
12
|
+
keywords = ["deep-learning", "machine-learning", "tensor", "gpu", "ai"]
|
|
13
|
+
categories = ["science", "algorithms", "hardware-support"]
|
|
14
|
+
exclude = [".github/", "target/"]
|
|
15
|
+
|
|
16
|
+
[lib]
|
|
17
|
+
name = "synop"
|
|
18
|
+
crate-type = ["cdylib", "rlib"]
|
|
19
|
+
|
|
20
|
+
[features]
|
|
21
|
+
default = []
|
|
22
|
+
python = ["dep:pyo3"]
|
|
23
|
+
extension-module = ["python", "pyo3/extension-module"]
|
|
24
|
+
|
|
25
|
+
[dependencies]
|
|
26
|
+
pyo3 = { version = "0.23", optional = true }
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from transformation or
|
|
31
|
+
translation of a Source form, including but not limited to compiled
|
|
32
|
+
object code, generated documentation, and conversions to other
|
|
33
|
+
media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any form, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind) by name to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code tracking systems,
|
|
57
|
+
and issue tracking systems that are managed by or on behalf of the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated into the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in legal proceedings) alleging that the
|
|
84
|
+
Work or a Contribution incorporated within the Work constitutes
|
|
85
|
+
direct or indirect patent infringement, then any patent licenses
|
|
86
|
+
grantable to You under this License for that Work shall terminate
|
|
87
|
+
as of the date of such litigation.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the Work; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright notices, patent notices,
|
|
102
|
+
trademark notices, and other attribution notices from the
|
|
103
|
+
Source form of the Work, excluding those notices that do not
|
|
104
|
+
pertain to any part of the Work; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "Notice" file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of this License and a Notice file, if
|
|
109
|
+
the Work includes a Notice file, in at least one of the following
|
|
110
|
+
places: within a Notice file distributed as part of the Work;
|
|
111
|
+
within the Source form or documentation, if provided along with
|
|
112
|
+
the Derivative Works; or, within a display generated by the
|
|
113
|
+
Derivative Works, if and wherever such third-party notices
|
|
114
|
+
normally appear. The contents of the Notice file are for
|
|
115
|
+
informational purposes only and do not modify the License. You
|
|
116
|
+
may add Your own attribution notices, within Derivative Works
|
|
117
|
+
that You distribute, alongside or as an addendum to the Notice
|
|
118
|
+
text from the Work, provided that such additional notices cannot
|
|
119
|
+
be construed as part of the License.
|
|
120
|
+
|
|
121
|
+
You may add Your own copyright notices, within Derivative Works
|
|
122
|
+
that You distribute, alongside or as an addendum to the Notice
|
|
123
|
+
text from the Work, provided that such additional notices cannot
|
|
124
|
+
be construed as part of the License.
|
|
125
|
+
|
|
126
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
127
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
128
|
+
by You to Licensor for inclusion in the Work shall be under the
|
|
129
|
+
terms and conditions of this License, without any additional terms or
|
|
130
|
+
conditions. Notwithstanding the above, nothing herein shall supersede
|
|
131
|
+
or modify the terms of any separate license agreement you may have
|
|
132
|
+
with Licensor.
|
|
133
|
+
|
|
134
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
135
|
+
names, trademarks, or service names of the Licensor, except as
|
|
136
|
+
required for reasonable and fair use in describing the origin of the
|
|
137
|
+
Work and reproducing the content of the Work.
|
|
138
|
+
|
|
139
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
140
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
141
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
142
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
143
|
+
implied, including but not limited to the rights to use, copy,
|
|
144
|
+
modify, merge, publish, distribute, sublicense, and/or sell
|
|
145
|
+
copies of the Software, and to permit persons to whom the Work is
|
|
146
|
+
furnished to do so, subject to the following conditions:
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of the use or redistribution of the Work and assume
|
|
152
|
+
any risks associated with Your exercise of permissions granted by
|
|
153
|
+
this License.
|
|
154
|
+
|
|
155
|
+
8. Limitation of Warranty. In no event and under no legal theory,
|
|
156
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
157
|
+
unless required by applicable law or agreed to in writing, shall
|
|
158
|
+
any Contributor be liable to You for damages, including any direct,
|
|
159
|
+
indirect, special, incidental, or consequential damages of any
|
|
160
|
+
character arising as of the date of this License (including but not
|
|
161
|
+
limited to damages for loss of goodwill, work stoppage, computer
|
|
162
|
+
failure or malfunction, or any and all other commercial damages or
|
|
163
|
+
losses), even if such Contributor has been advised of the possibility
|
|
164
|
+
of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and accept support, warranty, or additional liability obligations
|
|
169
|
+
and/or rights consistent with this License. However, in accepting
|
|
170
|
+
such obligations, You may act only on Your own behalf and on Your
|
|
171
|
+
sole responsibility, and not on behalf of any other Contributor,
|
|
172
|
+
and only if You agree to indemnify, defend, and hold Licensor
|
|
173
|
+
harmless for any liability incurred by, or claimed against, You
|
|
174
|
+
by reason of your acceptance of such warranty or additional
|
|
175
|
+
liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your Work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your Work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be replaced with the following
|
|
185
|
+
boilerplate notice:
|
|
186
|
+
|
|
187
|
+
Copyright 2026 SynOP Contributors
|
|
188
|
+
|
|
189
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
190
|
+
you may not use this file except in compliance with the License.
|
|
191
|
+
You may obtain a copy of the License at
|
|
192
|
+
|
|
193
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
194
|
+
|
|
195
|
+
Unless required by applicable law or agreed to in writing, software
|
|
196
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
197
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
198
|
+
See the License for the specific language governing permissions and
|
|
199
|
+
limitations under the License.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SynOP Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
synop_rs-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: synop-rs
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Classifier: Development Status :: 1 - Planning
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: Intended Audience :: Science/Research
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Rust
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
License-File: LICENSE-APACHE
|
|
20
|
+
License-File: LICENSE-MIT
|
|
21
|
+
Summary: Pure Rust-native multi-hardware (GPU/TPU/NPU) deep learning framework
|
|
22
|
+
Keywords: deep-learning,machine-learning,pytorch,rust,tensor,gpu,tpu,npu
|
|
23
|
+
Home-Page: https://github.com/synop-rs/SynOP
|
|
24
|
+
Author: SynOP Contributors
|
|
25
|
+
License: MIT OR Apache-2.0
|
|
26
|
+
Requires-Python: >=3.9
|
|
27
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
28
|
+
Project-URL: Homepage, https://github.com/synop-rs/SynOP
|
|
29
|
+
Project-URL: Issues, https://github.com/synop-rs/SynOP/issues
|
|
30
|
+
Project-URL: Repository, https://github.com/synop-rs/SynOP
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<img src="https://raw.githubusercontent.com/synop-rs/SynOP/main/SynOP_logo.png" alt="SynOP — Rust-Native Multi-Hardware Neural Framework" width="280" />
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
<h1 align="center">SynOP</h1>
|
|
37
|
+
|
|
38
|
+
<p align="center">
|
|
39
|
+
<strong>Pure Rust-Native Multi-Hardware (GPU / TPU / NPU) Deep Learning Framework</strong>
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
<p align="center">
|
|
43
|
+
<a href="https://crates.io/crates/synop"><img src="https://img.shields.io/crates/v/synop.svg" alt="Crates.io" /></a>
|
|
44
|
+
<a href="https://pypi.org/project/synop-rs/"><img src="https://img.shields.io/pypi/v/synop-rs.svg" alt="PyPI" /></a>
|
|
45
|
+
<a href="LICENSE-MIT"><img src="https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg" alt="License: MIT OR Apache-2.0" /></a>
|
|
46
|
+
<img src="https://img.shields.io/badge/rust-1.75%2B-orange.svg" alt="Rust 1.75+" />
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
> **Project Status (`v0.0.1`)**: Early scaffolding and architecture phase. Core tensor primitives, autograd engine, and hardware backends are under active development.
|
|
52
|
+
|
|
53
|
+
## Vision
|
|
54
|
+
|
|
55
|
+
Modern deep learning workloads are no longer confined to a single vendor's GPU ecosystem. Yet most training and inference stacks remain tightly coupled to C++ runtimes, brittle Python glue, and hardware-specific silos.
|
|
56
|
+
|
|
57
|
+
**SynOP** is built from the ground up in **pure Rust** to serve as a modern, high-performance alternative to PyTorch across heterogeneous accelerators:
|
|
58
|
+
|
|
59
|
+
- **Rust-Native Core**: A memory-safe, zero-overhead execution engine written in Rust—eliminating GIL bottlenecks, legacy C++ build complexity, and unsafe memory surprises.
|
|
60
|
+
- **PyTorch-Class Ergonomics in Python & Rust**: First-class Rust crate (`crates.io`) alongside native Python bindings (`PyPI`) built with **PyO3 + maturin**, combining familiar eager deep learning APIs with compiled Rust performance.
|
|
61
|
+
- **Unified Multi-Hardware Architecture**: A single operator IR and backend trait abstraction engineered for **GPUs** (CUDA, ROCm, Metal, Vulkan/WebGPU), **TPUs**, and **NPUs** without rewriting model code.
|
|
62
|
+
- **End-to-End Compilation & Portability**: From local research prototyping to distributed multi-accelerator training and edge deployment—one framework, one IR, every accelerator.
|
|
63
|
+
|
|
64
|
+
## Planned Architecture
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
+---------------------------------------------------------------+
|
|
68
|
+
| Python API (PyO3 / maturin) | Native Rust API |
|
|
69
|
+
+---------------------------------------------------------------+
|
|
70
|
+
| Eager Tensor, Autograd & nn Modules |
|
|
71
|
+
+---------------------------------------------------------------+
|
|
72
|
+
| Unified Operator IR & Graph Fusion Engine |
|
|
73
|
+
+---------------------------------------------------------------+
|
|
74
|
+
| CPU | CUDA / ROCm | Metal / Vulkan | TPU | NPU |
|
|
75
|
+
+---------------------------------------------------------------+
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Target Hardware Backends
|
|
79
|
+
|
|
80
|
+
| Backend | Target Devices | Status |
|
|
81
|
+
| :--- | :--- | :--- |
|
|
82
|
+
| `cpu` | x86_64 / ARM64 SIMD host execution | Planned |
|
|
83
|
+
| `cuda` / `rocm` | NVIDIA & AMD datacenter / workstation GPUs | Planned |
|
|
84
|
+
| `metal` / `vulkan` | Apple Silicon & portable cross-vendor GPUs | Planned |
|
|
85
|
+
| `tpu` | Google Cloud TPUs (PJRT / XLA bridge) | Planned |
|
|
86
|
+
| `npu` | AI accelerators & edge NPUs | Planned |
|
|
87
|
+
|
|
88
|
+
## Quick Start
|
|
89
|
+
|
|
90
|
+
### Rust
|
|
91
|
+
|
|
92
|
+
Add `synop` to your `Cargo.toml`:
|
|
93
|
+
|
|
94
|
+
```toml
|
|
95
|
+
[dependencies]
|
|
96
|
+
synop = "0.0.1"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```rust
|
|
100
|
+
use synop::{Device, target_backends, version};
|
|
101
|
+
|
|
102
|
+
fn main() {
|
|
103
|
+
println!("SynOP v{}", version());
|
|
104
|
+
println!("Default device: {}", Device::default());
|
|
105
|
+
println!("Target backends: {:?}", target_backends());
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Python
|
|
110
|
+
|
|
111
|
+
Install from PyPI (once published) or build locally with `maturin`:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
pip install synop-rs
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
import synop
|
|
119
|
+
|
|
120
|
+
print(synop.__version__)
|
|
121
|
+
print(synop.target_backends())
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Development
|
|
125
|
+
|
|
126
|
+
### Check the Rust Core
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
cargo check
|
|
130
|
+
cargo test
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Build Python Bindings Locally
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
uv tool run maturin develop
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Roadmap
|
|
140
|
+
|
|
141
|
+
- [x] **v0.0.1** — Repository structure, Rust + PyO3/maturin scaffolding, dual licensing
|
|
142
|
+
- [ ] **v0.1.0** — Core `Tensor` storage, strided views, CPU backend, and reverse-mode autograd
|
|
143
|
+
- [ ] **v0.2.0** — `nn` modules, optimizers, serialization, and PyTorch-compatible Python API
|
|
144
|
+
- [ ] **v0.3.0** — GPU backends (CUDA / Metal / Vulkan) with unified kernel dispatch
|
|
145
|
+
- [ ] **v0.4.0** — TPU & NPU backend plugins, graph capture, and operator fusion
|
|
146
|
+
|
|
147
|
+
## License
|
|
148
|
+
|
|
149
|
+
SynOP is dual-licensed under either of the following licenses, at your option:
|
|
150
|
+
|
|
151
|
+
- **MIT License** ([LICENSE-MIT](LICENSE-MIT) or <https://opensource.org/licenses/MIT>)
|
|
152
|
+
- **Apache License, Version 2.0** ([LICENSE-APACHE](LICENSE-APACHE) or <https://www.apache.org/licenses/LICENSE-2.0>)
|
|
153
|
+
|
|
154
|
+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in SynOP by you, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.
|
|
155
|
+
|
synop_rs-0.0.1/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/synop-rs/SynOP/main/SynOP_logo.png" alt="SynOP — Rust-Native Multi-Hardware Neural Framework" width="280" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">SynOP</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>Pure Rust-Native Multi-Hardware (GPU / TPU / NPU) Deep Learning Framework</strong>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://crates.io/crates/synop"><img src="https://img.shields.io/crates/v/synop.svg" alt="Crates.io" /></a>
|
|
13
|
+
<a href="https://pypi.org/project/synop-rs/"><img src="https://img.shields.io/pypi/v/synop-rs.svg" alt="PyPI" /></a>
|
|
14
|
+
<a href="LICENSE-MIT"><img src="https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg" alt="License: MIT OR Apache-2.0" /></a>
|
|
15
|
+
<img src="https://img.shields.io/badge/rust-1.75%2B-orange.svg" alt="Rust 1.75+" />
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
> **Project Status (`v0.0.1`)**: Early scaffolding and architecture phase. Core tensor primitives, autograd engine, and hardware backends are under active development.
|
|
21
|
+
|
|
22
|
+
## Vision
|
|
23
|
+
|
|
24
|
+
Modern deep learning workloads are no longer confined to a single vendor's GPU ecosystem. Yet most training and inference stacks remain tightly coupled to C++ runtimes, brittle Python glue, and hardware-specific silos.
|
|
25
|
+
|
|
26
|
+
**SynOP** is built from the ground up in **pure Rust** to serve as a modern, high-performance alternative to PyTorch across heterogeneous accelerators:
|
|
27
|
+
|
|
28
|
+
- **Rust-Native Core**: A memory-safe, zero-overhead execution engine written in Rust—eliminating GIL bottlenecks, legacy C++ build complexity, and unsafe memory surprises.
|
|
29
|
+
- **PyTorch-Class Ergonomics in Python & Rust**: First-class Rust crate (`crates.io`) alongside native Python bindings (`PyPI`) built with **PyO3 + maturin**, combining familiar eager deep learning APIs with compiled Rust performance.
|
|
30
|
+
- **Unified Multi-Hardware Architecture**: A single operator IR and backend trait abstraction engineered for **GPUs** (CUDA, ROCm, Metal, Vulkan/WebGPU), **TPUs**, and **NPUs** without rewriting model code.
|
|
31
|
+
- **End-to-End Compilation & Portability**: From local research prototyping to distributed multi-accelerator training and edge deployment—one framework, one IR, every accelerator.
|
|
32
|
+
|
|
33
|
+
## Planned Architecture
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
+---------------------------------------------------------------+
|
|
37
|
+
| Python API (PyO3 / maturin) | Native Rust API |
|
|
38
|
+
+---------------------------------------------------------------+
|
|
39
|
+
| Eager Tensor, Autograd & nn Modules |
|
|
40
|
+
+---------------------------------------------------------------+
|
|
41
|
+
| Unified Operator IR & Graph Fusion Engine |
|
|
42
|
+
+---------------------------------------------------------------+
|
|
43
|
+
| CPU | CUDA / ROCm | Metal / Vulkan | TPU | NPU |
|
|
44
|
+
+---------------------------------------------------------------+
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Target Hardware Backends
|
|
48
|
+
|
|
49
|
+
| Backend | Target Devices | Status |
|
|
50
|
+
| :--- | :--- | :--- |
|
|
51
|
+
| `cpu` | x86_64 / ARM64 SIMD host execution | Planned |
|
|
52
|
+
| `cuda` / `rocm` | NVIDIA & AMD datacenter / workstation GPUs | Planned |
|
|
53
|
+
| `metal` / `vulkan` | Apple Silicon & portable cross-vendor GPUs | Planned |
|
|
54
|
+
| `tpu` | Google Cloud TPUs (PJRT / XLA bridge) | Planned |
|
|
55
|
+
| `npu` | AI accelerators & edge NPUs | Planned |
|
|
56
|
+
|
|
57
|
+
## Quick Start
|
|
58
|
+
|
|
59
|
+
### Rust
|
|
60
|
+
|
|
61
|
+
Add `synop` to your `Cargo.toml`:
|
|
62
|
+
|
|
63
|
+
```toml
|
|
64
|
+
[dependencies]
|
|
65
|
+
synop = "0.0.1"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```rust
|
|
69
|
+
use synop::{Device, target_backends, version};
|
|
70
|
+
|
|
71
|
+
fn main() {
|
|
72
|
+
println!("SynOP v{}", version());
|
|
73
|
+
println!("Default device: {}", Device::default());
|
|
74
|
+
println!("Target backends: {:?}", target_backends());
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Python
|
|
79
|
+
|
|
80
|
+
Install from PyPI (once published) or build locally with `maturin`:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install synop-rs
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
import synop
|
|
88
|
+
|
|
89
|
+
print(synop.__version__)
|
|
90
|
+
print(synop.target_backends())
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Development
|
|
94
|
+
|
|
95
|
+
### Check the Rust Core
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
cargo check
|
|
99
|
+
cargo test
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Build Python Bindings Locally
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
uv tool run maturin develop
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Roadmap
|
|
109
|
+
|
|
110
|
+
- [x] **v0.0.1** — Repository structure, Rust + PyO3/maturin scaffolding, dual licensing
|
|
111
|
+
- [ ] **v0.1.0** — Core `Tensor` storage, strided views, CPU backend, and reverse-mode autograd
|
|
112
|
+
- [ ] **v0.2.0** — `nn` modules, optimizers, serialization, and PyTorch-compatible Python API
|
|
113
|
+
- [ ] **v0.3.0** — GPU backends (CUDA / Metal / Vulkan) with unified kernel dispatch
|
|
114
|
+
- [ ] **v0.4.0** — TPU & NPU backend plugins, graph capture, and operator fusion
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
SynOP is dual-licensed under either of the following licenses, at your option:
|
|
119
|
+
|
|
120
|
+
- **MIT License** ([LICENSE-MIT](LICENSE-MIT) or <https://opensource.org/licenses/MIT>)
|
|
121
|
+
- **Apache License, Version 2.0** ([LICENSE-APACHE](LICENSE-APACHE) or <https://www.apache.org/licenses/LICENSE-2.0>)
|
|
122
|
+
|
|
123
|
+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in SynOP by you, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.
|
|
Binary file
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["maturin>=1.7,<2.0"]
|
|
3
|
+
build-backend = "maturin"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "synop-rs"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "Pure Rust-native multi-hardware (GPU/TPU/NPU) deep learning framework"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "MIT OR Apache-2.0" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "SynOP Contributors" },
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"deep-learning",
|
|
17
|
+
"machine-learning",
|
|
18
|
+
"pytorch",
|
|
19
|
+
"rust",
|
|
20
|
+
"tensor",
|
|
21
|
+
"gpu",
|
|
22
|
+
"tpu",
|
|
23
|
+
"npu",
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 1 - Planning",
|
|
27
|
+
"Intended Audience :: Developers",
|
|
28
|
+
"Intended Audience :: Science/Research",
|
|
29
|
+
"License :: OSI Approved :: MIT License",
|
|
30
|
+
"License :: OSI Approved :: Apache Software License",
|
|
31
|
+
"Operating System :: OS Independent",
|
|
32
|
+
"Programming Language :: Rust",
|
|
33
|
+
"Programming Language :: Python :: 3",
|
|
34
|
+
"Programming Language :: Python :: 3.9",
|
|
35
|
+
"Programming Language :: Python :: 3.10",
|
|
36
|
+
"Programming Language :: Python :: 3.11",
|
|
37
|
+
"Programming Language :: Python :: 3.12",
|
|
38
|
+
"Programming Language :: Python :: 3.13",
|
|
39
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
40
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[project.urls]
|
|
44
|
+
Homepage = "https://github.com/synop-rs/SynOP"
|
|
45
|
+
Repository = "https://github.com/synop-rs/SynOP"
|
|
46
|
+
Issues = "https://github.com/synop-rs/SynOP/issues"
|
|
47
|
+
|
|
48
|
+
[tool.maturin]
|
|
49
|
+
features = ["extension-module"]
|
|
50
|
+
module-name = "synop"
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
//! # SynOP
|
|
2
|
+
//!
|
|
3
|
+
//! Pure Rust-native, multi-hardware (GPU / TPU / NPU) deep learning framework.
|
|
4
|
+
//!
|
|
5
|
+
//! SynOP is designed as a modern, memory-safe alternative to PyTorch with a
|
|
6
|
+
//! unified operator IR, zero-overhead Rust core, and ergonomic Python bindings
|
|
7
|
+
//! powered by PyO3 and maturin.
|
|
8
|
+
//!
|
|
9
|
+
//! > **Status:** Early architecture scaffolding (`0.0.1`). Core tensor,
|
|
10
|
+
//! > autograd, and hardware backend APIs are under active development.
|
|
11
|
+
|
|
12
|
+
use std::fmt;
|
|
13
|
+
|
|
14
|
+
/// Crate version string matching `Cargo.toml`.
|
|
15
|
+
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
|
16
|
+
|
|
17
|
+
/// Target compute device supported by the SynOP backend abstraction.
|
|
18
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
|
|
19
|
+
pub enum Device {
|
|
20
|
+
/// Host CPU execution.
|
|
21
|
+
#[default]
|
|
22
|
+
Cpu,
|
|
23
|
+
/// NVIDIA CUDA GPU device by ordinal index.
|
|
24
|
+
Cuda(usize),
|
|
25
|
+
/// AMD ROCm GPU device by ordinal index.
|
|
26
|
+
Rocm(usize),
|
|
27
|
+
/// Apple Metal GPU device by ordinal index.
|
|
28
|
+
Metal(usize),
|
|
29
|
+
/// Vulkan / WebGPU portable compute device by ordinal index.
|
|
30
|
+
Vulkan(usize),
|
|
31
|
+
/// Google TPU device by ordinal index.
|
|
32
|
+
Tpu(usize),
|
|
33
|
+
/// Neural Processing Unit (NPU) accelerator by ordinal index.
|
|
34
|
+
Npu(usize),
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
impl fmt::Display for Device {
|
|
38
|
+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
39
|
+
match self {
|
|
40
|
+
Device::Cpu => write!(f, "cpu"),
|
|
41
|
+
Device::Cuda(idx) => write!(f, "cuda:{idx}"),
|
|
42
|
+
Device::Rocm(idx) => write!(f, "rocm:{idx}"),
|
|
43
|
+
Device::Metal(idx) => write!(f, "metal:{idx}"),
|
|
44
|
+
Device::Vulkan(idx) => write!(f, "vulkan:{idx}"),
|
|
45
|
+
Device::Tpu(idx) => write!(f, "tpu:{idx}"),
|
|
46
|
+
Device::Npu(idx) => write!(f, "npu:{idx}"),
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/// Returns the current SynOP library version.
|
|
52
|
+
pub fn version() -> &'static str {
|
|
53
|
+
VERSION
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/// Returns the list of target hardware backend families planned in SynOP.
|
|
57
|
+
pub fn target_backends() -> &'static [&'static str] {
|
|
58
|
+
&["cpu", "cuda", "rocm", "metal", "vulkan", "tpu", "npu"]
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
#[cfg(feature = "python")]
|
|
62
|
+
mod python {
|
|
63
|
+
use pyo3::prelude::*;
|
|
64
|
+
|
|
65
|
+
/// Return the installed SynOP package version.
|
|
66
|
+
#[pyfunction]
|
|
67
|
+
fn version() -> &'static str {
|
|
68
|
+
crate::version()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/// Return the list of target hardware backend families.
|
|
72
|
+
#[pyfunction]
|
|
73
|
+
fn target_backends() -> Vec<&'static str> {
|
|
74
|
+
crate::target_backends().to_vec()
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/// Python extension module for SynOP.
|
|
78
|
+
#[pymodule]
|
|
79
|
+
fn synop(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
80
|
+
m.add("__version__", crate::VERSION)?;
|
|
81
|
+
m.add_function(wrap_pyfunction!(version, m)?)?;
|
|
82
|
+
m.add_function(wrap_pyfunction!(target_backends, m)?)?;
|
|
83
|
+
Ok(())
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
#[cfg(test)]
|
|
88
|
+
mod tests {
|
|
89
|
+
use super::*;
|
|
90
|
+
|
|
91
|
+
#[test]
|
|
92
|
+
fn version_is_non_empty() {
|
|
93
|
+
assert_eq!(version(), "0.0.1");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
#[test]
|
|
97
|
+
fn device_display_formatting() {
|
|
98
|
+
assert_eq!(Device::default().to_string(), "cpu");
|
|
99
|
+
assert_eq!(Device::Cuda(0).to_string(), "cuda:0");
|
|
100
|
+
assert_eq!(Device::Tpu(1).to_string(), "tpu:1");
|
|
101
|
+
assert_eq!(Device::Npu(2).to_string(), "npu:2");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
#[test]
|
|
105
|
+
fn target_backends_includes_multi_hardware() {
|
|
106
|
+
let backends = target_backends();
|
|
107
|
+
assert!(backends.contains(&"cpu"));
|
|
108
|
+
assert!(backends.contains(&"cuda"));
|
|
109
|
+
assert!(backends.contains(&"tpu"));
|
|
110
|
+
assert!(backends.contains(&"npu"));
|
|
111
|
+
}
|
|
112
|
+
}
|