Beispiel #1
0
 def gpu_version(self, sig, num_taps, mode, method):
     with cp.cuda.Stream.null:
         out = cusignal.correlate(sig,
                                  num_taps,
                                  mode=mode,
                                  method=method)
     cp.cuda.Stream.null.synchronize()
     return out
Beispiel #2
0
def test_correlate(num_samps, num_taps, mode='same'):
    cpu_sig = np.random.rand(num_samps)
    gpu_sig = cp.asarray(cpu_sig)

    cpu_corr = signal.correlate(cpu_sig, np.ones(num_taps), mode=mode)
    gpu_corr = cp.asnumpy(
        cusignal.correlate(gpu_sig, cp.ones(num_taps), mode=mode))
    assert array_equal(cpu_corr, gpu_corr)
Beispiel #3
0
    def test_correlate(self, rand_data_gen, num_samps, num_taps, mode, method):
        cpu_sig, gpu_sig = rand_data_gen(num_samps)

        cpu_corr = signal.correlate(cpu_sig,
                                    np.ones(num_taps),
                                    mode=mode,
                                    method=method)
        gpu_corr = cp.asnumpy(
            cusignal.correlate(gpu_sig,
                               cp.ones(num_taps),
                               mode=mode,
                               method=method))
        assert array_equal(cpu_corr, gpu_corr)