diff options
| author | Tomáš Jusko | 2022-04-04 11:00:30 +0200 |
|---|---|---|
| committer | Tomáš Jusko | 2022-04-04 11:00:30 +0200 |
| commit | 5689996a74e3af04075ff620c3e7ae00f5694d58 (patch) | |
| tree | 60628993303974ba04f93321ff740a1ea87cc5fa | |
| parent | 4ae4954c17139b2eb0f1dbd4beb0b542c1b3058a (diff) | |
| download | pyecsca-5689996a74e3af04075ff620c3e7ae00f5694d58.tar.gz pyecsca-5689996a74e3af04075ff620c3e7ae00f5694d58.tar.zst pyecsca-5689996a74e3af04075ff620c3e7ae00f5694d58.zip | |
fix: Minor fixes as per PR comments
| -rw-r--r-- | pyecsca/sca/stacked_traces/stacked_traces.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/pyecsca/sca/stacked_traces/stacked_traces.py b/pyecsca/sca/stacked_traces/stacked_traces.py index c108e50..48718d0 100644 --- a/pyecsca/sca/stacked_traces/stacked_traces.py +++ b/pyecsca/sca/stacked_traces/stacked_traces.py @@ -70,7 +70,8 @@ class GPUTraceManager: :return: Created context of input and output arrays and calculated blocks per grid dimensions. """ - assert isinstance(tpb, int) + if not isinstance(tpb, int): + raise TypeError("tpb is not an int") if tpb % 32 != 0: raise ValueError('Threads per block should be a multiple of 32') @@ -100,7 +101,8 @@ class GPUTraceManager: :param output_count: Number of outputs expected from the GPU function. :return: Combined trace output from the GPU function """ - assert isinstance(tpb, int) + if not isinstance(tpb, int): + raise TypeError("tpb is not an int") samples_global, device_outputs, bpg = GPUTraceManager._setup1D( traces, tpb, output_count ) @@ -168,7 +170,9 @@ class GPUTraceManager: :param traces: :return: """ - averages, variances = GPUTraceManager._gpu_combine1D(gpu_avg_var, traces, tpb, 2) + averages, variances = GPUTraceManager._gpu_combine1D( + gpu_avg_var, traces, tpb, 2 + ) return averages, variances @staticmethod @@ -285,7 +289,8 @@ def gpu_avg_var(samples: np.ndarray, result_avg: np.ndarray, Sample average and variance of stacked traces, sample-wise. :param samples: Stacked traces' samples. - :param result: Result output array. + :param result_avg: Result average output array. + :param result_var: Result variance output array. """ col = cuda.grid(1) |
