def gpu_version(self, sig, fs, window, scaling):
     with cp.cuda.Stream.null:
         out = cusignal.periodogram(
             sig, fs, window=window, scaling=scaling
         )
     cp.cuda.Stream.null.synchronize()
     return out
示例#2
0
def test_periodogram(num_samps, fs, window, scaling):
    cpu_sig = np.random.rand(num_samps)
    gpu_sig = cp.asarray(cpu_sig)

    cpu_periodogram = signal.periodogram(cpu_sig, fs, window=window, scaling=scaling)
    gpu_periodogram = cp.asnumpy(cusignal.periodogram(gpu_sig, fs, window=window, scaling=scaling))

    assert array_equal(cpu_periodogram, gpu_periodogram)
示例#3
0
    def test_periodogram(self, rand_data_gen, num_samps, fs, window, scaling):
        cpu_sig, gpu_sig = rand_data_gen(num_samps)

        cpu_periodogram = signal.periodogram(cpu_sig,
                                             fs,
                                             window=window,
                                             scaling=scaling)
        gpu_periodogram = cp.asnumpy(
            cusignal.periodogram(gpu_sig, fs, window=window, scaling=scaling))

        assert array_equal(cpu_periodogram, gpu_periodogram)