Commit d23771a8 authored by Rémy Mozul's avatar Rémy Mozul
Browse files

[SPARSE] attempt to use petsc

parent c1c82a0a
......@@ -6,36 +6,53 @@ project(Systems Fortran)
find_package(LAPACK REQUIRED)
# looking for mumps
message(STATUS "looking for mumps in ${MP}")
find_library(MUMPS_FOUND dmumps HINTS ${MP} PATH_SUFFIXES lib NO_DEFAULT_PATH REQUIRED)
find_library(MUMPS_COMMON_FOUND mumps_common HINTS ${MP} PATH_SUFFIXES lib NO_DEFAULT_PATH REQUIRED)
find_library(PORD_FOUND pord HINTS ${MP} PATH_SUFFIXES lib NO_DEFAULT_PATH REQUIRED)
find_library(MPISEQ_FOUND mpiseq HINTS ${MP} PATH_SUFFIXES lib libseq REQUIRED)
find_path(MUMPS_INCLUDE_DIRS dmumps_struc.h NO_DEFAULT_PATH HINTS ${MP} ${MD} PATH_SUFFIXES include)
set(MUMPS_LIBRARIES ${MUMPS_FOUND} ${MUMPS_COMMON_FOUND} ${PORD_FOUND} ${MPISEQ_FOUND})
if( MP )
message(STATUS "looking for mumps in ${MP}")
find_library(MUMPS_FOUND dmumps HINTS ${MP} PATH_SUFFIXES lib NO_DEFAULT_PATH REQUIRED)
find_library(MUMPS_COMMON_FOUND mumps_common HINTS ${MP} PATH_SUFFIXES lib NO_DEFAULT_PATH REQUIRED)
find_library(PORD_FOUND pord HINTS ${MP} PATH_SUFFIXES lib NO_DEFAULT_PATH REQUIRED)
find_library(MPISEQ_FOUND mpiseq HINTS ${MP} PATH_SUFFIXES lib libseq REQUIRED)
find_path(MUMPS_INCLUDE_DIR dmumps_struc.h NO_DEFAULT_PATH HINTS ${MP} ${MD} PATH_SUFFIXES include)
set(MUMPS_LIBRARIES ${MUMPS_FOUND} ${MUMPS_COMMON_FOUND} ${PORD_FOUND} ${MPISEQ_FOUND})
message(STATUS "MUMPs LIBRARIES: ${MUMPS_LIBRARIES}")
message(STATUS "MUMPs INCLUDE : ${MUMPS_INCLUDE_DIR}")
endif( MP )
# looking for petsc
if( PP )
message(STATUS "looking for petsc in ${PP}")
find_library(PETSC_FOUND petsc HINTS ${PP} PATH_SUFFIXES lib NO_DEFAULT_PATH REQUIRED)
find_path(PETSC_C_INCLUDE_DIR petsc.h NO_DEFAULT_PATH HINTS ${PP} PATH_SUFFIXES include)
find_path(PETSC_F_INCLUDE_DIR finclude/petsc.h90 NO_DEFAULT_PATH HINTS ${PP} PATH_SUFFIXES include/petsc)
set(PETSC_LIBRARIES ${PETSC_FOUND})
message(STATUS "PETSc LIBRARIES: ${PETSC_LIBRARIES}")
message(STATUS "PETSc INCLUDE : ${PETSC_C_INCLUDE_DIR} ${PETSC_F_INCLUDE_DIR}")
endif( PP )
# mumps example
if( ${MP} )
include_directories(${MUMPS_INCLUDE_DIRS})
if( MUMPS_FOUND )
include_directories(${MUMPS_INCLUDE_DIR})
add_library( mumpsAlgebra dataStructure.f90 mumps_binding.f90)
target_link_libraries( mumpsAlgebra ${MUMPS_LIBRARIES} ${LAPACK_LIBRARIES})
add_executable( mumpsTest reference_test.f90 )
target_link_libraries( mumpsTest mumpsAlgebra )
endif( ${MP} )
endif( MUMPS_FOUND )
# petsc example
if( ${PP} )
include_directories(${PETSC_INCLUDE_DIRS})
if( PETSC_FOUND )
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp")
include_directories(${PETSC_C_INCLUDE_DIR})
include_directories(${PETSC_F_INCLUDE_DIR})
add_library( petscAlgebra dataStructure.f90 petsc_binding.f90)
target_link_libraries( petscAlgebra ${PETSC_LIBRARIES} ${LAPACK_LIBRARIES})
target_link_libraries( petscAlgebra ${PETSC_LIBRARIES} )
add_executable( petscTest reference_test.f90 )
target_link_libraries( petscTest petscAlgebra )
endif( ${PP} )
endif( PETSC_FOUND )
......@@ -15,3 +15,11 @@ Descriptions des fichiers:
- xxxx_binding.f90 : binding sur une bibliothèque de résolution
de système creux, quasiment identique aux modules de binding de LMGC90
Utilisation :
mkdir build
cd build
cmake ../ -DMP=pathtomumps
make
......@@ -12,11 +12,19 @@ module LinearAlgebra
type(dmumps_struc) :: mumps_par
end type sparse_mat
public declare, build, &
solve, erase
public declare, build, &
solve, erase, &
init, finalize
contains
subroutine init()
implicit none
print *, 'empty initialization'
end subroutine
subroutine declare(matrix, nb_dofs, nb_non_zero, i_indices, j_indices, is_sym, info)
implicit none
......@@ -125,4 +133,11 @@ module LinearAlgebra
end subroutine
subroutine finalize()
implicit none
print *, 'empty finalization'
end subroutine
end module
......@@ -28,16 +28,16 @@ module LinearAlgebra
end type sparse_mat
public sparse_init , &
sparse_declare, &
sparse_build , &
sparse_solve , &
sparse_erase , &
sparse_finalize
public init , &
declare, &
build , &
solve , &
erase , &
finalize
contains
subroutine sparse_init()
subroutine init()
implicit none
!
integer(kind=4) :: ierr
......@@ -175,7 +175,7 @@ module LinearAlgebra
end subroutine
subroutine sparse_finalize()
subroutine finalize()
implicit none
!
integer(kind=4) :: ierr
......
......@@ -2,7 +2,7 @@
program test_systems
use dataStructure, only : dstruc, systems_generation
use LinearAlgebra, only : declare, build, solve, erase
use LinearAlgebra, only : init, declare, build, solve, erase, finalize
implicit none
......@@ -13,6 +13,8 @@ program test_systems
!
integer(kind=4) :: i_sys, info
call init()
call systems_generation(systems)
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(i_sys)
......@@ -66,4 +68,6 @@ program test_systems
!$OMP END DO
!$OMP END PARALLEL
call finalize()
end program
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment