Coverage for gpaw/test/gpu/test_amend_insert.py: 30%
23 statements
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-14 00:18 +0000
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-14 00:18 +0000
1from gpaw.new.c import pw_amend_insert_realwf_gpu
2from gpaw.gpu import cupy_is_fake
3import pytest
6def reference_pw_amend_insert_realwf_gpu(array_nQ, n, m):
7 for array_Q in array_nQ:
8 t = array_Q[:, :, 0]
9 print(t.strides)
10 t[0, -m:] = t[0, m:0:-1].conj()
11 t[n:0:-1, -m:] = t[-n:, m:0:-1].conj()
12 t[-n:, -m:] = t[n:0:-1, m:0:-1].conj()
13 t[-n:, 0] = t[n:0:-1, 0].conj()
16@pytest.mark.gpu
17@pytest.mark.skipif(cupy_is_fake, reason='No cupy')
18def test_pw_amend_insert():
19 import cupy as cp
20 Band, Ax, Ay, Az = cp.indices((10, 6, 8, 10))
21 print(Ax.shape)
22 A = Ax * (1.0 + 0.0j)
23 A = cp.random.rand(10, 6, 8, 10) + 1j * cp.random.rand(10, 6, 8, 10)
24 B = A.copy()
25 reference_pw_amend_insert_realwf_gpu(A, 2, 3)
26 pw_amend_insert_realwf_gpu(B, 2, 3)
28 assert cp.allclose(A, B)