Ejemplo n.º 1
0
TEST(testkernelstore, cl_deletes) {
    // checks the new deleteWithCl parameter
    if(!EasyCL::isOpenCLAvailable()) {
        cout << "opencl library not found" << endl;
        exit(-1);
    }
    cout << "found opencl library" << endl;

    EasyCL *cl = EasyCL::createForFirstGpuOtherwiseCpu();
    CLKernel *kernela = cl->buildKernelFromString(getKernel(), "test", "");
    CLKernel *kernelb = cl->buildKernelFromString(getKernel(), "test", "");
    CLKernel *kernelc = cl->buildKernelFromString(getKernel(), "test", "");
    CLKernel *kerneld = cl->buildKernelFromString(getKernel(), "test", "");
    cl->storeKernel("kernela", kernela);
    cl->storeKernel("kernelb", kernelb, true);
    cl->storeKernel("kernelc", kernelc, false);
    cl->storeKernel("kerneld", kerneld, true);

    delete kernela;
    delete kernelc;

    delete cl;
}
Ejemplo n.º 2
0
TEST(testkernelstore, main) {
    if(!EasyCL::isOpenCLAvailable()) {
        cout << "opencl library not found" << endl;
        exit(-1);
    }
    cout << "found opencl library" << endl;

    EasyCL *cl = EasyCL::createForFirstGpuOtherwiseCpu();
    CLKernel *kernel = cl->buildKernelFromString(getKernel(), "test", "");
    EXPECT_FALSE(cl->kernelExists("kernela"));
    EXPECT_FALSE(cl->kernelExists("kernelb"));

    cl->storeKernel("kernela", kernel);
    EXPECT_TRUE(cl->kernelExists("kernela"));
    EXPECT_FALSE(cl->kernelExists("kernelb"));

    EXPECT_EQ(kernel, cl->getKernel("kernela"));

    delete kernel;
    delete cl;
}