C++ does not run the Kernel program

Good afternoon! I need to run a program written in C++ that uses OpenCL. Before that I enabled OpenCL headers, installed CUDA (this is optional) and reinstalled Visual Studio and MinGW. I have an NVIDIA GeFOrce 1080.

Well, I have an array<int, 3> loc and as a result of the execution loc should change to 15, 15, 15 according to kernelFile2.cl(found is loc, check main code):

kernel void kernelFile(global int *faces, global int *facecount, global int *found, global int *xlength, global int *zlength, global int *ymin)
{

            found[0] = 15;
            found[1] = 15;
            found[2] = 15;
}

I’m sorry, but I don’t understand much about OpenCL, so I’ll show you the whole program.

file.cpp:

#define CL_USE_DEPRECATED_OPENCL_1_2_APIS

#include <iostream>
#include <fstream>
#include <CL/cl.hpp>
#include <array>


int main()
{
    std::vector<cl::Platform> platforms;
    cl::Platform::get(&platforms);

    _ASSERT(platforms.size() > 0);

    auto platform = platforms.front();
    std::vector<cl::Device> devices;

    platform.getDevices(CL_DEVICE_TYPE_GPU, &devices);

    _ASSERT(devices.size() > 0);

    auto device = devices.front();

    std::cout << "Device: " << device.getInfo<CL_DEVICE_NAME>() << std::endl;

    std::string fileName;

    std::ifstream kernelFile("kernelFile2.cl");
    std::string src(std::istreambuf_iterator<char>(kernelFile), (std::istreambuf_iterator<char>()));

    cl::Program::Sources sources(1, std::make_pair(src.c_str(), src.length() + 1));


    
    cl::Context context(device);
    cl::Program program(context, sources);

    auto err = program.build("-cl-std=CL1.2");

    std::cout << std::to_string(err) << " error" <<std::endl;//print error code

    int facecount = 1;
    const int arraysize = 5;//5 times facecount
    std::array<int, arraysize> formation = {{0, 0, 0, 1, 3,}};
    
    std::array<int, 3> loc =  {0, 0, 0} ;
    int xlength = 10000;
    int zlength = 10000;
    int yrangesize = 1;
    int ymin = 59;

    cl::Buffer facesbuf(context, CL_MEM_READ_WRITE | CL_MEM_HOST_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(int) * arraysize, formation.data());
    cl::Buffer facecountbuf(context, CL_MEM_READ_WRITE | CL_MEM_HOST_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(int), &facecount);
    cl::Buffer resultbuf(context, CL_MEM_READ_WRITE | CL_MEM_HOST_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(int) * 3, loc.data());
    cl::Buffer xlengthbuf(context, CL_MEM_READ_WRITE | CL_MEM_HOST_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(int), &xlength);
    cl::Buffer zlengthbuf(context, CL_MEM_READ_WRITE | CL_MEM_HOST_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(int), &zlength);
    cl::Buffer yminbuf(context, CL_MEM_READ_WRITE | CL_MEM_HOST_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(int), &ymin);


    cl::Kernel kernel(program, "kernelFile");
    kernel.setArg(0, facesbuf);
    kernel.setArg(1, facecountbuf);
    kernel.setArg(2, resultbuf);
    kernel.setArg(3, xlengthbuf);
    kernel.setArg(4, zlengthbuf);
    kernel.setArg(5, yminbuf);

    cl::CommandQueue queue(context, device);
    std::cout << std::to_string(queue.enqueueNDRangeKernel(kernel, cl::NDRange(NULL), cl::NDRange(xlength, yrangesize, zlength))) << std::endl;

    queue.enqueueReadBuffer(resultbuf, CL_TRUE, 0, sizeof(int) * 3, loc.data());
    
    queue.finish();

    std::cout << "X: " << loc[0] << " Y: " << loc[1] << " Z: " << loc[2];


}

But, unfortunately, this program does not change the variables.

It looked different in the beginning, but I changed it and left only what would help understand the problem.

Thank you so much if someone helps!