/[escript]/trunk/paso/src/SystemMatrix_MatrixVector.c
ViewVC logotype

Annotation of /trunk/paso/src/SystemMatrix_MatrixVector.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1556 - (hide annotations)
Mon May 12 00:54:58 2008 UTC (11 years, 9 months ago) by gross
File MIME type: text/plain
File size: 3202 byte(s)
Modification to allow mixed mode execution. 
In order to keep the code portable accross platform all MPI calls within
parallel regions have been moved. 


1 ksteube 1312
2 jgs 150 /* $Id$ */
3    
4 ksteube 1312 /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15 dhawcroft 631
16 jgs 150 /**************************************************************/
17    
18     /* Paso: matrix vector product with sparse matrix */
19    
20     /**************************************************************/
21    
22     /* Copyrights by ACcESS Australia 2003,2004,2005 */
23     /* Author: gross@access.edu.au */
24    
25     /**************************************************************/
26    
27     #include "Paso.h"
28     #include "SystemMatrix.h"
29    
30     /**************************************************************************/
31    
32     /* raw scaled vector update operation: out = alpha * A * in + beta * out */
33    
34    
35     void Paso_SystemMatrix_MatrixVector(double alpha,
36 ksteube 1312 Paso_SystemMatrix* A,
37     double* in,
38     double beta,
39     double* out) {
40 jgs 150
41 ksteube 1312 double *snd_buffer=NULL, *rcv_buffer=NULL;
42     dim_t N;
43     Paso_MPIInfo *mpi_info=A->mpi_info;
44    
45 gross 415 if (A->type & MATRIX_FORMAT_CSC) {
46 ksteube 1312 if ( mpi_info->size>1) {
47     Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSC is not supported by MPI.");
48     return;
49 gross 415 } else {
50 ksteube 1312 if (A->type & MATRIX_FORMAT_OFFSET1) {
51     Paso_SparseMatrix_MatrixVector_CSC_OFFSET1(alpha,A->mainBlock,in,beta,out);
52     } else {
53     Paso_SparseMatrix_MatrixVector_CSC_OFFSET0(alpha,A->mainBlock,in,beta,out);
54     }
55 gross 415 }
56 ksteube 1312 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
57     Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: TRILINOS is not supported with MPI.");
58     return;
59 gross 415 } else {
60     if (A->type & MATRIX_FORMAT_OFFSET1) {
61 ksteube 1312 if ( mpi_info->size>1) {
62     Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSR with index 1 is not supported by MPI.");
63     return;
64     } else {
65     Paso_SparseMatrix_MatrixVector_CSR_OFFSET1(alpha,A->mainBlock,in,beta,out);
66     }
67 gross 415 } else {
68 ksteube 1312 if (Paso_noError()) {
69     Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(alpha,A,in,beta,out);
70     }
71 gross 415 }
72     }
73     }
74    
75     void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha,
76 ksteube 1312 Paso_SystemMatrix* A,
77     double* in,
78     double beta,
79     double* out)
80     {
81     double *remote_values=NULL;
82     /* start exchange */
83     Paso_SystemMatrix_startCollect(A,in);
84     /* process main block */
85     Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->mainBlock,in,beta,out);
86     /* finish exchange */
87     remote_values=Paso_SystemMatrix_finishCollect(A);
88     /* process couple block */
89 gross 1552 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->col_coupleBlock,remote_values,1.,out);
90 gross 415 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26