<commit_before>import os
import math
import numpy
import pyopencl as cl
import pyopencl.array
import time
from PIL import Image

WORK_GROUP_SIZE = 64
PIXEL_PER_WORK_ITEM = 256

if __name__ == '__main__':

    print('load program from cl source file')
    f = open('histogram.cl', 'r', encoding='utf-8')
    kernels = ''.join(f.readlines())
    f.close()

    print('prepare data ... ')
    filename = 'smallone.jpeg'
    img = Image.open(os.path.join(os.path.dirname(__file__), filename))
    img_width = img.size[0]
    img_height = img.size[1]
    img_size = img_width * img_height

    start_time = time.time()
    Pixel = numpy.dtype([('red', 'u1'), ('green', 'u1'), ('blue', 'u1')])
    # prepare host memory for OpenCL
    input_data = numpy.array(img.getdata(), dtype=Pixel)
    output_data = numpy.zeros(256 * 3, dtype=numpy.uint32)
    time_hostdata_loaded = time.time()

    print('create context ...')
    ctx = cl.create_some_context()
    print('create command queue ...')
    queue = cl.CommandQueue(ctx, properties=cl.command_queue_properties.PROFILING_ENABLE)<commit_msg>revert to correct image filename<commit_after>import os
import math
import numpy
import pyopencl as cl
import pyopencl.array
import time
from PIL import Image

WORK_GROUP_SIZE = 64
PIXEL_PER_WORK_ITEM = 256

if __name__ == '__main__':

    print('load program from cl source file')
    f = open('histogram.cl', 'r', encoding='utf-8')
    kernels = ''.join(f.readlines())
    f.close()

    print('prepare data ... ')
    filename = '7680x4320.jpg'
    img = Image.open(os.path.join(os.path.dirname(__file__), filename))
    img_width = img.size[0]
    img_height = img.size[1]
    img_size = img_width * img_height

    start_time = time.time()
    Pixel = numpy.dtype([('red', 'u1'), ('green', 'u1'), ('blue', 'u1')])
    # prepare host memory for OpenCL
    input_data = numpy.array(img.getdata(), dtype=Pixel)
    output_data = numpy.zeros(256 * 3, dtype=numpy.uint32)
    time_hostdata_loaded = time.time()

    print('create context ...')
    ctx = cl.create_some_context()
    print('create command queue ...')
    queue = cl.CommandQueue(ctx, properties=cl.command_queue_properties.PROFILING_ENABLE)
{'fraction_non_alphanumeric': 0.14227086183310533, 'fraction_numerical': 0.019151846785225718, 'mean_word_length': 3.759219088937093, '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': '866150', 'n_tokens_mistral': 770, 'n_tokens_neox': 737, 'n_words': 173}