@@ -52,15 +52,21 @@ def test_integration_matrix2D(nx, nz, variant, axes, useMPI=False, **kwargs):
5252@pytest .mark .parametrize ('axes' , [(- 2 ,), (- 1 ,), (- 2 , - 1 )])
5353@pytest .mark .parametrize ('bx' , ['cheby' , 'fft' ])
5454@pytest .mark .parametrize ('bz' , ['cheby' , 'fft' ])
55- def test_differentiation_matrix2D (nx , nz , variant , axes , bx , bz , ** kwargs ):
56- import numpy as np
55+ def test_differentiation_matrix2D (nx , nz , variant , axes , bx , bz , useGPU = False , ** kwargs ):
5756 from pySDC .helpers .spectral_helper import SpectralHelper
5857
59- helper = SpectralHelper (debug = True )
58+ helper = SpectralHelper (debug = True , useGPU = useGPU )
6059 helper .add_axis (base = bx , N = nx )
6160 helper .add_axis (base = bz , N = nz )
6261 helper .setup_fft ()
6362
63+ np = helper .xp
64+
65+ if useGPU :
66+ import cupy
67+
68+ assert np == cupy
69+
6470 X , Z = helper .get_grid ()
6571 conv = helper .get_basis_change_matrix ()
6672 D = helper .get_differentiation_matrix (axes )
@@ -95,6 +101,14 @@ def test_differentiation_matrix2D(nx, nz, variant, axes, bx, bz, **kwargs):
95101 assert np .allclose (D_u , expect , atol = 1e-11 )
96102
97103
104+ @pytest .mark .cupy
105+ @pytest .mark .parametrize ('axes' , [(- 2 ,), (- 1 ,), (- 2 , - 1 )])
106+ @pytest .mark .parametrize ('bx' , ['cheby' , 'fft' ])
107+ @pytest .mark .parametrize ('bz' , ['cheby' , 'fft' ])
108+ def test_differentiation_matrix2D_GPU (bx , bz , axes ):
109+ test_differentiation_matrix2D (32 , 16 , variant = 'T2U' , bx = bx , bz = bz , axes = axes , useGPU = True )
110+
111+
98112@pytest .mark .base
99113@pytest .mark .parametrize ('nx' , [32 ])
100114@pytest .mark .parametrize ('nz' , [16 ])
0 commit comments