Вопрос

Hi can any one provide me an example Makefile for calling ScaLAPACK from C++, I am having difficulties.

I have the newest version compiled correctly with all the tests passed. I have it compiled with GCC and OpenMPI on Fedora, and I have also tried using the pre-built binaries from the repository with no luck.

Это было полезно?

Решение

I used the following declarations for ScaLAPACK procedures:

extern "C" void pdgesvd_(char *jobu, char *jobvt, int *M, int *N, double *A, int *ia, int *ja, int *desca, double *s, double *u, int *iu, int *ju,
            int *descu, double *vt, int *ivt, int *jvt, int *descvt, double *work, int *lwork, int *info);

extern "C" void pdgemv_(char *t, int *M, int *N, double *alpha, double *A, int *ia, int *ja, int *desca, double *X, int *ix, int *jx,int *descx,
            int *incx, double *beta, double *Y, int *iy, int *jy, int *descy, int *incy);


extern "C" void pdgemm_(char *transa, char *transb, int *M, int *N, int *K, double *alpha, double *A, int *ia, int *ja, int *desca, double *B,
            int *ib, int *jb, int *descb, double *beta, double *C, int *ic, int *jc, int *descc);

BLACS procedures are declared in the same way:

extern "C" void blacs_get_(/*in*/int *icontxt, /*in*/int *what, /*out*/int *val); 

I append the "_" character to procedure names, because BLAS and ScaLAPACK were built with -DAdd_ compiler option. This may be different for your system. If so, try objdump -t on libscalapack.a and other static library files to determine actual procedure names.

Your program with ScaLAPACK calls may be compiled with something like this:

mpicxx -o your_binary_name -O2 your_source.cpp -lscalapack -lblacs -lcblacs -lblacs -llapack -lblas -lgfortran

Note that the order of static libraries in g++ invocation line (-lblacs -lcblacs -lblacs -llapack -lblas -lgfortran) is important! Also check the existance of all these static library files (libblas.a, libcblacs.a and so on) in the library directories. Don't forget about Fortran package (for -lgfortran).

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top