Last active
December 17, 2015 14:09
-
-
Save KarlHerler/5622381 to your computer and use it in GitHub Desktop.
The double real matrix test for MUMPS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C | |
C This file is part of MUMPS 4.10.0, built on Tue May 10 12:56:32 UTC 2011 | |
C | |
PROGRAM MUMPS_TEST | |
IMPLICIT NONE | |
INCLUDE 'mpif.h' | |
INCLUDE 'dmumps_struc.h' | |
TYPE (DMUMPS_STRUC) mumps_par | |
INTEGER IERR, I | |
CALL MPI_INIT(IERR) | |
C Define a communicator for the package. | |
mumps_par%COMM = MPI_COMM_WORLD | |
C Initialize an instance of the package | |
C for L U factorization (sym = 0, with working host) | |
mumps_par%JOB = -1 | |
mumps_par%SYM = 0 | |
mumps_par%PAR = 1 | |
CALL DMUMPS(mumps_par) | |
C Define problem on the host (processor 0) | |
IF ( mumps_par%MYID .eq. 0 ) THEN | |
READ(5,*) mumps_par%N | |
READ(5,*) mumps_par%NZ | |
ALLOCATE( mumps_par%IRN ( mumps_par%NZ ) ) | |
ALLOCATE( mumps_par%JCN ( mumps_par%NZ ) ) | |
ALLOCATE( mumps_par%A( mumps_par%NZ ) ) | |
ALLOCATE( mumps_par%RHS ( mumps_par%N ) ) | |
DO I = 1, mumps_par%NZ | |
READ(5,*) mumps_par%IRN(I),mumps_par%JCN(I),mumps_par%A(I) | |
END DO | |
DO I = 1, mumps_par%N | |
READ(5,*) mumps_par%RHS(I) | |
END DO | |
END IF | |
C Call package for solution | |
mumps_par%JOB = 6 | |
CALL DMUMPS(mumps_par) | |
C Solution has been assembled on the host | |
IF ( mumps_par%MYID .eq. 0 ) THEN | |
WRITE( 6, * ) ' Solution is ',(mumps_par%RHS(I),I=1,mumps_par%N) | |
END IF | |
C Deallocate user data | |
IF ( mumps_par%MYID .eq. 0 )THEN | |
DEALLOCATE( mumps_par%IRN ) | |
DEALLOCATE( mumps_par%JCN ) | |
DEALLOCATE( mumps_par%A ) | |
DEALLOCATE( mumps_par%RHS ) | |
END IF | |
C Destroy the instance (deallocate internal data structures) | |
mumps_par%JOB = -2 | |
CALL DMUMPS(mumps_par) | |
CALL MPI_FINALIZE(IERR) | |
STOP | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 :N | |
12 :NZ | |
1 2 3.0 | |
2 3 -3.0 | |
4 3 2.0 | |
5 5 1.0 | |
2 1 3.0 | |
1 1 2.0 | |
5 2 4.0 | |
3 4 2.0 | |
2 5 6.0 | |
3 2 -1.0 | |
1 3 4.0 | |
3 3 1.0 :values | |
20.0 | |
24.0 | |
9.0 | |
6.0 | |
13.0 :RHS | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment