<commit_before># -*- coding: utf-8 -*-

import numpy as np

from pycuda.compiler import SourceModule

from pyfr.backends.cuda.provider import CudaKernelProvider
from pyfr.backends.cuda.queue import CudaComputeKernel
from pyfr.util import npdtype_to_ctype

class CudaPointwiseKernels(CudaKernelProvider):
    def __init__(self, backend):
        pass

    def _modopts(self, dtype, ndims, nvars):
        return dict(dtype=npdtype_to_ctype(dtype), ndims=ndims, nvars=nvars)

    def tdisf_inv(self, ndims, nvars, u, smats, f, gamma):
        nupts, neles = u.nrow, u.ncol / nvars

        fn = self._get_function('pointwise', 'tdisf_inv', [np.int32]*2 +
                                [np.intp]*3 + [u.dtype] + [np.int32]*3,
                                self._modopts(u.dtype, ndims, nvars))

        block = (256, 1, 1)
        grid = self._get_grid_for_block(block, neles)

        class TdisInvKernel(CudaComputeKernel):
            def run(self, scomp, scopy):
                fn.prepared_async_call(grid, block, scomp, nupts, neles,
                                       u.data, smats.data, f.data, gamma,
                                       u.leaddim, smats.leaddim, f.leaddim)

        return TdisInvKernel()

    def rsolve_rus_inv_int(self, ndims, nvars, ul_v, pnl_v, ur_v, pnr_v, gamma):
        ninters = ul_v.ncol
        dtype = ul_v.refdtype

        fn = self._get_function('pointwise', 'rsolve_rus_inv_int',
                                [np.int32] + [np.intp]*8 + [dtype],
                                self._modopts(dtype, ndims, nvars))

        block = (256, 1, 1)
        grid = self._get_grid_for_block(block, ninters)

        class RsolveRusInvIntKernel(CudaComputeKernel):
            def run(self, scomp, scopy):
                fn.prepared_async_call(grid, block, scomp, ninters,
                                       ul_v.mapping.data, ul_v.strides.data,
                                       ur_v.mapping.data, ur_v.strides.data,
                                       pnl_v.mapping.data, pnr_v.strides.data,
                                       pnr_v.mapping.data, pnr_v.strides.data,
                                       gamma)

        return RsolveRusInvIntKernel()

    def rsolve_rus_inv_mpi(self, ndims, nvars, ul_mpiv, ur_mpim, pnl_v, gamma):
        ninters = ul_mpiv.ncol
        ul_v = ul_mpiv.view
        dtype = ul_v.refdtype

        fn = self._get_function('pointwise', 'rsolve_rus_inv_mpi',
                                [np.int32] + [np.intp]*5 + [dtype],
                                self._modopts(dtype, ndims, nvars))

        block = (256, 1, 1)
        grid = self._get_grid_for_block(block, ninters)

        class RsolveRusInvMPIKernel(CudaComputeKernel):
            def run(self, scomp, scopy):
                fn.prepared_async_call(grid, block, scomp, ninters,
                                       ul_v.mapping.data, ul_v.strides.data,
                                       ur_mpim.data,
                                       pnl_v.mapping.data, pnl_v.strides.data,<commit_msg>Fix a typo in the pointwise CUDA kernels.<commit_after># -*- coding: utf-8 -*-

import numpy as np

from pycuda.compiler import SourceModule

from pyfr.backends.cuda.provider import CudaKernelProvider
from pyfr.backends.cuda.queue import CudaComputeKernel
from pyfr.util import npdtype_to_ctype

class CudaPointwiseKernels(CudaKernelProvider):
    def __init__(self, backend):
        pass

    def _modopts(self, dtype, ndims, nvars):
        return dict(dtype=npdtype_to_ctype(dtype), ndims=ndims, nvars=nvars)

    def tdisf_inv(self, ndims, nvars, u, smats, f, gamma):
        nupts, neles = u.nrow, u.ncol / nvars

        fn = self._get_function('pointwise', 'tdisf_inv', [np.int32]*2 +
                                [np.intp]*3 + [u.dtype] + [np.int32]*3,
                                self._modopts(u.dtype, ndims, nvars))

        block = (256, 1, 1)
        grid = self._get_grid_for_block(block, neles)

        class TdisInvKernel(CudaComputeKernel):
            def run(self, scomp, scopy):
                fn.prepared_async_call(grid, block, scomp, nupts, neles,
                                       u.data, smats.data, f.data, gamma,
                                       u.leaddim, smats.leaddim, f.leaddim)

        return TdisInvKernel()

    def rsolve_rus_inv_int(self, ndims, nvars, ul_v, pnl_v, ur_v, pnr_v, gamma):
        ninters = ul_v.ncol
        dtype = ul_v.refdtype

        fn = self._get_function('pointwise', 'rsolve_rus_inv_int',
                                [np.int32] + [np.intp]*8 + [dtype],
                                self._modopts(dtype, ndims, nvars))

        block = (256, 1, 1)
        grid = self._get_grid_for_block(block, ninters)

        class RsolveRusInvIntKernel(CudaComputeKernel):
            def run(self, scomp, scopy):
                fn.prepared_async_call(grid, block, scomp, ninters,
                                       ul_v.mapping.data, ul_v.strides.data,
                                       ur_v.mapping.data, ur_v.strides.data,
                                       pnl_v.mapping.data, pnl_v.strides.data,
                                       pnr_v.mapping.data, pnr_v.strides.data,
                                       gamma)

        return RsolveRusInvIntKernel()

    def rsolve_rus_inv_mpi(self, ndims, nvars, ul_mpiv, ur_mpim, pnl_v, gamma):
        ninters = ul_mpiv.ncol
        ul_v = ul_mpiv.view
        dtype = ul_v.refdtype

        fn = self._get_function('pointwise', 'rsolve_rus_inv_mpi',
                                [np.int32] + [np.intp]*5 + [dtype],
                                self._modopts(dtype, ndims, nvars))

        block = (256, 1, 1)
        grid = self._get_grid_for_block(block, ninters)

        class RsolveRusInvMPIKernel(CudaComputeKernel):
            def run(self, scomp, scopy):
                fn.prepared_async_call(grid, block, scomp, ninters,
                                       ul_v.mapping.data, ul_v.strides.data,
                                       ur_mpim.data,
                                       pnl_v.mapping.data, pnl_v.strides.data,
{'fraction_non_alphanumeric': 0.09902439024390244, 'fraction_numerical': 0.00943089430894309, 'mean_word_length': 1.6387816387816387, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7636317', 'n_tokens_mistral': 2062, 'n_tokens_neox': 1982, 'n_words': 372}