kernel-extraction 0.1.0__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.
Files changed (29) hide show
  1. kernel_extraction-0.1.0/.gitignore +6 -0
  2. kernel_extraction-0.1.0/Cargo.lock +496 -0
  3. kernel_extraction-0.1.0/Cargo.toml +25 -0
  4. kernel_extraction-0.1.0/PKG-INFO +93 -0
  5. kernel_extraction-0.1.0/README.md +78 -0
  6. kernel_extraction-0.1.0/build.rs +24 -0
  7. kernel_extraction-0.1.0/derivations/derivations.tex +166 -0
  8. kernel_extraction-0.1.0/kernel_extraction/__init__.py +41 -0
  9. kernel_extraction-0.1.0/kernel_extraction/compute_kernel.py +268 -0
  10. kernel_extraction-0.1.0/kernel_extraction/fit_kernel.py +139 -0
  11. kernel_extraction-0.1.0/kernel_extraction/kernel.py +344 -0
  12. kernel_extraction-0.1.0/kernel_extraction/kernel_from_traj.py +170 -0
  13. kernel_extraction-0.1.0/kernel_extraction/ref_kernels.py +446 -0
  14. kernel_extraction-0.1.0/pyproject.toml +15 -0
  15. kernel_extraction-0.1.0/rust-toolchain.toml +5 -0
  16. kernel_extraction-0.1.0/src/kernel_cuda.rs +357 -0
  17. kernel_extraction-0.1.0/src/kernel_steps.cu +63 -0
  18. kernel_extraction-0.1.0/src/kernel_steps.ptx +332 -0
  19. kernel_extraction-0.1.0/src/lib.rs +467 -0
  20. kernel_extraction-0.1.0/test/conftest.py +29 -0
  21. kernel_extraction-0.1.0/test/data/aa_corr.npy +0 -0
  22. kernel_extraction-0.1.0/test/data/adu_corr.npy +0 -0
  23. kernel_extraction-0.1.0/test/data/va_corr.npy +0 -0
  24. kernel_extraction-0.1.0/test/data/vdu_corr.npy +0 -0
  25. kernel_extraction-0.1.0/test/data/vv_corr.npy +0 -0
  26. kernel_extraction-0.1.0/test/data/xdu_corr.npy +0 -0
  27. kernel_extraction-0.1.0/test/kernel_ref.npy +0 -0
  28. kernel_extraction-0.1.0/test/test_kernels.py +273 -0
  29. kernel_extraction-0.1.0/test/utils.py +120 -0
@@ -0,0 +1,6 @@
1
+ Cargo.lock
2
+ target
3
+ kernel_extraction/kernel_extraction.cpython*
4
+ *pycache*
5
+ *.pdf
6
+ test/timings
@@ -0,0 +1,496 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "approx"
7
+ version = "0.4.0"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278"
10
+ dependencies = [
11
+ "num-traits",
12
+ ]
13
+
14
+ [[package]]
15
+ name = "autocfg"
16
+ version = "1.5.1"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
19
+
20
+ [[package]]
21
+ name = "bitflags"
22
+ version = "2.13.2"
23
+ source = "registry+https://github.com/rust-lang/crates.io-index"
24
+ checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
25
+
26
+ [[package]]
27
+ name = "cfg-if"
28
+ version = "1.0.5"
29
+ source = "registry+https://github.com/rust-lang/crates.io-index"
30
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
31
+
32
+ [[package]]
33
+ name = "console"
34
+ version = "0.15.8"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb"
37
+ dependencies = [
38
+ "encode_unicode",
39
+ "lazy_static",
40
+ "libc",
41
+ "unicode-width",
42
+ "windows-sys",
43
+ ]
44
+
45
+ [[package]]
46
+ name = "crossbeam-deque"
47
+ version = "0.8.8"
48
+ source = "registry+https://github.com/rust-lang/crates.io-index"
49
+ checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a"
50
+ dependencies = [
51
+ "crossbeam-epoch",
52
+ "crossbeam-utils",
53
+ ]
54
+
55
+ [[package]]
56
+ name = "crossbeam-epoch"
57
+ version = "0.9.21"
58
+ source = "registry+https://github.com/rust-lang/crates.io-index"
59
+ checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d"
60
+ dependencies = [
61
+ "crossbeam-utils",
62
+ ]
63
+
64
+ [[package]]
65
+ name = "crossbeam-utils"
66
+ version = "0.8.23"
67
+ source = "registry+https://github.com/rust-lang/crates.io-index"
68
+ checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
69
+
70
+ [[package]]
71
+ name = "cudarc"
72
+ version = "0.19.10"
73
+ source = "registry+https://github.com/rust-lang/crates.io-index"
74
+ checksum = "7359bf1de037ddada72729c3acec9b040f3468400c6e9e740b01ba0cd2e89562"
75
+ dependencies = [
76
+ "libloading",
77
+ ]
78
+
79
+ [[package]]
80
+ name = "either"
81
+ version = "1.19.0"
82
+ source = "registry+https://github.com/rust-lang/crates.io-index"
83
+ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
84
+
85
+ [[package]]
86
+ name = "encode_unicode"
87
+ version = "0.3.6"
88
+ source = "registry+https://github.com/rust-lang/crates.io-index"
89
+ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
90
+
91
+ [[package]]
92
+ name = "indicatif"
93
+ version = "0.17.8"
94
+ source = "registry+https://github.com/rust-lang/crates.io-index"
95
+ checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3"
96
+ dependencies = [
97
+ "console",
98
+ "instant",
99
+ "number_prefix",
100
+ "portable-atomic",
101
+ "unicode-width",
102
+ ]
103
+
104
+ [[package]]
105
+ name = "indoc"
106
+ version = "1.0.9"
107
+ source = "registry+https://github.com/rust-lang/crates.io-index"
108
+ checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306"
109
+
110
+ [[package]]
111
+ name = "instant"
112
+ version = "0.1.12"
113
+ source = "registry+https://github.com/rust-lang/crates.io-index"
114
+ checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
115
+ dependencies = [
116
+ "cfg-if",
117
+ ]
118
+
119
+ [[package]]
120
+ name = "kernel_extraction"
121
+ version = "0.1.0"
122
+ dependencies = [
123
+ "cudarc",
124
+ "indicatif",
125
+ "ndarray",
126
+ "numpy",
127
+ "pyo3",
128
+ "rayon",
129
+ ]
130
+
131
+ [[package]]
132
+ name = "lazy_static"
133
+ version = "1.5.1"
134
+ source = "registry+https://github.com/rust-lang/crates.io-index"
135
+ checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"
136
+
137
+ [[package]]
138
+ name = "libc"
139
+ version = "0.2.191"
140
+ source = "registry+https://github.com/rust-lang/crates.io-index"
141
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
142
+
143
+ [[package]]
144
+ name = "libloading"
145
+ version = "0.9.1"
146
+ source = "registry+https://github.com/rust-lang/crates.io-index"
147
+ checksum = "a1832accd5a4ca2795ace4d05d15c4039be15b62d3b950eff99746a990e3cc10"
148
+ dependencies = [
149
+ "cfg-if",
150
+ "windows-link",
151
+ ]
152
+
153
+ [[package]]
154
+ name = "lock_api"
155
+ version = "0.4.14"
156
+ source = "registry+https://github.com/rust-lang/crates.io-index"
157
+ checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
158
+ dependencies = [
159
+ "scopeguard",
160
+ ]
161
+
162
+ [[package]]
163
+ name = "matrixmultiply"
164
+ version = "0.3.11"
165
+ source = "registry+https://github.com/rust-lang/crates.io-index"
166
+ checksum = "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7"
167
+ dependencies = [
168
+ "autocfg",
169
+ "rawpointer",
170
+ ]
171
+
172
+ [[package]]
173
+ name = "ndarray"
174
+ version = "0.15.6"
175
+ source = "registry+https://github.com/rust-lang/crates.io-index"
176
+ checksum = "adb12d4e967ec485a5f71c6311fe28158e9d6f4bc4a447b474184d0f91a8fa32"
177
+ dependencies = [
178
+ "approx",
179
+ "matrixmultiply",
180
+ "num-complex",
181
+ "num-integer",
182
+ "num-traits",
183
+ "rawpointer",
184
+ ]
185
+
186
+ [[package]]
187
+ name = "num-complex"
188
+ version = "0.4.6"
189
+ source = "registry+https://github.com/rust-lang/crates.io-index"
190
+ checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
191
+ dependencies = [
192
+ "num-traits",
193
+ ]
194
+
195
+ [[package]]
196
+ name = "num-integer"
197
+ version = "0.1.47"
198
+ source = "registry+https://github.com/rust-lang/crates.io-index"
199
+ checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b"
200
+ dependencies = [
201
+ "num-traits",
202
+ ]
203
+
204
+ [[package]]
205
+ name = "num-traits"
206
+ version = "0.2.19"
207
+ source = "registry+https://github.com/rust-lang/crates.io-index"
208
+ checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
209
+ dependencies = [
210
+ "autocfg",
211
+ ]
212
+
213
+ [[package]]
214
+ name = "number_prefix"
215
+ version = "0.4.0"
216
+ source = "registry+https://github.com/rust-lang/crates.io-index"
217
+ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
218
+
219
+ [[package]]
220
+ name = "numpy"
221
+ version = "0.16.2"
222
+ source = "registry+https://github.com/rust-lang/crates.io-index"
223
+ checksum = "383ae168529a39fc97cbc1d9d4fa865377731a519bc27553ed96f50594de7c45"
224
+ dependencies = [
225
+ "libc",
226
+ "ndarray",
227
+ "num-complex",
228
+ "num-traits",
229
+ "pyo3",
230
+ ]
231
+
232
+ [[package]]
233
+ name = "once_cell"
234
+ version = "1.21.4"
235
+ source = "registry+https://github.com/rust-lang/crates.io-index"
236
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
237
+
238
+ [[package]]
239
+ name = "parking_lot"
240
+ version = "0.12.5"
241
+ source = "registry+https://github.com/rust-lang/crates.io-index"
242
+ checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
243
+ dependencies = [
244
+ "lock_api",
245
+ "parking_lot_core",
246
+ ]
247
+
248
+ [[package]]
249
+ name = "parking_lot_core"
250
+ version = "0.9.12"
251
+ source = "registry+https://github.com/rust-lang/crates.io-index"
252
+ checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
253
+ dependencies = [
254
+ "cfg-if",
255
+ "libc",
256
+ "redox_syscall",
257
+ "smallvec",
258
+ "windows-link",
259
+ ]
260
+
261
+ [[package]]
262
+ name = "portable-atomic"
263
+ version = "1.6.0"
264
+ source = "registry+https://github.com/rust-lang/crates.io-index"
265
+ checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0"
266
+
267
+ [[package]]
268
+ name = "proc-macro2"
269
+ version = "1.0.107"
270
+ source = "registry+https://github.com/rust-lang/crates.io-index"
271
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
272
+ dependencies = [
273
+ "unicode-ident",
274
+ ]
275
+
276
+ [[package]]
277
+ name = "pyo3"
278
+ version = "0.16.6"
279
+ source = "registry+https://github.com/rust-lang/crates.io-index"
280
+ checksum = "0220c44442c9b239dd4357aa856ac468a4f5e1f0df19ddb89b2522952eb4c6ca"
281
+ dependencies = [
282
+ "cfg-if",
283
+ "indoc",
284
+ "libc",
285
+ "parking_lot",
286
+ "pyo3-build-config",
287
+ "pyo3-ffi",
288
+ "pyo3-macros",
289
+ "unindent",
290
+ ]
291
+
292
+ [[package]]
293
+ name = "pyo3-build-config"
294
+ version = "0.16.6"
295
+ source = "registry+https://github.com/rust-lang/crates.io-index"
296
+ checksum = "9c819d397859445928609d0ec5afc2da5204e0d0f73d6bf9e153b04e83c9cdc2"
297
+ dependencies = [
298
+ "once_cell",
299
+ "target-lexicon",
300
+ ]
301
+
302
+ [[package]]
303
+ name = "pyo3-ffi"
304
+ version = "0.16.6"
305
+ source = "registry+https://github.com/rust-lang/crates.io-index"
306
+ checksum = "ca882703ab55f54702d7bfe1189b41b0af10272389f04cae38fe4cd56c65f75f"
307
+ dependencies = [
308
+ "libc",
309
+ "pyo3-build-config",
310
+ ]
311
+
312
+ [[package]]
313
+ name = "pyo3-macros"
314
+ version = "0.16.6"
315
+ source = "registry+https://github.com/rust-lang/crates.io-index"
316
+ checksum = "568749402955ad7be7bad9a09b8593851cd36e549ac90bfd44079cea500f3f21"
317
+ dependencies = [
318
+ "proc-macro2",
319
+ "pyo3-macros-backend",
320
+ "quote",
321
+ "syn",
322
+ ]
323
+
324
+ [[package]]
325
+ name = "pyo3-macros-backend"
326
+ version = "0.16.6"
327
+ source = "registry+https://github.com/rust-lang/crates.io-index"
328
+ checksum = "611f64e82d98f447787e82b8e7b0ebc681e1eb78fc1252668b2c605ffb4e1eb8"
329
+ dependencies = [
330
+ "proc-macro2",
331
+ "quote",
332
+ "syn",
333
+ ]
334
+
335
+ [[package]]
336
+ name = "quote"
337
+ version = "1.0.47"
338
+ source = "registry+https://github.com/rust-lang/crates.io-index"
339
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
340
+ dependencies = [
341
+ "proc-macro2",
342
+ ]
343
+
344
+ [[package]]
345
+ name = "rawpointer"
346
+ version = "0.2.1"
347
+ source = "registry+https://github.com/rust-lang/crates.io-index"
348
+ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
349
+
350
+ [[package]]
351
+ name = "rayon"
352
+ version = "1.12.0"
353
+ source = "registry+https://github.com/rust-lang/crates.io-index"
354
+ checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
355
+ dependencies = [
356
+ "either",
357
+ "rayon-core",
358
+ ]
359
+
360
+ [[package]]
361
+ name = "rayon-core"
362
+ version = "1.13.0"
363
+ source = "registry+https://github.com/rust-lang/crates.io-index"
364
+ checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
365
+ dependencies = [
366
+ "crossbeam-deque",
367
+ "crossbeam-utils",
368
+ ]
369
+
370
+ [[package]]
371
+ name = "redox_syscall"
372
+ version = "0.5.18"
373
+ source = "registry+https://github.com/rust-lang/crates.io-index"
374
+ checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
375
+ dependencies = [
376
+ "bitflags",
377
+ ]
378
+
379
+ [[package]]
380
+ name = "scopeguard"
381
+ version = "1.2.0"
382
+ source = "registry+https://github.com/rust-lang/crates.io-index"
383
+ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
384
+
385
+ [[package]]
386
+ name = "smallvec"
387
+ version = "1.16.6"
388
+ source = "registry+https://github.com/rust-lang/crates.io-index"
389
+ checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59"
390
+
391
+ [[package]]
392
+ name = "syn"
393
+ version = "1.0.109"
394
+ source = "registry+https://github.com/rust-lang/crates.io-index"
395
+ checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
396
+ dependencies = [
397
+ "proc-macro2",
398
+ "quote",
399
+ "unicode-ident",
400
+ ]
401
+
402
+ [[package]]
403
+ name = "target-lexicon"
404
+ version = "0.12.16"
405
+ source = "registry+https://github.com/rust-lang/crates.io-index"
406
+ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
407
+
408
+ [[package]]
409
+ name = "unicode-ident"
410
+ version = "1.0.27"
411
+ source = "registry+https://github.com/rust-lang/crates.io-index"
412
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
413
+
414
+ [[package]]
415
+ name = "unicode-width"
416
+ version = "0.1.14"
417
+ source = "registry+https://github.com/rust-lang/crates.io-index"
418
+ checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
419
+
420
+ [[package]]
421
+ name = "unindent"
422
+ version = "0.1.11"
423
+ source = "registry+https://github.com/rust-lang/crates.io-index"
424
+ checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c"
425
+
426
+ [[package]]
427
+ name = "windows-link"
428
+ version = "0.2.1"
429
+ source = "registry+https://github.com/rust-lang/crates.io-index"
430
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
431
+
432
+ [[package]]
433
+ name = "windows-sys"
434
+ version = "0.52.0"
435
+ source = "registry+https://github.com/rust-lang/crates.io-index"
436
+ checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
437
+ dependencies = [
438
+ "windows-targets",
439
+ ]
440
+
441
+ [[package]]
442
+ name = "windows-targets"
443
+ version = "0.52.4"
444
+ source = "registry+https://github.com/rust-lang/crates.io-index"
445
+ checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b"
446
+ dependencies = [
447
+ "windows_aarch64_gnullvm",
448
+ "windows_aarch64_msvc",
449
+ "windows_i686_gnu",
450
+ "windows_i686_msvc",
451
+ "windows_x86_64_gnu",
452
+ "windows_x86_64_gnullvm",
453
+ "windows_x86_64_msvc",
454
+ ]
455
+
456
+ [[package]]
457
+ name = "windows_aarch64_gnullvm"
458
+ version = "0.52.4"
459
+ source = "registry+https://github.com/rust-lang/crates.io-index"
460
+ checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9"
461
+
462
+ [[package]]
463
+ name = "windows_aarch64_msvc"
464
+ version = "0.52.4"
465
+ source = "registry+https://github.com/rust-lang/crates.io-index"
466
+ checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675"
467
+
468
+ [[package]]
469
+ name = "windows_i686_gnu"
470
+ version = "0.52.4"
471
+ source = "registry+https://github.com/rust-lang/crates.io-index"
472
+ checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3"
473
+
474
+ [[package]]
475
+ name = "windows_i686_msvc"
476
+ version = "0.52.4"
477
+ source = "registry+https://github.com/rust-lang/crates.io-index"
478
+ checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02"
479
+
480
+ [[package]]
481
+ name = "windows_x86_64_gnu"
482
+ version = "0.52.4"
483
+ source = "registry+https://github.com/rust-lang/crates.io-index"
484
+ checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03"
485
+
486
+ [[package]]
487
+ name = "windows_x86_64_gnullvm"
488
+ version = "0.52.4"
489
+ source = "registry+https://github.com/rust-lang/crates.io-index"
490
+ checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177"
491
+
492
+ [[package]]
493
+ name = "windows_x86_64_msvc"
494
+ version = "0.52.4"
495
+ source = "registry+https://github.com/rust-lang/crates.io-index"
496
+ checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"
@@ -0,0 +1,25 @@
1
+ [package]
2
+ name = "kernel_extraction"
3
+ version = "0.1.0"
4
+ authors = ["Lucas Tepper <lucas.tepper.91@gmail.com>"]
5
+ edition = "2021"
6
+ readme = "README.md"
7
+
8
+ [lib]
9
+ name = "kernel_extraction"
10
+ crate-type = ["cdylib"]
11
+
12
+ [dependencies]
13
+ numpy = "0.16.2"
14
+ ndarray = { version = "0.15.4", features = ["approx"] }
15
+ rayon = "1.5.3"
16
+ cudarc = { version = "0.19.10", default-features = false, features = ["std", "driver", "cublas", "nvrtc", "dynamic-loading", "cuda-12060"], optional = true }
17
+ indicatif = "0.17.2"
18
+
19
+ [dependencies.pyo3]
20
+ version = "0.16.5"
21
+ features = ["extension-module"]
22
+
23
+ [features]
24
+ default = ["cuda"]
25
+ cuda = ["dep:cudarc"]
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: kernel_extraction
3
+ Version: 0.1.0
4
+ Classifier: Programming Language :: Python
5
+ Classifier: Programming Language :: Rust
6
+ Requires-Dist: numpy
7
+ Requires-Dist: scipy>=1.6
8
+ Requires-Dist: matplotlib
9
+ Requires-Dist: tqdm
10
+ Requires-Dist: correlation-fft
11
+ Summary: Extract generalized Langevin memory kernels from time correlation functions using Volterra equations.
12
+ Requires-Python: >=3.7
13
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
14
+
15
+ # kernel_extraction
16
+
17
+ `kernel_extraction` estimates the memory kernel of a generalized Langevin equation
18
+ from time correlation functions. The memory kernel describes how past motion
19
+ contributes to friction. The package solves discretized Volterra equations on
20
+ a uniform time grid and returns either the memory kernel `Γ(t)` or its running
21
+ integral `G(t)`, depending on the method.
22
+
23
+ A derivation is in the [derivations folder](derivations/) of the repository.
24
+
25
+ ## Installation
26
+
27
+ With a Rust toolchain and maturin installed, run this from the repository root.
28
+
29
+ ```bash
30
+ maturin build --release
31
+ pip install target/wheels/correlation-*.whl
32
+ ```
33
+
34
+ The build embeds `src/kernel_steps.ptx` and requires no CUDA toolkit.
35
+
36
+ ## Extract a kernel from correlations
37
+
38
+ This example uses the sample correlations in the repository. `vv_corr` is the
39
+ velocity autocorrelation, and `xdu_corr` correlates position with the potential
40
+ gradient. Use one-dimensional NumPy arrays of dtype `float64` sampled at the
41
+ same lag spacing. Set `dt` to that spacing and `trunc` to the requested number
42
+ of output samples.
43
+
44
+ ```python
45
+ import numpy as np
46
+ from kernel_extraction import ExtractionMethod, compute_kernel
47
+
48
+ # Run from the repository root.
49
+ vv_corr = np.load("test/data/vv_corr.npy").astype(np.float64)
50
+ xdu_corr = np.load("test/data/xdu_corr.npy").astype(np.float64)
51
+ dt = 0.01
52
+ mass = 2.494 / vv_corr[0] # kBT / Cvv(0) for these sample data
53
+
54
+ kernel_int = compute_kernel(
55
+ ExtractionMethod.G_METHOD_XDU,
56
+ dt=dt,
57
+ mass=mass,
58
+ vv_corr=vv_corr,
59
+ xdu_corr=xdu_corr,
60
+ trunc=200,
61
+ device="auto",
62
+ )
63
+ ```
64
+
65
+ | Method | Required correlations | Returns |
66
+ | --- | --- | --- |
67
+ | `G_METHOD_XDU` | `vv_corr`, `xdu_corr` | Running integral |
68
+ | `G_METHOD_XDU_NOMASS` | `vv_corr`, `xdu_corr` | Running integral |
69
+ | `G_METHOD_XDU_HALFSTEP` | `vv_corr`, `xdu_corr` | Running integral on the half-step grid |
70
+ | `G_METHOD_VDU` | `vv_corr`, `vdu_corr` | Running integral |
71
+ | `GAMMA_METHOD` | `vv_corr`, `va_corr`, `aa_corr`, `adu_corr` | Memory kernel |
72
+
73
+ Pass the mass to every method except `G_METHOD_XDU_NOMASS`. To extract a
74
+ position-dependent kernel from conditional correlations, use
75
+ `compute_kernel_2d` with arrays shaped `(n_lags, n_bins)` and a mass per bin
76
+ or thermal energy `kbt`. If you are starting from trajectories,
77
+ `kernel_from_traj` computes the correlations and returns them with the kernel.
78
+ That workflow also requires the `correlation` and `md_utils` Python modules.
79
+
80
+ ## Choosing a device
81
+
82
+ The same wheel supports both CPU and CUDA on hosts that match its Python ABI
83
+ and platform tag. Pass `device` to `compute_kernel`, `compute_kernel_2d`,
84
+ `kernel_from_traj`, or a low-level extraction function.
85
+
86
+ - `device="cpu"` uses the CPU and is the default in the Python wrappers.
87
+ - `device="cuda"` uses CUDA device 0 and raises `RuntimeError` if CUDA setup fails.
88
+ - `device="auto"` tries CUDA device 0 and uses the CPU if CUDA setup fails.
89
+
90
+ CUDA requires a visible NVIDIA GPU, a driver that supports the embedded
91
+ CUDA 12.6 PTX, and a CUDA 12 cuBLAS shared library on the system library
92
+ search path. The CPU backend requires no NVIDIA libraries.
93
+
@@ -0,0 +1,78 @@
1
+ # kernel_extraction
2
+
3
+ `kernel_extraction` estimates the memory kernel of a generalized Langevin equation
4
+ from time correlation functions. The memory kernel describes how past motion
5
+ contributes to friction. The package solves discretized Volterra equations on
6
+ a uniform time grid and returns either the memory kernel `Γ(t)` or its running
7
+ integral `G(t)`, depending on the method.
8
+
9
+ A derivation is in the [derivations folder](derivations/) of the repository.
10
+
11
+ ## Installation
12
+
13
+ With a Rust toolchain and maturin installed, run this from the repository root.
14
+
15
+ ```bash
16
+ maturin build --release
17
+ pip install target/wheels/correlation-*.whl
18
+ ```
19
+
20
+ The build embeds `src/kernel_steps.ptx` and requires no CUDA toolkit.
21
+
22
+ ## Extract a kernel from correlations
23
+
24
+ This example uses the sample correlations in the repository. `vv_corr` is the
25
+ velocity autocorrelation, and `xdu_corr` correlates position with the potential
26
+ gradient. Use one-dimensional NumPy arrays of dtype `float64` sampled at the
27
+ same lag spacing. Set `dt` to that spacing and `trunc` to the requested number
28
+ of output samples.
29
+
30
+ ```python
31
+ import numpy as np
32
+ from kernel_extraction import ExtractionMethod, compute_kernel
33
+
34
+ # Run from the repository root.
35
+ vv_corr = np.load("test/data/vv_corr.npy").astype(np.float64)
36
+ xdu_corr = np.load("test/data/xdu_corr.npy").astype(np.float64)
37
+ dt = 0.01
38
+ mass = 2.494 / vv_corr[0] # kBT / Cvv(0) for these sample data
39
+
40
+ kernel_int = compute_kernel(
41
+ ExtractionMethod.G_METHOD_XDU,
42
+ dt=dt,
43
+ mass=mass,
44
+ vv_corr=vv_corr,
45
+ xdu_corr=xdu_corr,
46
+ trunc=200,
47
+ device="auto",
48
+ )
49
+ ```
50
+
51
+ | Method | Required correlations | Returns |
52
+ | --- | --- | --- |
53
+ | `G_METHOD_XDU` | `vv_corr`, `xdu_corr` | Running integral |
54
+ | `G_METHOD_XDU_NOMASS` | `vv_corr`, `xdu_corr` | Running integral |
55
+ | `G_METHOD_XDU_HALFSTEP` | `vv_corr`, `xdu_corr` | Running integral on the half-step grid |
56
+ | `G_METHOD_VDU` | `vv_corr`, `vdu_corr` | Running integral |
57
+ | `GAMMA_METHOD` | `vv_corr`, `va_corr`, `aa_corr`, `adu_corr` | Memory kernel |
58
+
59
+ Pass the mass to every method except `G_METHOD_XDU_NOMASS`. To extract a
60
+ position-dependent kernel from conditional correlations, use
61
+ `compute_kernel_2d` with arrays shaped `(n_lags, n_bins)` and a mass per bin
62
+ or thermal energy `kbt`. If you are starting from trajectories,
63
+ `kernel_from_traj` computes the correlations and returns them with the kernel.
64
+ That workflow also requires the `correlation` and `md_utils` Python modules.
65
+
66
+ ## Choosing a device
67
+
68
+ The same wheel supports both CPU and CUDA on hosts that match its Python ABI
69
+ and platform tag. Pass `device` to `compute_kernel`, `compute_kernel_2d`,
70
+ `kernel_from_traj`, or a low-level extraction function.
71
+
72
+ - `device="cpu"` uses the CPU and is the default in the Python wrappers.
73
+ - `device="cuda"` uses CUDA device 0 and raises `RuntimeError` if CUDA setup fails.
74
+ - `device="auto"` tries CUDA device 0 and uses the CPU if CUDA setup fails.
75
+
76
+ CUDA requires a visible NVIDIA GPU, a driver that supports the embedded
77
+ CUDA 12.6 PTX, and a CUDA 12 cuBLAS shared library on the system library
78
+ search path. The CPU backend requires no NVIDIA libraries.