File: opencl_runtime_aottest.cpp

package info (click to toggle)
halide 21.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 55,752 kB
  • sloc: cpp: 289,334; ansic: 22,751; python: 7,486; makefile: 4,299; sh: 2,508; java: 1,549; javascript: 282; pascal: 207; xml: 127; asm: 9
file content (37 lines) | stat: -rw-r--r-- 1,158 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "HalideRuntime.h"
#if defined(TEST_OPENCL)
#include "HalideRuntimeOpenCL.h"
#endif

#include <cstdio>
#include <string>

int main(int argc, char **argv) {
#if defined(TEST_OPENCL)
    std::string platform_name = "custom_platform";
    halide_opencl_set_platform_name(platform_name.c_str());
    if (platform_name != halide_opencl_get_platform_name(nullptr)) {
        printf("Value returned from halide_opencl_get_platform_name doesn't match\n");
        return 1;
    }

    std::string device_type = "custom_device";
    halide_opencl_set_device_type(device_type.c_str());
    if (device_type != halide_opencl_get_device_type(nullptr)) {
        printf("Value returned from halide_opencl_get_device_type doesn't match\n");
        return 1;
    }

    std::string build_options = "-c ustom_build_option";
    halide_opencl_set_build_options(build_options.c_str());
    if (build_options != halide_opencl_get_build_options(nullptr)) {
        printf("Value returned from halide_opencl_get_build_options doesn't match\n");
        return 1;
    }

    printf("Success!\n");
#else
    printf("[SKIP] Test requires OpenCL.\n");
#endif
    return 0;
}