用Lapack和LBLA库与PGI PGCC编译?

发布于 2025-02-05 15:47:55 字数 1762 浏览 3 评论 0原文

我正在尝试编译我的OpenACC并行C ++程序,该程序使用DGEMM(BLAS)和DGESVD(LAPACK)功能。

我正在尝试使用PGI PGCC编译器编译该程序,将其与这样的库链接起来(该程序称为“ VD”):

# Target rules

LIBRARIES := -lblas -llapack -lm

CC = gcc

CFLAGS = -O3

PGCC = pgcc -Minfo=accel -fast -acc -ta=multicore -tp=nehalem -DDEBUG

################################################################################

# Target rules

all: build
build: vd

VD.o: VD.cpp
    $(PGCC) -o $@ -c $< -w

vd: VD.o
    $(PGCC) $(CFLAGS) -o $@ $+ $(LIBRARIES)

clean:
    rm -f VD.o vd

但是我会收到以下错误: https://i.sstatic.net/giilr.jpg

看来该文件正在编译(我的意思是,代码没有任何错误),但是当它将其链接到拉帕克(Blas Works)时,它似乎找不到一些参考。

我的$(ld_library_path)变量包含lapack的确切路径:/opt/nvidia/hpc_sdk/linux_x86_64/21.9/compilers/compilers/lib/code>

这是我代码的第一部分:

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <time.h>
#include <string.h>

// NUEVOS INCLUDES
#include <openacc.h>
// FIN DE NUEVOS INCLUDES

#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))

#define MAXLINE 200
#define MAXCAD 200
#define FPS 5

extern int dgemm_(char *transa, char *transb, int *m, int *
        n, int *k, double *alpha, double *a, int *lda,
        double *b, int *ldb, double *beta, double *c, int
        *ldc);


extern int dgesvd_(char *jobu, char *jobvt, int *m, int *n,
    double *a, int *lda, double *s, double *u, int *
    ldu, double *vt, int *ldvt, double *work, int *lwork,
    int *info);

注意:我尝试将这些最新功能从“ extern” c“ int ...”开始,但没有编译。

我想念什么?

谢谢你!

I'm trying to compile my OpenACC parallel C++ program that makes use of dgemm (BLAS) and dgesvd (LAPACK) functions.

I'm trying to compile the program with PGI PGCC compiler, linking it with the libraries like this (the program is called "VD"):

# Target rules

LIBRARIES := -lblas -llapack -lm

CC = gcc

CFLAGS = -O3

PGCC = pgcc -Minfo=accel -fast -acc -ta=multicore -tp=nehalem -DDEBUG

################################################################################

# Target rules

all: build
build: vd

VD.o: VD.cpp
    $(PGCC) -o $@ -c 
lt; -w

vd: VD.o
    $(PGCC) $(CFLAGS) -o $@ $+ $(LIBRARIES)

clean:
    rm -f VD.o vd

But I get the following error: https://i.sstatic.net/giIlr.jpg

It looks like the file is compiling (by this I mean that there are no errors in the code), but when its going to link it to LAPACK (BLAS works) it just doesn't seem to find some references.

My $(LD_LIBRARY_PATH) variable contains the exact path of LAPACK: /opt/nvidia/hpc_sdk/Linux_x86_64/21.9/compilers/lib/

Here is the first part of my code:

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <time.h>
#include <string.h>

// NUEVOS INCLUDES
#include <openacc.h>
// FIN DE NUEVOS INCLUDES

#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))

#define MAXLINE 200
#define MAXCAD 200
#define FPS 5

extern int dgemm_(char *transa, char *transb, int *m, int *
        n, int *k, double *alpha, double *a, int *lda,
        double *b, int *ldb, double *beta, double *c, int
        *ldc);


extern int dgesvd_(char *jobu, char *jobvt, int *m, int *n,
    double *a, int *lda, double *s, double *u, int *
    ldu, double *vt, int *ldvt, double *work, int *lwork,
    int *info);

Note: I've tried to put these latest functions starting with "extern "C" int..." but it doesn't compile.

What am I missing?

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

阳光下的泡沫是彩色的 2025-02-12 15:47:55

Blas和Lapack用Fortran编写,因此您看到的错误是由于缺少链接行上的Fortran运行时库。

要修复,请在链接行上添加“ -fortranlibs”,以便添加这些库。

The BLAS and LAPACK are written in Fortran, hence the error you’re seeing is due to missing the Fortran runtime libraries on the link line.

To fix, add “-fortranlibs” on your link line so these libraries are added.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文