MCPcopy
hub / github.com/stumpy-dev/stumpy / gpu_aamp

Function gpu_aamp

stumpy/gpu_aamp.py:443–722  ·  view source on GitHub ↗

Compute the non-normalized (i.e., without z-normalization) matrix profile with one or more GPU devices This is a convenience wrapper around the Numba `cuda.jit` `_gpu_aamp` function which computes the non-normalized (top-k) matrix profile according to modified version GPU-STOMP

(T_A, m, T_B=None, ignore_trivial=True, device_id=0, p=2.0, k=1)

Source from the content-addressed store, hash-verified

441
442
443def gpu_aamp(T_A, m, T_B=None, ignore_trivial=True, device_id=0, p=2.0, k=1):
444 """
445 Compute the non-normalized (i.e., without z-normalization) matrix profile with
446 one or more GPU devices
447
448 This is a convenience wrapper around the Numba `cuda.jit` `_gpu_aamp` function
449 which computes the non-normalized (top-k) matrix profile according to modified
450 version GPU-STOMP. The default number of threads-per-block is set to `512` and
451 may be changed by setting the global parameter `config.STUMPY_THREADS_PER_BLOCK`
452 to an appropriate number based on your GPU hardware.
453
454 Parameters
455 ----------
456 T_A : numpy.ndarray
457 The time series or sequence for which to compute the matrix profile
458
459 m : int
460 Window size
461
462 T_B : numpy.ndarray, default None
463 The time series or sequence that contain your query subsequences
464 of interest. Default is `None` which corresponds to a self-join.
465
466 ignore_trivial : bool, default True
467 Set to `True` if this is a self-join. Otherwise, for AB-join, set this
468 to `False`. Default is `True`.
469
470 device_id : int or list, default 0
471 The (GPU) device number to use. The default value is `0`. A list of
472 valid device ids (int) may also be provided for parallel GPU-STUMP
473 computation. A list of all valid device ids can be obtained by
474 executing `[device.id for device in numba.cuda.list_devices()]`.
475
476 p : float, default 2.0
477 The p-norm to apply for computing the Minkowski distance. Minkowski distance is
478 typically used with `p` being 1 or 2, which correspond to the Manhattan distance
479 and the Euclidean distance, respectively.
480
481 k : int, default 1
482 The number of top `k` smallest distances used to construct the matrix profile.
483 Note that this will increase the total computational time and memory usage
484 when k > 1.
485
486 Returns
487 -------
488 out : numpy.ndarray
489 When k = 1 (default), the first column consists of the matrix profile,
490 the second column consists of the matrix profile indices, the third column
491 consists of the left matrix profile indices, and the fourth column consists
492 of the right matrix profile indices. However, when k > 1, the output array
493 will contain exactly 2 * k + 2 columns. The first k columns (i.e., out[:, :k])
494 consists of the top-k matrix profile, the next set of k columns
495 (i.e., out[:, k:2k]) consists of the corresponding top-k matrix profile
496 indices, and the last two columns (i.e., out[:, 2k] and out[:, 2k+1] or,
497 equivalently, out[:, -2] and out[:, -1]) correspond to the top-1 left
498 matrix profile indices and the top-1 right matrix profile indices, respectively.
499
500 For convenience, the matrix profile (distances) and matrix profile indices can

Calls 2

mparrayClass · 0.90
_gpu_aampFunction · 0.85