gafime-cuda 0.4.7__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.
- gafime_cuda-0.4.7/MANIFEST.in +7 -0
- gafime_cuda-0.4.7/PKG-INFO +20 -0
- gafime_cuda-0.4.7/README.md +7 -0
- gafime_cuda-0.4.7/gafime/_dummy.c +11 -0
- gafime_cuda-0.4.7/gafime_cuda/__init__.py +19 -0
- gafime_cuda-0.4.7/gafime_cuda.egg-info/PKG-INFO +20 -0
- gafime_cuda-0.4.7/gafime_cuda.egg-info/SOURCES.txt +14 -0
- gafime_cuda-0.4.7/gafime_cuda.egg-info/dependency_links.txt +1 -0
- gafime_cuda-0.4.7/gafime_cuda.egg-info/requires.txt +1 -0
- gafime_cuda-0.4.7/gafime_cuda.egg-info/top_level.txt +1 -0
- gafime_cuda-0.4.7/pyproject.toml +3 -0
- gafime_cuda-0.4.7/setup.cfg +4 -0
- gafime_cuda-0.4.7/setup.py +105 -0
- gafime_cuda-0.4.7/src/common/interfaces.h +665 -0
- gafime_cuda-0.4.7/src/cuda/kernels.cu +2322 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gafime-cuda
|
|
3
|
+
Version: 0.4.7
|
|
4
|
+
Summary: NVIDIA CUDA runtime payload for GAFIME
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: gafime==0.4.7
|
|
8
|
+
Dynamic: description
|
|
9
|
+
Dynamic: description-content-type
|
|
10
|
+
Dynamic: requires-dist
|
|
11
|
+
Dynamic: requires-python
|
|
12
|
+
Dynamic: summary
|
|
13
|
+
|
|
14
|
+
# gafime-cuda
|
|
15
|
+
|
|
16
|
+
Vendor GPU runtime payload for GAFIME 0.4.7.
|
|
17
|
+
|
|
18
|
+
This package is generated from the GAFIME source tree during CI and carries
|
|
19
|
+
only the CUDA native runtime payload. Install the base package
|
|
20
|
+
with `gafime`; use this package only for the matching GPU runtime.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# gafime-cuda
|
|
2
|
+
|
|
3
|
+
Vendor GPU runtime payload for GAFIME 0.4.7.
|
|
4
|
+
|
|
5
|
+
This package is generated from the GAFIME source tree during CI and carries
|
|
6
|
+
only the CUDA native runtime payload. Install the base package
|
|
7
|
+
with `gafime`; use this package only for the matching GPU runtime.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#include <Python.h>
|
|
2
|
+
static struct PyModuleDef dummy_module = {
|
|
3
|
+
PyModuleDef_HEAD_INIT,
|
|
4
|
+
"_native",
|
|
5
|
+
"Dummy extension block",
|
|
6
|
+
-1,
|
|
7
|
+
NULL, NULL, NULL, NULL, NULL
|
|
8
|
+
};
|
|
9
|
+
PyMODINIT_FUNC PyInit__native(void) {
|
|
10
|
+
return PyModule_Create(&dummy_module);
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
__version__ = "0.4.7"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def package_dir() -> Path:
|
|
9
|
+
return Path(__file__).resolve().parent
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def library_candidates() -> list[Path]:
|
|
13
|
+
base = package_dir()
|
|
14
|
+
return [
|
|
15
|
+
base / "gafime_cuda.dll",
|
|
16
|
+
base / "libgafime_cuda.so",
|
|
17
|
+
base / "gafime_cuda.so",
|
|
18
|
+
base / "gafime_cuda.pyd",
|
|
19
|
+
]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gafime-cuda
|
|
3
|
+
Version: 0.4.7
|
|
4
|
+
Summary: NVIDIA CUDA runtime payload for GAFIME
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: gafime==0.4.7
|
|
8
|
+
Dynamic: description
|
|
9
|
+
Dynamic: description-content-type
|
|
10
|
+
Dynamic: requires-dist
|
|
11
|
+
Dynamic: requires-python
|
|
12
|
+
Dynamic: summary
|
|
13
|
+
|
|
14
|
+
# gafime-cuda
|
|
15
|
+
|
|
16
|
+
Vendor GPU runtime payload for GAFIME 0.4.7.
|
|
17
|
+
|
|
18
|
+
This package is generated from the GAFIME source tree during CI and carries
|
|
19
|
+
only the CUDA native runtime payload. Install the base package
|
|
20
|
+
with `gafime`; use this package only for the matching GPU runtime.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
MANIFEST.in
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
/home/runner/work/GAFIME/GAFIME/payload-src/gafime-cuda/gafime/_dummy.c
|
|
6
|
+
gafime/_dummy.c
|
|
7
|
+
gafime_cuda/__init__.py
|
|
8
|
+
gafime_cuda.egg-info/PKG-INFO
|
|
9
|
+
gafime_cuda.egg-info/SOURCES.txt
|
|
10
|
+
gafime_cuda.egg-info/dependency_links.txt
|
|
11
|
+
gafime_cuda.egg-info/requires.txt
|
|
12
|
+
gafime_cuda.egg-info/top_level.txt
|
|
13
|
+
src/common/interfaces.h
|
|
14
|
+
src/cuda/kernels.cu
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gafime==0.4.7
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gafime_cuda
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import platform
|
|
5
|
+
import shutil
|
|
6
|
+
import subprocess
|
|
7
|
+
import sys
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
from setuptools import Extension, setup
|
|
11
|
+
from setuptools.command.build_ext import build_ext
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
VERSION = "0.4.7"
|
|
15
|
+
ROOT = Path(__file__).resolve().parent
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _find_nvcc() -> str | None:
|
|
19
|
+
nvcc = shutil.which("nvcc")
|
|
20
|
+
if nvcc:
|
|
21
|
+
return nvcc
|
|
22
|
+
exe_name = "nvcc.exe" if sys.platform == "win32" else "nvcc"
|
|
23
|
+
for env_name in ("CUDA_PATH", "CUDA_HOME"):
|
|
24
|
+
cuda_root = os.environ.get(env_name)
|
|
25
|
+
if not cuda_root:
|
|
26
|
+
continue
|
|
27
|
+
candidate = Path(cuda_root) / "bin" / exe_name
|
|
28
|
+
if candidate.exists():
|
|
29
|
+
return str(candidate)
|
|
30
|
+
return None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class CudaPayloadBuildExt(build_ext):
|
|
34
|
+
def run(self):
|
|
35
|
+
package_dir = Path(self.build_lib) / "gafime_cuda"
|
|
36
|
+
package_dir.mkdir(parents=True, exist_ok=True)
|
|
37
|
+
self.output_dir = package_dir
|
|
38
|
+
self.build_cuda_backend()
|
|
39
|
+
super().run()
|
|
40
|
+
|
|
41
|
+
def build_cuda_backend(self) -> None:
|
|
42
|
+
machine = platform.machine().lower()
|
|
43
|
+
if machine in {"aarch64", "arm64"} or machine.startswith("arm"):
|
|
44
|
+
raise RuntimeError(f"gafime-cuda does not support ARM target {platform.machine()}.")
|
|
45
|
+
nvcc = _find_nvcc()
|
|
46
|
+
if not nvcc:
|
|
47
|
+
raise RuntimeError(
|
|
48
|
+
"nvcc was not found. Install CUDA Toolkit 13.2+ to build gafime-cuda "
|
|
49
|
+
"or set CUDA_PATH/CUDA_HOME to the toolkit root."
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
src_dir = ROOT / "src"
|
|
53
|
+
cuda_source = src_dir / "cuda" / "kernels.cu"
|
|
54
|
+
if sys.platform == "win32":
|
|
55
|
+
output_file = self.output_dir / "gafime_cuda.dll"
|
|
56
|
+
compiler_flags = ["/MD", "/O2"]
|
|
57
|
+
else:
|
|
58
|
+
output_file = self.output_dir / "libgafime_cuda.so"
|
|
59
|
+
compiler_flags = ["-fPIC", "-O3"]
|
|
60
|
+
|
|
61
|
+
gencode_flags = [
|
|
62
|
+
"-gencode=arch=compute_75,code=sm_75",
|
|
63
|
+
"-gencode=arch=compute_80,code=sm_80",
|
|
64
|
+
"-gencode=arch=compute_86,code=sm_86",
|
|
65
|
+
"-gencode=arch=compute_89,code=sm_89",
|
|
66
|
+
"-gencode=arch=compute_90,code=sm_90",
|
|
67
|
+
"-gencode=arch=compute_100,code=sm_100",
|
|
68
|
+
"-gencode=arch=compute_120,code=sm_120",
|
|
69
|
+
"-gencode=arch=compute_120,code=compute_120",
|
|
70
|
+
]
|
|
71
|
+
cmd = [
|
|
72
|
+
nvcc,
|
|
73
|
+
*gencode_flags,
|
|
74
|
+
"-O3",
|
|
75
|
+
"--shared",
|
|
76
|
+
"-DGAFIME_BUILDING_DLL",
|
|
77
|
+
"-cudart",
|
|
78
|
+
"static",
|
|
79
|
+
"-Xcompiler",
|
|
80
|
+
",".join(compiler_flags),
|
|
81
|
+
"-I",
|
|
82
|
+
str(src_dir / "common"),
|
|
83
|
+
"-o",
|
|
84
|
+
str(output_file),
|
|
85
|
+
str(cuda_source),
|
|
86
|
+
]
|
|
87
|
+
result = subprocess.run(cmd, capture_output=True, text=True)
|
|
88
|
+
if result.returncode != 0:
|
|
89
|
+
raise RuntimeError(f"CUDA build failed\nSTDOUT:\n{result.stdout}\nSTDERR:\n{result.stderr}")
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
setup(
|
|
93
|
+
name="gafime-cuda",
|
|
94
|
+
version=VERSION,
|
|
95
|
+
description="NVIDIA CUDA runtime payload for GAFIME",
|
|
96
|
+
long_description=(ROOT / "README.md").read_text(encoding="utf-8"),
|
|
97
|
+
long_description_content_type="text/markdown",
|
|
98
|
+
packages=["gafime_cuda"],
|
|
99
|
+
package_data={"gafime_cuda": ["*.so", "*.dll", "*.pyd"]},
|
|
100
|
+
include_package_data=False,
|
|
101
|
+
install_requires=[f"gafime=={VERSION}"],
|
|
102
|
+
python_requires=">=3.10",
|
|
103
|
+
ext_modules=[Extension("gafime_cuda._native", sources=[str(ROOT / "gafime" / "_dummy.c")])],
|
|
104
|
+
cmdclass={"build_ext": CudaPayloadBuildExt},
|
|
105
|
+
)
|