DeepGPR 0.0.1__tar.gz → 0.0.4__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.1/DeepGPR.egg-info → deepgpr-0.0.4}/PKG-INFO +4 -5
- {deepgpr-0.0.1 → deepgpr-0.0.4}/README.md +1 -3
- {deepgpr-0.0.1 → deepgpr-0.0.4}/pyproject.toml +9 -4
- {deepgpr-0.0.1 → deepgpr-0.0.4/src/DeepGPR.egg-info}/PKG-INFO +4 -5
- deepgpr-0.0.4/src/DeepGPR.egg-info/SOURCES.txt +6 -0
- deepgpr-0.0.4/src/DeepGPR.egg-info/top_level.txt +1 -0
- deepgpr-0.0.1/DeepGPR/__init__.py +0 -147
- deepgpr-0.0.1/DeepGPR/common.py +0 -643
- deepgpr-0.0.1/DeepGPR/compute2.py +0 -326
- deepgpr-0.0.1/DeepGPR/multiscale.py +0 -63
- deepgpr-0.0.1/DeepGPR/visual.py +0 -105
- deepgpr-0.0.1/DeepGPR.egg-info/SOURCES.txt +0 -11
- deepgpr-0.0.1/DeepGPR.egg-info/top_level.txt +0 -1
- {deepgpr-0.0.1 → deepgpr-0.0.4}/setup.cfg +0 -0
- {deepgpr-0.0.1 → deepgpr-0.0.4/src}/DeepGPR.egg-info/dependency_links.txt +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: DeepGPR
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
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
|
-
Classifier: Operating System ::
|
|
7
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
8
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
8
9
|
Requires-Python: >=3.7
|
|
9
10
|
Description-Content-Type: text/markdown
|
|
10
11
|
|
|
@@ -59,7 +60,6 @@ peak_time = 1 / freq
|
|
|
59
60
|
source_amplitudes = torch.zeros((1,nt,1),device=device)
|
|
60
61
|
source_amplitudes[0,:,0]=DeepGPR.ricker(freq, nt, dt, peak_time).to(device)
|
|
61
62
|
|
|
62
|
-
DeepGPR.plot_survey_geometry(er,source_location, receiver_location,dx)
|
|
63
63
|
|
|
64
64
|
#forward modeling
|
|
65
65
|
r = DeepGPR.compute(
|
|
@@ -79,8 +79,7 @@ ax[1].imshow(er.grad.detach())
|
|
|
79
79
|
ax[1].set_title("Gradient")
|
|
80
80
|
plt.show()
|
|
81
81
|
```
|
|
82
|
-

|
|
83
82
|
|
|
84
|
-

|
|
85
84
|
|
|
86
85
|
There are more examples in the ./examples.
|
|
@@ -49,7 +49,6 @@ peak_time = 1 / freq
|
|
|
49
49
|
source_amplitudes = torch.zeros((1,nt,1),device=device)
|
|
50
50
|
source_amplitudes[0,:,0]=DeepGPR.ricker(freq, nt, dt, peak_time).to(device)
|
|
51
51
|
|
|
52
|
-
DeepGPR.plot_survey_geometry(er,source_location, receiver_location,dx)
|
|
53
52
|
|
|
54
53
|
#forward modeling
|
|
55
54
|
r = DeepGPR.compute(
|
|
@@ -69,8 +68,7 @@ ax[1].imshow(er.grad.detach())
|
|
|
69
68
|
ax[1].set_title("Gradient")
|
|
70
69
|
plt.show()
|
|
71
70
|
```
|
|
72
|
-

|
|
73
71
|
|
|
74
|
-

|
|
75
73
|
|
|
76
74
|
There are more examples in the ./examples.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "DeepGPR"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.4"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Lei Liu", email="liulei990222@gmail.com" },
|
|
10
10
|
]
|
|
@@ -13,8 +13,13 @@ readme = "README.md"
|
|
|
13
13
|
requires-python = ">=3.7"
|
|
14
14
|
classifiers = [
|
|
15
15
|
"Programming Language :: Python :: 3",
|
|
16
|
-
"Operating System ::
|
|
16
|
+
"Operating System :: Microsoft :: Windows",
|
|
17
|
+
"Operating System :: POSIX :: Linux"
|
|
17
18
|
]
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
packages
|
|
20
|
+
|
|
21
|
+
[tool.setuptools.packages.find]
|
|
22
|
+
where = ["src"]
|
|
23
|
+
|
|
24
|
+
[tool.setuptools.package-data]
|
|
25
|
+
"DeepGPR" = ["lib/*.cu", "lib/*.so", "lib/*.dll"]
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: DeepGPR
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
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
|
-
Classifier: Operating System ::
|
|
7
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
8
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
8
9
|
Requires-Python: >=3.7
|
|
9
10
|
Description-Content-Type: text/markdown
|
|
10
11
|
|
|
@@ -59,7 +60,6 @@ peak_time = 1 / freq
|
|
|
59
60
|
source_amplitudes = torch.zeros((1,nt,1),device=device)
|
|
60
61
|
source_amplitudes[0,:,0]=DeepGPR.ricker(freq, nt, dt, peak_time).to(device)
|
|
61
62
|
|
|
62
|
-
DeepGPR.plot_survey_geometry(er,source_location, receiver_location,dx)
|
|
63
63
|
|
|
64
64
|
#forward modeling
|
|
65
65
|
r = DeepGPR.compute(
|
|
@@ -79,8 +79,7 @@ ax[1].imshow(er.grad.detach())
|
|
|
79
79
|
ax[1].set_title("Gradient")
|
|
80
80
|
plt.show()
|
|
81
81
|
```
|
|
82
|
-

|
|
83
82
|
|
|
84
|
-

|
|
85
84
|
|
|
86
85
|
There are more examples in the ./examples.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lib
|
|
@@ -1,147 +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
|
-
# Windows 下直接调用 nvcc 的命令参数
|
|
18
|
-
nvcc_cmd = [
|
|
19
|
-
'nvcc', '-shared',
|
|
20
|
-
'-o', str(lib_path_obj),
|
|
21
|
-
str(cu_file)
|
|
22
|
-
]
|
|
23
|
-
else:
|
|
24
|
-
lib_extension = ".so"
|
|
25
|
-
lib_filename = f'deepgpr{lib_extension}'
|
|
26
|
-
lib_path_obj = lib_dir / lib_filename
|
|
27
|
-
|
|
28
|
-
# Linux 下直接调用 nvcc 的命令参数 (-fPIC 和 ABI 设置)
|
|
29
|
-
nvcc_cmd = [
|
|
30
|
-
'nvcc', '-shared', '-Xcompiler', '-fPIC',
|
|
31
|
-
'-D_GLIBCXX_USE_CXX11_ABI=0',
|
|
32
|
-
'-o', str(lib_path_obj),
|
|
33
|
-
str(cu_file)
|
|
34
|
-
]
|
|
35
|
-
|
|
36
|
-
# 2. 检查动态库是否存在,不存在则直接使用 Python 调用 nvcc 进行编译
|
|
37
|
-
if not lib_path_obj.is_file():
|
|
38
|
-
print(f'Compiling CUDA extension for {system_name} directly via nvcc...')
|
|
39
|
-
try:
|
|
40
|
-
# 直接执行 nvcc 命令,完全摆脱 make 依赖
|
|
41
|
-
subprocess.run(nvcc_cmd, check=True)
|
|
42
|
-
except FileNotFoundError:
|
|
43
|
-
raise RuntimeError(
|
|
44
|
-
"Compilation failed: 'nvcc' command not found. "
|
|
45
|
-
"Please ensure NVIDIA CUDA Toolkit is installed and 'nvcc' is added to your system PATH."
|
|
46
|
-
)
|
|
47
|
-
except subprocess.CalledProcessError as e:
|
|
48
|
-
raise RuntimeError(f"Compilation failed with error code {e.returncode}.")
|
|
49
|
-
|
|
50
|
-
# 3. 加载编译好的动态链接库 (变量名改为 c_lib,避免与 lib 文件夹冲突)
|
|
51
|
-
lib_path = str(lib_path_obj)
|
|
52
|
-
c_lib = ctypes.cdll.LoadLibrary(lib_path)
|
|
53
|
-
|
|
54
|
-
# 4. 定义 C 函数的参数和返回值类型
|
|
55
|
-
c_lib.forward.argtypes = [
|
|
56
|
-
ctypes.POINTER(ctypes.c_float), 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
|
-
ctypes.POINTER(ctypes.c_float),
|
|
61
|
-
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
|
-
|
|
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
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
74
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
75
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
76
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
77
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
78
|
-
|
|
79
|
-
ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
80
|
-
ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
81
|
-
|
|
82
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
83
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
84
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
85
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
86
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
87
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
88
|
-
|
|
89
|
-
ctypes.c_float,ctypes.c_int,ctypes.c_int,ctypes.c_int,ctypes.c_float,
|
|
90
|
-
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_float),
|
|
91
|
-
ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
92
|
-
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_float),
|
|
93
|
-
ctypes.c_int
|
|
94
|
-
]
|
|
95
|
-
c_lib.forward.restype = None # 修复了绑定错误
|
|
96
|
-
|
|
97
|
-
c_lib.backward.argtypes = [
|
|
98
|
-
ctypes.POINTER(ctypes.c_float), 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),
|
|
102
|
-
ctypes.POINTER(ctypes.c_float),
|
|
103
|
-
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),#16
|
|
107
|
-
|
|
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),
|
|
115
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
116
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
117
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
118
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
119
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),#40
|
|
120
|
-
|
|
121
|
-
ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
122
|
-
ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
123
|
-
|
|
124
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
125
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
126
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
127
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
128
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
129
|
-
ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), #58
|
|
130
|
-
|
|
131
|
-
ctypes.c_float,ctypes.c_int,ctypes.c_int,ctypes.c_int,ctypes.c_float,
|
|
132
|
-
ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
|
133
|
-
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_float),
|
|
134
|
-
ctypes.c_int ,ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),
|
|
135
|
-
ctypes.c_int, ctypes.c_int
|
|
136
|
-
]
|
|
137
|
-
c_lib.backward.restype = None # 修复了绑定错误
|
|
138
|
-
|
|
139
|
-
__all__ = ['c_lib']
|
|
140
|
-
|
|
141
|
-
# ==============================================================================
|
|
142
|
-
# 第二步:在动态库环境就绪后再导入其余模块
|
|
143
|
-
# ==============================================================================
|
|
144
|
-
from .common import *
|
|
145
|
-
from .compute2 import *
|
|
146
|
-
from .multiscale import *
|
|
147
|
-
from .visual import *
|