<commit_before>import numpy as np
from ctypes import cdll
import scipy.sparse as spp

from indigo.backends.cuda import CudaBackend
from indigo.backends import _customgpu

class CustomGpuBackend(CudaBackend):

    def ccsrmm(self, Y, A_shape, A_indx, A_ptr, A_vals, X, alpha, beta, adjoint=False, exwrite=False):
        if adjoint and exwrite:
            (M, K), N = A_shape, X.shape[1]
            ldx = X._leading_dims[0]
            ldy = Y._leading_dims[0]
            _customgpu.exw_csrmm(M, N, K, alpha, A_vals._arr.value, A_indx._arr.value, A_ptr._arr.value,
                X._arr.value, ldx, beta, Y._arr.value, ldy)
        else:
            super(CustomGpuBackend, self).ccsrmm(
                Y, A_shape, A_indx, A_ptr, A_vals, X, alpha, beta, adjoint, exwrite=exwrite
            )

    def cdiamm(self, y, shape, offsets, data, x, alpha=1.0, beta=0.0, adjoint=True):
        ldx = x._leading_dims[0]
        ldy = y._leading_dims[0]
        (K, N), M = x.shape, y.shape[0]
        noffsets = offsets.size
        _customgpu.diamm(M, N, K, noffsets, offsets._arr.value, data._arr.value,
            alpha, x._arr.value, ldx, beta, y._arr.value, ldy, adjoint)

    def onemm(self, y, x, alpha, beta):
        ldx = x._leading_dims[0]
        ldy = y._leading_dims[0]
        (K, N), M = x.shape, y.shape[0]
        _customgpu.onemm(M, N, K,
            alpha, x._arr.value, ldx,
            beta,  y._arr.value, ldy)

    def max(self, val, arr):
        _customgpu.max(arr.size*3, val, arr._arr.value)
<commit_msg>bugfix: wrong count in _customgpu.max<commit_after>import numpy as np
from ctypes import cdll
import scipy.sparse as spp

from indigo.backends.cuda import CudaBackend
from indigo.backends import _customgpu

class CustomGpuBackend(CudaBackend):

    def ccsrmm(self, Y, A_shape, A_indx, A_ptr, A_vals, X, alpha, beta, adjoint=False, exwrite=False):
        if adjoint and exwrite:
            (M, K), N = A_shape, X.shape[1]
            ldx = X._leading_dims[0]
            ldy = Y._leading_dims[0]
            _customgpu.exw_csrmm(M, N, K, alpha, A_vals._arr.value, A_indx._arr.value, A_ptr._arr.value,
                X._arr.value, ldx, beta, Y._arr.value, ldy)
        else:
            super(CustomGpuBackend, self).ccsrmm(
                Y, A_shape, A_indx, A_ptr, A_vals, X, alpha, beta, adjoint, exwrite=exwrite
            )

    def cdiamm(self, y, shape, offsets, data, x, alpha=1.0, beta=0.0, adjoint=True):
        ldx = x._leading_dims[0]
        ldy = y._leading_dims[0]
        (K, N), M = x.shape, y.shape[0]
        noffsets = offsets.size
        _customgpu.diamm(M, N, K, noffsets, offsets._arr.value, data._arr.value,
            alpha, x._arr.value, ldx, beta, y._arr.value, ldy, adjoint)

    def onemm(self, y, x, alpha, beta):
        ldx = x._leading_dims[0]
        ldy = y._leading_dims[0]
        (K, N), M = x.shape, y.shape[0]
        _customgpu.onemm(M, N, K,
            alpha, x._arr.value, ldx,
            beta,  y._arr.value, ldy)

    def max(self, val, arr):
        _customgpu.max(arr.size*2, val, arr._arr.value)

{'fraction_non_alphanumeric': 0.12848799480856588, 'fraction_numerical': 0.009085009733939001, 'mean_word_length': 2.3657205240174672, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1435761', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1178, 'n_words': 278}