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 }

    编译信息:

  • 相关阅读:
    葡萄城报表介绍:数据报表的七个原则
    while(scanf("%d",&n)!=EOF)
    不容易系列之(3)—— LELE的RPG难题
    错排公式
    _​_​i​n​t​6​4​ ​与​l​o​n​g​ ​l​o​n​g​ ​i​n​t
    杭电ACM 2046 阿牛的EOF牛肉串
    C++Builder 中使用 __int64 整数的问题
    折线分平面——杭电2050
    复合梯形公式与复合辛普森公式求积分
    两套蓝桥杯热身题
  • 原文地址:https://www.cnblogs.com/liangliangdetianxia/p/4359931.html
Copyright © 2011-2022 走看看