zoukankan      html  css  js  c++  java
  • getnumdevices.c && setgetdevicetype例程

    getnumdevices.c代码

     1 /* 文件名: getnumdevices.c
     2 * 功能 : 测试函数acc_get_num_devices(.)
     3 */
     4 #include<stdio.h>
     5 #include "openacc.h"
     6 int main()
     7 {
     8 int num = -8888;
     9 num = acc_get_num_devices(acc_device_none);
    10 printf("device_non = %d
    ", num);
    11 num = acc_get_num_devices(acc_device_default);
    12 printf("device_deault = %d
    ", num);
    13 num = acc_get_num_devices(acc_device_host);
    14 printf("device_host = %d
    ", num);
    15 num = acc_get_num_devices(acc_device_not_host);
    16 printf("device_not_host = %d
    ", num);
    17 num = acc_get_num_devices(acc_device_nvidia);
    18 printf("device_nvidia = %d
    ", num);
    19 return 0;
    20 }

    setgetdevicetype.c代码

     1 /* 文件名: setgetdevicetype.c
     2 * 功能 : 测试两个函数acc_set_device_type(.)和acc_get_device_type(.).
     3 */
     4 #include<stdio.h>
     5 #include"openacc.h"
     6 int main()
     7 {
     8 acc_device_t devt = acc_device_none;
     9 devt = acc_get_device_type();
    10 printf(" no device set, type = %d
    ", devt);
    11 acc_set_device_type(acc_device_default);
    12 devt = acc_get_device_type();
    13 printf(" device_default set, type = %d
    ", devt);
    14 acc_set_device_type(acc_device_nvidia);
    15 devt = acc_get_device_type();
    16 printf(" device_nvidia set, type = %d
    ", devt);
    17 acc_set_device_type(acc_device_host);
    18 devt = acc_get_device_type();
    19 printf(" device_host set, type = %d
    ", devt);
    20 acc_set_device_type(acc_device_not_host);
    21 devt = acc_get_device_type();
    22 printf("device_not_host set, type = %d
    ", devt);
    23 acc_set_device_type(acc_device_xeonphi);
    24 devt = acc_get_device_type();
    25 printf(" device_xeonphi set, type = %d
    ", devt);
    26 return 0;
    27 }

    编译信息:

  • 相关阅读:
    用shell脚本监控进程是否存在 不存在则启动的实例
    vue+element-ui+ajax实现一个表格的实例
    c的指针和php中的引用的区别
    mysql or条件查询优化
    Linq查询操作之投影操作
    Linq查询操作之Where筛选
    Linq专题之查询操作
    linq之join子句
    linq之let子句
    linq之into子句
  • 原文地址:https://www.cnblogs.com/liangliangdetianxia/p/4359931.html
Copyright © 2011-2022 走看看