Skip to Content.
Sympa Menu

charm - Re: [charm] Conjugate Gradient solver in Charm++

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

Re: [charm] Conjugate Gradient solver in Charm++


Chronological Thread 
  • From: Orion Lawlor <lawlor AT alaska.edu>
  • To: Tom Quinn <trq AT astro.washington.edu>
  • Cc: charm AT cs.uiuc.edu
  • Subject: Re: [charm] Conjugate Gradient solver in Charm++
  • Date: Mon, 2 Aug 2010 19:55:23 -0800
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/charm>
  • List-id: CHARM parallel programming system <charm.cs.uiuc.edu>

Tom, as requested, here's a tiny example of how to call ILSI to solve a simple 1D heat equation problem.  The underlying communication is done using (A)MPI, because ILSI assumes a blocking interface, and because everybody understands MPI.

On Thu, Jul 8, 2010 at 12:54 AM, Orion Lawlor <lawlor AT alaska.edu> wrote:
Tom, the "charm/src/libs/ck-libs/ifem" library definitely supports non-finite-element conjugate gradient (sparse) matrix solutions. 

Generally, we assume you're trying to solve
   A x = b
for the unknown vector x. 
The x and b vectors are distributed across processors using your own "ILSI_Comm" object;
the same object applies the A matrix (however you want to do that).

#include "ilsi.h" /* C++ interface */
#include "ilsic.h" /* C interface */

class myILSI_Comm : public ILSI_Comm {
public:
        /// Compute dest = A src, where A is the square matrix.
        ///  This product must take into account values from other
        ///  chunks, as well as this one.  This is a collective call.
        ///  It is not valid for src to equal dest.
        virtual void matrixVectorProduct(const double *src,double *dest)  { ... apply matrix to src, to get dest ... }
       
        /// Do a global dot product of these two vectors. 
        /// This dot product must take into account values from other
        /// processors.  It is valid for a to equal b.
        /// All chunks are guaranteed to get the same return value.
        virtual double dotProduct(const double *a,const double *b) { ... dot a and b, and sum results across entire problem ... }
};

... somewhere in a threaded entry method ...
std::vector<double> x(size); /* unknown vector */
std::vector<double> b(size); /* known vector; right hand side */
myILSI_Comm(b.size());
ILSI_Param result;
ILSI_Param_new(&result);
ILSI_CG_Solver(&result,&comm,b.size(),&x[0],&b[0]);
... use x happily! ...

That's the theory, anyway, from what I can reconstruct from my 2003 code comments. 
Let me know if it works!
--
Dr. Orion Sky Lawlor   lawlor AT alaska.edu
http://www.cs.uaf.edu/~olawlor/



--
Dr. Orion Sky Lawlor   lawlor AT alaska.edu
http://www.cs.uaf.edu/~olawlor/

Attachment: ilsi_test_v1.tgz
Description: GNU Zip compressed data



  • Re: [charm] Conjugate Gradient solver in Charm++, Orion Lawlor, 08/02/2010

Archive powered by MHonArc 2.6.16.

Top of Page