marina
marina

Reputation: 43

Using ScaLAPACK routine from MPI C program

I currently have an MPI program written in C and I want to use a routine from ScaLAPACK. I'm working on a parallel version of LDA, and one step is inverting a matrix. I found a routine in ScaLAPACK that solves this pdgetri.f (it's written in fortran, I'm not sure that a c routine exists), but I'm not sure how to configure it to work. I'm using Windows and an Intel Dual Core Laptop. The purpose is more didactic than for performance.

Upvotes: 3

Views: 1983

Answers (1)

talonmies
talonmies

Reputation: 72342

SCALAPACK relies on BLACS to provide abstraction to whatever message passing system is in use. If you have an existing MPI communicator established in your code, you can use blacs_gridmap to initialise a BLACS context which is mapped onto your communicator. That context can then be used to create SCALAPACK distributed arrays and those arrays then passed to SCALPACK routines which will then operate on them.

How you tackle the C-Fortran interfacing problem will depend a lot on what compiler(s) you are using. If you have a "modern" compiler which supports Fortran 2003 features, you can use the C interoperability language features to write an interface wrapper for the functions you need, and then call them directly. On UNIX/LINUX style systems, F2C style interfacing was the defacto way to call Fortran from C, although some of the details where usually compiler specific. I don't use Windows at all, so I can really help you if you can't use Fortran 2003 interoperability.

Upvotes: 1

Related Questions