Openacc error ibgomp: 同时加载 libgomp-plugin-host_nonshm.so.1:



我想编译一个简单的openacc示例(它已附加),它被正确编译,但是当我运行时出现错误:

  1. 编译方式: gcc-5 -fopenacc accVetAdd.c -lm
  2. 运行方式为 : ./a.out
  3. 运行时出错
错误:libgomp

加载libgomp-plugin-host_nonshm.so.1时:libgomp-plugin-host_nonshm.so.1:无法打开共享对象文件:没有这样的文件或目录

我谷歌一下,只找到一页! 然后我问如何解决这个问题?

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, char* argv[])
{
    // Size of vectors
    int n = 10000;
    // Input vectors
    double *restrict a;
    double *restrict b;
    // Output vector
    double *restrict c;
    // Size, in bytes, of each vector
    size_t bytes = n*sizeof(double);
    // Allocate memory for each vector
    a = (double*)malloc(bytes);
    b = (double*)malloc(bytes);
    c = (double*)malloc(bytes);
    // Initialize content of input vectors, vector a[i] = sin(i)^2 vector b[i] = cos(i)^2
    int i;
    for (i = 0; i<n; i++) {
        a[i] = sin(i)*sin(i);
        b[i] = cos(i)*cos(i);
    }
    // sum component wise and save result into vector c
    #pragma acc kernels copyin(a[0:n],b[0:n]), copyout(c[0:n])
    for (i = 0; i<n; i++) {
        c[i] = a[i] + b[i];
    }
    // Sum up vector c and print result divided by n, this should equal 1 within error
    double sum = 0.0;
    for (i = 0; i<n; i++) {
        sum += c[i];
    }
    sum = sum / n;
    printf("final result: %fn", sum);
    // Release memory
    free(a);
    free(b);
    free(c);
    return 0;
}

>libgomp 为其支持的插件动态加载共享对象文件,例如实现host_nonshm设备的插件。 如果它们安装在非标准目录中(即,不在系统的默认搜索路径中),则需要告诉动态链接器在何处查找这些共享对象文件:使用 -Wl,-rpath,[...] 编译,或设置 LD_LIBRARY_PATH 环境变量。

相关内容

  • 没有找到相关文章

最新更新