DeepGPR 0.0.9__tar.gz → 0.0.11__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.
- {deepgpr-0.0.9 → deepgpr-0.0.11}/PKG-INFO +1 -5
- {deepgpr-0.0.9 → deepgpr-0.0.11}/pyproject.toml +13 -23
- deepgpr-0.0.11/src/DeepGPR/__init__.py +210 -0
- {deepgpr-0.0.9 → deepgpr-0.0.11}/src/DeepGPR/lib/deepgpr.cu +9 -6
- deepgpr-0.0.11/src/DeepGPR/lib/deepgpr.dll +0 -0
- deepgpr-0.0.11/src/DeepGPR/lib/deepgpr.so +0 -0
- {deepgpr-0.0.9 → deepgpr-0.0.11}/src/DeepGPR.egg-info/PKG-INFO +1 -5
- {deepgpr-0.0.9 → deepgpr-0.0.11}/src/DeepGPR.egg-info/SOURCES.txt +1 -0
- {deepgpr-0.0.9 → deepgpr-0.0.11}/src/DeepGPR.egg-info/requires.txt +0 -2
- deepgpr-0.0.9/src/DeepGPR/__init__.py +0 -140
- deepgpr-0.0.9/src/DeepGPR/lib/deepgpr.so +0 -0
- {deepgpr-0.0.9 → deepgpr-0.0.11}/README.md +0 -0
- {deepgpr-0.0.9 → deepgpr-0.0.11}/setup.cfg +0 -0
- {deepgpr-0.0.9 → deepgpr-0.0.11}/src/DeepGPR/common.py +0 -0
- {deepgpr-0.0.9 → deepgpr-0.0.11}/src/DeepGPR/compute2.py +0 -0
- {deepgpr-0.0.9 → deepgpr-0.0.11}/src/DeepGPR/multiscale.py +0 -0
- {deepgpr-0.0.9 → deepgpr-0.0.11}/src/DeepGPR/wavelet.py +0 -0
- {deepgpr-0.0.9 → deepgpr-0.0.11}/src/DeepGPR.egg-info/dependency_links.txt +0 -0
- {deepgpr-0.0.9 → deepgpr-0.0.11}/src/DeepGPR.egg-info/top_level.txt +0 -0
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: DeepGPR
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.11
|
|
4
4
|
Summary: PyTorch and CUDA for GPR FWI
|
|
5
5
|
Author-email: Lei Liu <liulei990222@gmail.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
7
7
|
Classifier: Operating System :: Microsoft :: Windows
|
|
8
8
|
Classifier: Operating System :: POSIX :: Linux
|
|
9
|
-
Classifier: Topic :: Scientific/Engineering
|
|
10
|
-
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
11
9
|
Requires-Python: >=3.8
|
|
12
10
|
Description-Content-Type: text/markdown
|
|
13
11
|
Requires-Dist: numpy
|
|
14
|
-
Requires-Dist: scipy
|
|
15
12
|
Requires-Dist: matplotlib
|
|
16
|
-
Requires-Dist: torch
|
|
17
13
|
|
|
18
14
|
# DeepGPR
|
|
19
15
|
|
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = [
|
|
2
|
+
requires = [
|
|
3
|
+
"setuptools>=68",
|
|
4
|
+
"wheel"
|
|
5
|
+
]
|
|
3
6
|
build-backend = "setuptools.build_meta"
|
|
4
7
|
|
|
5
8
|
[project]
|
|
6
9
|
name = "DeepGPR"
|
|
7
|
-
version = "0.0.
|
|
10
|
+
version = "0.0.11"
|
|
8
11
|
authors = [
|
|
9
|
-
|
|
12
|
+
{ name = "Lei Liu", email = "liulei990222@gmail.com" }
|
|
10
13
|
]
|
|
11
14
|
description = "PyTorch and CUDA for GPR FWI"
|
|
12
15
|
readme = "README.md"
|
|
13
16
|
requires-python = ">=3.8"
|
|
14
|
-
|
|
17
|
+
dependencies = [
|
|
18
|
+
"numpy",
|
|
19
|
+
"matplotlib"
|
|
20
|
+
]
|
|
15
21
|
classifiers = [
|
|
16
22
|
"Programming Language :: Python :: 3",
|
|
17
23
|
"Operating System :: Microsoft :: Windows",
|
|
18
|
-
"Operating System :: POSIX :: Linux"
|
|
19
|
-
"Topic :: Scientific/Engineering",
|
|
20
|
-
"Topic :: Scientific/Engineering :: Physics"
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
dependencies = [
|
|
24
|
-
"numpy",
|
|
25
|
-
"scipy",
|
|
26
|
-
"matplotlib",
|
|
27
|
-
"torch"
|
|
24
|
+
"Operating System :: POSIX :: Linux"
|
|
28
25
|
]
|
|
29
26
|
|
|
30
27
|
[tool.setuptools]
|
|
31
|
-
package-dir = {
|
|
28
|
+
package-dir = {"" = "src"}
|
|
32
29
|
include-package-data = true
|
|
33
30
|
|
|
34
31
|
[tool.setuptools.packages.find]
|
|
@@ -36,13 +33,6 @@ where = ["src"]
|
|
|
36
33
|
|
|
37
34
|
[tool.setuptools.package-data]
|
|
38
35
|
DeepGPR = [
|
|
39
|
-
"lib/*.cu",
|
|
40
|
-
"lib/*.cuh",
|
|
41
|
-
"lib/*.h",
|
|
42
|
-
"lib/*.hpp",
|
|
43
|
-
"lib/*.cpp",
|
|
44
|
-
"lib/*.c",
|
|
45
36
|
"lib/*.dll",
|
|
46
|
-
"lib/*.so"
|
|
47
|
-
"lib/*.pyd"
|
|
37
|
+
"lib/*.so"
|
|
48
38
|
]
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import ctypes
|
|
2
|
+
import os
|
|
3
|
+
import platform
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
_FLOAT_P = ctypes.POINTER(ctypes.c_float)
|
|
8
|
+
_INT_P = ctypes.POINTER(ctypes.c_int)
|
|
9
|
+
|
|
10
|
+
_PACKAGE_DIR = Path(__file__).resolve().parent
|
|
11
|
+
_LIB_DIR = _PACKAGE_DIR / "lib"
|
|
12
|
+
_SYSTEM_NAME = platform.system()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _candidate_library_paths() -> list[Path]:
|
|
16
|
+
"""
|
|
17
|
+
Return possible precompiled DeepGPR library paths for the current platform.
|
|
18
|
+
|
|
19
|
+
Expected files:
|
|
20
|
+
Windows:
|
|
21
|
+
src/DeepGPR/lib/deepgpr.dll
|
|
22
|
+
|
|
23
|
+
Linux:
|
|
24
|
+
src/DeepGPR/lib/libdeepgpr.so
|
|
25
|
+
or
|
|
26
|
+
src/DeepGPR/lib/deepgpr.so
|
|
27
|
+
|
|
28
|
+
This package no longer compiles deepgpr.cu during import.
|
|
29
|
+
The corresponding precompiled library must already be included in the package.
|
|
30
|
+
"""
|
|
31
|
+
if _SYSTEM_NAME == "Windows":
|
|
32
|
+
return [
|
|
33
|
+
_LIB_DIR / "deepgpr.dll",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
if _SYSTEM_NAME == "Linux":
|
|
37
|
+
return [
|
|
38
|
+
_LIB_DIR / "libdeepgpr.so",
|
|
39
|
+
_LIB_DIR / "deepgpr.so",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
raise RuntimeError(f"Unsupported operating system: {_SYSTEM_NAME}")
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _select_library_path() -> Path:
|
|
46
|
+
candidates = _candidate_library_paths()
|
|
47
|
+
|
|
48
|
+
for path in candidates:
|
|
49
|
+
if path.is_file():
|
|
50
|
+
return path
|
|
51
|
+
|
|
52
|
+
available_files = []
|
|
53
|
+
if _LIB_DIR.is_dir():
|
|
54
|
+
available_files = [p.name for p in _LIB_DIR.iterdir()]
|
|
55
|
+
|
|
56
|
+
expected = "\n".join(str(p) for p in candidates)
|
|
57
|
+
raise FileNotFoundError(
|
|
58
|
+
"DeepGPR precompiled shared library was not found.\n\n"
|
|
59
|
+
f"Current platform: {_SYSTEM_NAME}\n"
|
|
60
|
+
f"Expected one of:\n{expected}\n\n"
|
|
61
|
+
f"Available files in {_LIB_DIR}:\n{available_files}\n\n"
|
|
62
|
+
"Please put the compiled library file into src/DeepGPR/lib before building "
|
|
63
|
+
"or installing the package."
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
_LIB_PATH = _select_library_path()
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _add_windows_dll_search_paths() -> None:
|
|
71
|
+
"""Make DLL dependency lookup more reliable on Python 3.8+ for Windows."""
|
|
72
|
+
if _SYSTEM_NAME != "Windows" or not hasattr(os, "add_dll_directory"):
|
|
73
|
+
return
|
|
74
|
+
|
|
75
|
+
search_dirs: list[Path] = [_LIB_DIR]
|
|
76
|
+
|
|
77
|
+
cuda_path = os.environ.get("CUDA_PATH")
|
|
78
|
+
if cuda_path:
|
|
79
|
+
search_dirs.append(Path(cuda_path) / "bin")
|
|
80
|
+
|
|
81
|
+
for key, value in os.environ.items():
|
|
82
|
+
if key.startswith("CUDA_PATH_V") and value:
|
|
83
|
+
search_dirs.append(Path(value) / "bin")
|
|
84
|
+
|
|
85
|
+
conda_prefix = os.environ.get("CONDA_PREFIX")
|
|
86
|
+
if conda_prefix:
|
|
87
|
+
search_dirs.append(Path(conda_prefix) / "Library" / "bin")
|
|
88
|
+
|
|
89
|
+
seen = set()
|
|
90
|
+
for directory in search_dirs:
|
|
91
|
+
directory = Path(directory)
|
|
92
|
+
if directory in seen:
|
|
93
|
+
continue
|
|
94
|
+
seen.add(directory)
|
|
95
|
+
|
|
96
|
+
try:
|
|
97
|
+
if directory.is_dir():
|
|
98
|
+
os.add_dll_directory(str(directory))
|
|
99
|
+
except OSError:
|
|
100
|
+
pass
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def _load_deepgpr_library() -> ctypes.CDLL:
|
|
104
|
+
_add_windows_dll_search_paths()
|
|
105
|
+
|
|
106
|
+
try:
|
|
107
|
+
return ctypes.CDLL(str(_LIB_PATH.resolve()))
|
|
108
|
+
except OSError as exc:
|
|
109
|
+
raise RuntimeError(
|
|
110
|
+
f"Failed to load DeepGPR shared library:\n{_LIB_PATH}\n\n"
|
|
111
|
+
"Possible causes:\n"
|
|
112
|
+
"1. The DLL/SO was compiled for a different operating system or CPU architecture.\n"
|
|
113
|
+
"2. CUDA runtime DLLs/shared libraries are missing or cannot be found.\n"
|
|
114
|
+
"3. The NVIDIA driver or CUDA runtime version is incompatible.\n"
|
|
115
|
+
"4. On Windows, CUDA_PATH\\bin or the required dependency directory is not in the DLL search path."
|
|
116
|
+
) from exc
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def _require_exported_symbols(lib: ctypes.CDLL, symbols: tuple[str, ...]) -> None:
|
|
120
|
+
missing = [name for name in symbols if not hasattr(lib, name)]
|
|
121
|
+
if missing:
|
|
122
|
+
raise RuntimeError(
|
|
123
|
+
"The shared library was loaded, but the following exported C ABI symbols "
|
|
124
|
+
f"were not found: {missing}. "
|
|
125
|
+
"Check that the corresponding functions in deepgpr.cu are declared with DEEPGPR_API."
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
c_lib = _load_deepgpr_library()
|
|
130
|
+
_require_exported_symbols(c_lib, ("forward", "backward"))
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
c_lib.forward.argtypes = [
|
|
134
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
135
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
136
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
137
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
138
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
139
|
+
|
|
140
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
141
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
142
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
143
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
144
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
145
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
146
|
+
|
|
147
|
+
ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
148
|
+
ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
149
|
+
|
|
150
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
151
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
152
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
153
|
+
|
|
154
|
+
ctypes.c_float, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_float,
|
|
155
|
+
_INT_P, _FLOAT_P,
|
|
156
|
+
ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
157
|
+
_INT_P, _FLOAT_P,
|
|
158
|
+
ctypes.c_int, ctypes.c_int,
|
|
159
|
+
]
|
|
160
|
+
c_lib.forward.restype = None
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
c_lib.backward.argtypes = [
|
|
164
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
165
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
166
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
167
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
168
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
169
|
+
|
|
170
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
171
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
172
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
173
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
174
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
175
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
176
|
+
|
|
177
|
+
ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
178
|
+
ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
179
|
+
|
|
180
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
181
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
182
|
+
_FLOAT_P, _FLOAT_P, _FLOAT_P, _FLOAT_P,
|
|
183
|
+
|
|
184
|
+
ctypes.c_float, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_float,
|
|
185
|
+
ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
186
|
+
_INT_P, _FLOAT_P,
|
|
187
|
+
ctypes.c_int,
|
|
188
|
+
_FLOAT_P, _FLOAT_P,
|
|
189
|
+
ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
190
|
+
]
|
|
191
|
+
c_lib.backward.restype = None
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
from .common import *
|
|
195
|
+
from .compute2 import *
|
|
196
|
+
from .multiscale import *
|
|
197
|
+
from .wavelet import *
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
_EXCLUDED_FROM_ALL = {
|
|
201
|
+
"ctypes",
|
|
202
|
+
"os",
|
|
203
|
+
"platform",
|
|
204
|
+
"Path",
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
__all__ = [
|
|
208
|
+
name for name in globals()
|
|
209
|
+
if not name.startswith("_") and name not in _EXCLUDED_FROM_ALL
|
|
210
|
+
]
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
#include <stdio.h>
|
|
4
4
|
#include <cfloat>
|
|
5
5
|
|
|
6
|
+
|
|
7
|
+
#ifdef _WIN32
|
|
8
|
+
#define DEEPGPR_API extern "C" __declspec(dllexport)
|
|
9
|
+
#else
|
|
10
|
+
#define DEEPGPR_API extern "C" __attribute__((visibility("default")))
|
|
11
|
+
#endif
|
|
12
|
+
|
|
6
13
|
__constant__ float e0 = 8.8541878128e-12;
|
|
7
14
|
__constant__ float m0 = 1.25663706212e-06;
|
|
8
15
|
|
|
@@ -598,9 +605,7 @@ __global__ void accumulate_gradients(
|
|
|
598
605
|
}
|
|
599
606
|
|
|
600
607
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
void forward(const float* __restrict__ er, const float* __restrict__ se, const float* __restrict__ mr,
|
|
608
|
+
DEEPGPR_API void forward(const float* __restrict__ er, const float* __restrict__ se, const float* __restrict__ mr,
|
|
604
609
|
float* __restrict__ Eall_ptr,
|
|
605
610
|
float* __restrict__ Ex, float* __restrict__ Ey, float* __restrict__ Ez,
|
|
606
611
|
float* __restrict__ Hx, float* __restrict__ Hy, float* __restrict__ Hz,
|
|
@@ -702,7 +707,7 @@ void forward(const float* __restrict__ er, const float* __restrict__ se, const f
|
|
|
702
707
|
}
|
|
703
708
|
}
|
|
704
709
|
|
|
705
|
-
void backward(const float* __restrict__ er, const float* __restrict__ se, const float* __restrict__ mr,
|
|
710
|
+
DEEPGPR_API void backward(const float* __restrict__ er, const float* __restrict__ se, const float* __restrict__ mr,
|
|
706
711
|
const float* __restrict__ Eall_ptr,
|
|
707
712
|
float* __restrict__ Ex, float* __restrict__ Ey, float* __restrict__ Ez,
|
|
708
713
|
float* __restrict__ Hx, float* __restrict__ Hy, float* __restrict__ Hz,
|
|
@@ -815,6 +820,4 @@ void backward(const float* __restrict__ er, const float* __restrict__ se, const
|
|
|
815
820
|
cudaStreamDestroy(stream_comp);
|
|
816
821
|
cudaStreamDestroy(stream_trans);
|
|
817
822
|
}
|
|
818
|
-
}
|
|
819
|
-
|
|
820
823
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: DeepGPR
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.11
|
|
4
4
|
Summary: PyTorch and CUDA for GPR FWI
|
|
5
5
|
Author-email: Lei Liu <liulei990222@gmail.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
7
7
|
Classifier: Operating System :: Microsoft :: Windows
|
|
8
8
|
Classifier: Operating System :: POSIX :: Linux
|
|
9
|
-
Classifier: Topic :: Scientific/Engineering
|
|
10
|
-
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
11
9
|
Requires-Python: >=3.8
|
|
12
10
|
Description-Content-Type: text/markdown
|
|
13
11
|
Requires-Dist: numpy
|
|
14
|
-
Requires-Dist: scipy
|
|
15
12
|
Requires-Dist: matplotlib
|
|
16
|
-
Requires-Dist: torch
|
|
17
13
|
|
|
18
14
|
# DeepGPR
|
|
19
15
|
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import ctypes
|
|
2
|
-
import os
|
|
3
|
-
import subprocess
|
|
4
|
-
import platform
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
system_name = platform.system()
|
|
9
|
-
lib_dir = Path(__file__).parent / 'lib'
|
|
10
|
-
cu_file = lib_dir / 'deepgpr.cu'
|
|
11
|
-
|
|
12
|
-
if system_name == "Windows":
|
|
13
|
-
lib_extension = ".dll"
|
|
14
|
-
lib_filename = f'deepgpr{lib_extension}'
|
|
15
|
-
lib_path_obj = lib_dir / lib_filename
|
|
16
|
-
|
|
17
|
-
nvcc_cmd = [
|
|
18
|
-
'nvcc', '-shared',
|
|
19
|
-
'-o', str(lib_path_obj),
|
|
20
|
-
str(cu_file)
|
|
21
|
-
]
|
|
22
|
-
else:
|
|
23
|
-
lib_extension = ".so"
|
|
24
|
-
lib_filename = f'deepgpr{lib_extension}'
|
|
25
|
-
lib_path_obj = lib_dir / lib_filename
|
|
26
|
-
|
|
27
|
-
nvcc_cmd = [
|
|
28
|
-
'nvcc', '-shared', '-Xcompiler', '-fPIC',
|
|
29
|
-
'-D_GLIBCXX_USE_CXX11_ABI=0',
|
|
30
|
-
'-o', str(lib_path_obj),
|
|
31
|
-
str(cu_file)
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
if not lib_path_obj.is_file():
|
|
35
|
-
print(f'Compiling CUDA extension for {system_name} directly via nvcc...')
|
|
36
|
-
try:
|
|
37
|
-
subprocess.run(nvcc_cmd, check=True)
|
|
38
|
-
except FileNotFoundError:
|
|
39
|
-
raise RuntimeError(
|
|
40
|
-
"Compilation failed: 'nvcc' command not found. "
|
|
41
|
-
"Please ensure NVIDIA CUDA Toolkit is installed and 'nvcc' is added to your system PATH."
|
|
42
|
-
)
|
|
43
|
-
except subprocess.CalledProcessError as e:
|
|
44
|
-
raise RuntimeError(f"Compilation failed with error code {e.returncode}.")
|
|
45
|
-
|
|
46
|
-
lib_path = str(lib_path_obj)
|
|
47
|
-
c_lib = ctypes.cdll.LoadLibrary(lib_path)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
c_lib.forward.argtypes = [
|
|
51
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
52
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
53
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
54
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
55
|
-
ctypes.POINTER(ctypes.c_float),
|
|
56
|
-
ctypes.POINTER(ctypes.c_float),
|
|
57
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
58
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
59
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
60
|
-
|
|
61
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
62
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
63
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
64
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
65
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
66
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
67
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
68
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
69
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
70
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
71
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
72
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
73
|
-
|
|
74
|
-
ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
75
|
-
ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
76
|
-
|
|
77
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
78
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
79
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
80
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
81
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
82
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
83
|
-
|
|
84
|
-
ctypes.c_float,ctypes.c_int,ctypes.c_int,ctypes.c_int,ctypes.c_float,
|
|
85
|
-
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_float),
|
|
86
|
-
ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
87
|
-
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_float),
|
|
88
|
-
ctypes.c_int, ctypes.c_int
|
|
89
|
-
]
|
|
90
|
-
c_lib.forward.restype = None
|
|
91
|
-
|
|
92
|
-
c_lib.backward.argtypes = [
|
|
93
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
94
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
95
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
96
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
97
|
-
ctypes.POINTER(ctypes.c_float),
|
|
98
|
-
ctypes.POINTER(ctypes.c_float),
|
|
99
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
100
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
101
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),#16
|
|
102
|
-
|
|
103
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
104
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
105
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
106
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
107
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
108
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
109
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
110
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
111
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
112
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
113
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
114
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),#40
|
|
115
|
-
|
|
116
|
-
ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
117
|
-
ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
118
|
-
|
|
119
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
120
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
121
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
122
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
123
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
124
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), #58
|
|
125
|
-
|
|
126
|
-
ctypes.c_float,ctypes.c_int,ctypes.c_int,ctypes.c_int,ctypes.c_float,
|
|
127
|
-
ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
128
|
-
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_float),
|
|
129
|
-
ctypes.c_int ,ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
130
|
-
ctypes.c_int, ctypes.c_int , ctypes.c_int
|
|
131
|
-
]
|
|
132
|
-
|
|
133
|
-
c_lib.backward.restype = None
|
|
134
|
-
__all__ = ['c_lib']
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
from .common import *
|
|
138
|
-
from .compute2 import *
|
|
139
|
-
from .multiscale import *
|
|
140
|
-
from .wavelet import *
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|