Fortran Coder

标题: openMP offload [打印本页]

作者: Neo123    时间: 2022-6-25 14:50
标题: openMP offload
如何采用visual studio + oneAPI实现程序的GPU并行?我采用如下程序测试发现omp_get_num_devices()=0,也就是无法识别GPU,编译报错为未加载openCL.pdb。已经根据显卡驱动版本安装了CUDA 软件
[Fortran] 纯文本查看 复制代码
    program test
    use omp_lib
    implicit none

    !integer:: host, default_device,x
    !!omp_set_default_device(1)
    !host = omp_get_initial_device()
    !x = omp_get_num_devices()
    !
    !write(*,*) host
    !write(*,*) default_device
    !write(*,*) x

    real(8) :: a(1024), b(1024), c(1024)
    integer:: i

    !$omp target device(0)
   
    !$omp teams distribute parallel do simd
    do i=1,1024
        c(i)=c(i)+a(i)*b(i)
    end do
    !$omp end target
    end program






欢迎光临 Fortran Coder (http://bbs.fcode.cn/) Powered by Discuz! X3.2