OpenACC与GNU Scientific Library(GSL)兼容?

时间:2016-10-12 12:54:20

标签: gsl acc

我正在测试我是否可以在OpenACC计算区域内使用GSL功能。在Main.c中,我尝试使用以下(愚蠢)for循环,它使用GSL函数,

#pragma acc kernels
for(int i=0; i<100; i++){
    gsl_matrix *C = gsl_matrix_calloc(10, 10);
    gsl_matrix_free(C);
}

为10x10的零矩阵分配内存,然后释放内存100次。但是当我编译时,

pgcc -pg -fast -acc -Minfo=all,intensity -lgsl -lgslcblas -lm -o Main Main.c

我收到以下消息,

PGC-S-0155-Procedures called in a compute region must have acc routine information: gsl_matrix_calloc (Main.c: 60)
PGC-S-0155-Accelerator region ignored; see -Minfo messages  (Main.c: 57)
main:
57, Accelerator region ignored
58, Intensity = 1.00    
Loop not vectorized/parallelized: contains call
60, Accelerator restriction: call to 'gsl_matrix_calloc' with no acc routine information

特别是,关于“acc例程信息”的第一条和最后一条消息是否意味着无法在acc计算区域内使用GSL函数?

1 个答案:

答案 0 :(得分:0)

我还没有看到对GSL库的直接支持。

您需要获取正在使用的GSL例程的源代码并插入&#34;!$ acc routine&#34; pragma定义了子程序或函数。

这将指示编译器为GPU生成内核。在这些pragma插入之后,您应该使用。编译GSL库 编译期间的-acc标志。