Esempio n. 1
0
    def test_csd_complex(self, rand_complex_data_gen, num_samps, fs, nperseg):
        cpu_x, gpu_x = rand_complex_data_gen(num_samps)
        cpu_y, gpu_y = rand_complex_data_gen(num_samps)

        cpu_csd = signal.csd(cpu_x, cpu_y, fs, nperseg=nperseg)
        gpu_csd = cp.asnumpy(cusignal.csd(gpu_x, gpu_y, fs, nperseg=nperseg))

        assert array_equal(cpu_csd, gpu_csd)
Esempio n. 2
0
def test_csd_complex(num_samps, fs, nperseg):
    cpu_x = np.random.rand(num_samps) + 1j * np.random.rand(num_samps)
    cpu_y = np.random.rand(num_samps) + 1j * np.random.rand(num_samps)
    gpu_x = cp.asarray(cpu_x)
    gpu_y = cp.asarray(cpu_y)

    cpu_csd = signal.csd(cpu_x, cpu_y, fs, nperseg=nperseg)
    gpu_csd = cp.asnumpy(cusignal.csd(gpu_x, gpu_y, fs, nperseg=nperseg))

    assert array_equal(cpu_csd, gpu_csd)
Esempio n. 3
0
 def gpu_version(self, x, y, fs, nperseg):
     with cp.cuda.Stream.null:
         out = cusignal.csd(x, y, fs, nperseg=nperseg)
     cp.cuda.Stream.null.synchronize()
     return out