Commit e3c5f3c1 authored by Kazutomo Yoshii's avatar Kazutomo Yoshii
Browse files

use dev_selected, instead of all devs

parent 95533fec
......@@ -51,6 +51,7 @@ public:
private:
std::vector<cl::Platform> pfs; // initialized only in c'tor
std::vector<cl::Device> devs; // initialized only in c'tor
std::vector<cl::Device> dev_selected; // initialized only in c'tor
std::vector<cl::Program> prgs; // clear and push_back in prepKernel()
cl::Context ctx;
// selected ids
......@@ -128,25 +129,18 @@ private:
return false;
cl::Program::Binaries bin;
for (int i = 0; i < (int)devs.size(); i++) {
bin.push_back({getkernelbuf(),getkernelbufsize()});
}
bin.push_back({getkernelbuf(),getkernelbufsize()});
std::vector<int> binaryStatus;
cl_int err = CL_SUCCESS;
//std::cout << "devs size=" << devs.size() << std::endl;
//std::cout << "bin size=" << bin.size() << std::endl;
cl::Program p(ctx, devs, bin, &binaryStatus, &err);
cl::Program p(ctx, dev_selected, bin, &binaryStatus, &err);
// std::cout << "err=" << err << std::endl;
std::vector<cl::Device> devstmp;
if (err != CL_SUCCESS) {
std::cout << "fn=" << fn << std::endl;
std::cout << "Program failed to build: " << err << std::endl;
std::cout << p.getBuildInfo<CL_PROGRAM_BUILD_LOG>(devs[device_id]);
std::cout << p.getBuildInfo<CL_PROGRAM_BUILD_LOG>(dev_selected[0]);
return false;
}
prgs.push_back(p);
......@@ -171,11 +165,11 @@ private:
std::cout << "Program failed" << err << std::endl;
return false;
}
err = p.build(devs);
// err = p.build(devs, "-cl-intel-gtpin-rera");
err = p.build(dev_selected);
// err = p.build(dev_selected, "-cl-intel-gtpin-rera");
if (err != CL_SUCCESS) {
std::cout << "Program failed to build: " << err << std::endl;
std::cout << p.getBuildInfo<CL_PROGRAM_BUILD_LOG>(devs[device_id]);
std::cout << p.getBuildInfo<CL_PROGRAM_BUILD_LOG>(dev_selected[0]);
return false;
}
prgs.push_back(p);
......@@ -274,8 +268,10 @@ public:
}
ctx = devs;
device_id = did;
dev_selected.push_back(devs[device_id]);
program_id = 0; //
}
......@@ -365,7 +361,7 @@ public:
// create a command queue and kernel
queue = cl::CommandQueue(ctx, devs[device_id], CL_QUEUE_PROFILING_ENABLE, &err);
queue = cl::CommandQueue(ctx, dev_selected[0], CL_QUEUE_PROFILING_ENABLE, &err);
kernel = cl::Kernel(prgs[program_id], funcname, &err);
if (err != CL_SUCCESS) {
switch(err) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment